method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b79fd843-1493-4f5f-9528-8b1e4759c252 | 2 | private void paintPixel(int position, int color) {
int trans = ((color >> 24) & 0xff);
if (trans == 0);
else if (trans == 0xff)
pixels[position] = color;
else {
pixels[position] = applyTransparency(color, pixels[position]);
}
} |
3a9ec01d-442f-4160-a5f4-36c91cc67d51 | 8 | private boolean checkWinner(Character board[][]){
int i=0,j=0;
//for player1
if(board[0][9].owner == -1 || board[1][9].owner == -1 || board[2][9].owner == -1 || board[3][9].owner == -1 ){
sendWinner(PLAYER1);
//JOptionPane.showMessageDialog(null, "PLAYER1 wins!");
return true;
}
else if(board[0][0].o... |
68882f3d-d616-4f28-8931-822733688c83 | 6 | public Node<T> insert(T value) {
Node<T> node = null;
Node<T> parent = root;
while (parent != null) {
int delta = compare(parent.getValue(), value);
if (delta < 0) {
if (parent.getRight() == null) {
node = createNewNode(value);
parent.setRight(node);
node.se... |
14376cbb-c6e5-480c-89ae-94db4a97997b | 6 | public Complex weightedGeometricMean_as_Complex() {
if (!weightsSupplied) {
System.out.println("weightedGeometricMean_as_Complex: no weights supplied - unweighted value returned");
return this.geometricMean_as_Complex();
} else {
boolean holdW = Stat.weightingOptionS;
if (weightingReset) {
if (weigh... |
bc744609-18d2-4d96-baa3-0cec8134bb3d | 6 | public static HashMap<String, HashMap<String, Integer>> getMap(String filePath) throws Exception
{
HashMap<String, HashMap<String, Integer>> map =
new HashMap<String, HashMap<String,Integer>>();
BufferedReader reader = filePath.toLowerCase().endsWith("gz") ?
new BufferedReader(new InputStreamReader(
... |
e79bb777-2f13-4ab2-965a-67aa42a450af | 3 | public void animation(){
time++;
if(time % 10 == 0){
if(moving){
if(frame >= 1) frame = 0;
else frame++;
}
}
} |
12082b32-b809-4cc9-a19c-cc29523b95b2 | 7 | public static int[] loadFont(String path, int hLength, int vLength, int size) {
int width = 0;
int height = 0;
int index = 0;
int[] ids = new int[hLength * vLength];
int[] sheet = null;
try {
BufferedImage image = ImageIO.read(new FileInputStream(path));
width = image.getWidth();
height = image.get... |
60b5bc6e-fbea-4d46-a27b-84eb5270ddcc | 0 | public PauseMenu(ProBotGame game) {
super(game);
// TODO Auto-generated constructor stub
} |
6b72fb20-cd4d-4db2-ae09-b0c6e84ae1a9 | 2 | private void drawLeaderboard(Graphics2D g) {
int top_offset = FRAME_HEIGHT/4;
int lines_offset = FONT_SIZE + FONT_SIZE/2;
int x_offset = FRAME_WIDTH/4;
int numbers_offset = x_offset - g.getFontMetrics().stringWidth("9. ");
int number10_offset = x_offset - g.getFontMetrics().strin... |
2b3a60b3-b708-4b34-8671-68619653b7d7 | 5 | public static String RomanNum(int number)
{
String Roman = "";
while (number >= 10)
{
Roman += "X";
number -=10;
}
if (number >= 9 )
{
Roman += "IX";
number -= 9;
}
if (number >= 5)
{
Roman += "V";
number -= 5;
}
if (number >= 4)
{
Roman += "IV";
number -= 4;
}
while... |
8dfbef58-1e79-4d7d-b0c3-395c7f9e1c73 | 2 | public String getPredicate(List<String> objectIdList) {
StringBuilder sb = new StringBuilder("(");
for (int i = 0; i < objectIdList.size(); i++) {
sb.append("'");
sb.append(objectIdList.get(i));
sb.append("'");
if (i >= objectIdList.size() - 1) {
... |
26d27d84-8d3b-4d6c-9811-e322c8f730a0 | 7 | public MethodRequest dequeue() {
lock.lock();
MethodRequest result = null;
try {
while(mixedQueue.size()==0)
isTask.await();
MethodRequest preview = mixedQueue.peek();
if(preview.name.equals("Producer"))
{
if(servant.howMany+preview.howMany<bufferSize){
result = mixedQueue.... |
a586eb6a-592c-48d0-a136-d481fd692c80 | 0 | public static String getFolderPathNameYearAndMonthSubDirectoryDay() {
String path = "";
Calendar cal = Calendar.getInstance();
path += String.valueOf( cal.get(Calendar.YEAR)) + "_" ;
path += String.valueOf( cal.get(Calendar.MONTH) + 1);
path += System.getProperties().getProperty... |
63a4b27a-a4ab-46b5-82a4-e5f2ec85bb13 | 8 | private void applyShadow(BufferedImage image) {
int dstWidth = image.getWidth();
int dstHeight = image.getHeight();
int left = (shadowSize - 1) >> 1;
int right = shadowSize - left;
int xStart = left;
int xStop = dstWidth - right;
int yStart = left;
int yStop = dstHeight - right;
int shadowRgb = shad... |
6569641b-9706-4771-9569-6694fe5c0a21 | 9 | public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ComplexDecisionAction other = (ComplexDecisionAction) obj;
if (decisions == null) {
if (other.decisions != null)
return false;
} else if (decisions... |
997907aa-6ee2-47b3-86b5-222a1dc7d716 | 3 | @Test
public void WhenUpdatingWithInfiniteRefMax_ExpectAdditionalHostsPerLevel() throws UnknownHostException {
int refMax = Integer.MAX_VALUE;
RoutingTable localRT = new RoutingTable();
localhost_.setHostPath("0000");
localRT.setLocalhost(localhost_);
Host localHost0 = new P... |
c6921350-9831-481c-bc15-2b0803db4660 | 1 | public static void main(final String[] args) throws Exception {
System.out.println("Starting Test");
if (Times.snapshot() == false) {
System.err.println("Error during snapshot");
System.exit(1);
}
System.out.println("System time: " + Times.systemTime());
System.out.println("User time: " + Times.userTi... |
4118a3f7-59b3-4d37-addb-a69547231ac7 | 7 | public void testToGwoyeuRomatzyhStringArray() {
// any input of non-Chinese characters will return null
{
assertNull(PinyinHelper.toGwoyeuRomatzyhStringArray('A'));
assertNull(PinyinHelper.toGwoyeuRomatzyhStringArray('z'));
assertNull(PinyinHelper.toGwoyeuRomatzyhStringArray(','));
asser... |
5f4a710a-3b1f-455b-afe1-f9902bb1678d | 3 | public Class remove(int x, int y) {
Entity toRemove = null;
for (Entity e : entities) {
if (e.touch(x, y)) {
toRemove = e;
break;
}
}
entities.remove(toRemove);
return toRemove == null ? null : toRemove.getClass();
} |
cc76f384-21bb-4328-9ca0-e09f467e939e | 6 | @Override
public void update() {
if (inventory.isEmpty()) {
isDirty = true;
if (registry.getGameController().multiplayerMode != registry.getGameController().multiplayerMode.NONE && registry.getNetworkThread() != null) {
if (registry.getNetworkThread().readyForUpdates(... |
1c2cda40-486d-480e-8564-cc9e1235a8bb | 2 | public static ArrayList<BSPlayer> getChatSpies() {
ArrayList<BSPlayer> spies = new ArrayList<>();
for ( BSPlayer p : onlinePlayers.values() ) {
if ( p.isChatSpying() ) {
spies.add( p );
}
}
return spies;
} |
1fd8e8c4-92e1-424e-a98f-be0d8afaf192 | 9 | void save (OutputStream os) throws IOException, SynthIfException {
DataOutputStream dos = new DataOutputStream (os);
dos.writeBytes ("ZSyn"); // magic
dos.writeInt (1); // file format version
dos.writeInt (size().width);
dos.writeInt (size().height);
dos.writeInt (samplingRate);
dos.write... |
aa707b4f-5a83-4052-b365-b701a5183a6d | 8 | private static void writeResults( HashMap<String, Holder> map , List<String> taxaName, String level ) throws Exception
{
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(ConfigReader.getMetabolitesCaseControl() +
File.separator + level + "ratioVsAbundnace.txt")));
List<Holder> resultsList... |
cd05fc2f-3d44-48dc-9e89-eae70b346d17 | 2 | @Override
public Sensor getSensor() {
if (this.sensor == null){
ArrayList<Sense> senses = new ArrayList<Sense>();
for (Direction d : Direction.values()){
senses.add(new Sense(d.name() + DirtBasedAgentSenseConfig.DISTANCE_SUFFIX, 0));
senses.add(new Sense(d.name() + DirtBasedAgentSenseConfig.TYPE_SUFFIX... |
e46a17b3-c4d3-44f5-9660-393da3386764 | 9 | public void run() {
byte[] receiveBuffer = new byte[4];
try {
while (!Thread.interrupted()) {
count = (count + 1) % 3;
switch (count) {
case (0):
sendBuffer.put(IDENTIFIER, READ_REQUEST);
sendBuffer.put(CHANNEL, CHANEL_0);
sendBuffer.put(PADDING, PADDING_DATA);
break;
... |
b2c326a2-6437-49bc-bc9a-0dc6d3f60845 | 2 | public static Interlocuteur selectById(int id) throws SQLException {
String query = null;
Interlocuteur interlocuteur1 = new Interlocuteur();
ResultSet resultat;
try {
query = "SELECT * from INTERLOCUTEUR where ID_INTERLOCUTEUR=? ";
PreparedStatement pStatement... |
b9f4dcd5-fbc7-42b3-8463-9635d0da7256 | 0 | public String getServerVersion() {
return serverVersion;
} |
069efc93-9c0a-4af8-9f15-a05bd450736a | 3 | public static ItemType getItemType(Material m){
for(ItemType it : ItemType.values()){
try{
if(it.getMaterial().equals(m)) return it;
}catch(Exception e){ };
}return null;
} |
3ffce4e8-30c4-4ab4-aed2-eeadb7147ebf | 3 | private void initgl() {
final Thread caller = Thread.currentThread();
addGLEventListener(new GLEventListener() {
public void display(GLAutoDrawable d) {
GL gl = d.getGL();
if (inited && rdr)
redraw(gl);
TexGL.disposeall(gl);
}
public void init(GLAutoDrawable d) {
GL gl = d.getGL();
... |
23e7a8b0-019b-41d4-9670-caf56b722d84 | 8 | public void setQuery(String query) {
if (query == null) {
this.parameters = null;
return;
}
LinkedList<Parameter> parameters = new LinkedList<Parameter>();
if (query.equals("")) {
this.parameters = parameters;
return;
}
q... |
8beaa10e-9095-4181-b1ea-8756c46a6ce5 | 0 | @Override
public void windowIconified(WindowEvent e)
{
} |
0cc202b0-6da2-4932-ab13-a8987b6f9ad4 | 4 | private static Double doCalculate(Double result, BOEnum operation, Number operand) {
switch (operation) {
case ADD:
result += operand.doubleValue();
break;
case DIVIDE:
result /= operand.doubleValue();
break;
case MULTI:
result *= operand.doubleValue();
break;
case SUB:
result -= operand.... |
8dc697e4-9e93-4c99-aba7-d80bae8a8c46 | 4 | @Override
public void checkLink(final String lib) {
if (lib.contains("jaclib") && (lib.endsWith(".dll") || lib.endsWith(".dat") || lib.endsWith(".dylib"))) {
throw new SecurityException("Denied access to " + lib);
} else {
checkPermission(new RuntimePermission("loadLibrary." ... |
90f9b412-97f5-4609-a84e-c075f18a4f69 | 9 | private void collectiveVolitiveMovement(boolean overallWeightIncreased) {
double[] barycenter = new double[dimensions];
double totalWeight = 0;
// calculating barycenter
for (int i = 0; i < school.size(); i++) {
Fish _fish = school.get(i);
for (int j = 0; j < dimensions; j++) {
barycenter[j] +=... |
40a2dac9-8215-49fe-bd2f-a37d9ca64e7d | 4 | public int getChar(String code){
HuffNode p = root;
for(int i = 0; p!=null && i < code.length(); i++)
if(code.charAt(i) == '0')
p = p.left;
else
p = p.right;
if(p == null)
return ERROR;
return p.value;
} |
9927e910-4e91-4ab4-950b-80bcc2dfb005 | 2 | private static boolean isCollection(final Field field) {
if (Collection.class.isAssignableFrom(field.getType()))
return true;
if (Map.class.isAssignableFrom(field.getType()))
return true;
return false;
} |
c8fad906-9014-4d20-95f5-750235fe7e52 | 5 | private void wipeChunks() {
File regionFile = worldData.regionFile(currentRegion);
if (!regionFile.canWrite()) {
regionFile.setWritable(true);
if (!regionFile.canWrite()) {
sendMessage("Error! region file is locked and can't be trimmed: "
+ regionFile.getName());
return;
}
}
// since our... |
e0d72bb3-ae12-4a91-85f0-194fffd14f1c | 1 | @Override
void update(int s_width, int s_height){
//Do something
if(posX < (0-width)){
posX = s_width;
} else {
posX -= velocity;
}
} |
93402063-63d4-4c91-b311-e5cb52d2b3c4 | 8 | public boolean evaluateNextStep() {
Node n = open.poll();
if (n == null) {
// System.out.println("");
// System.out.println("Couldn't reach goal!");
// System.out.println("");
return true;
}
if (n.equals(goalNode)) {
// System.out... |
f8c01a68-912e-4102-9fab-cf335a43d2d5 | 7 | public List<String> binaryTreePaths(TreeNode root) {
List<String> ret = new ArrayList();
if(root==null) return ret;
if(root.left==null && root.right==null)
{
ret.add(String.valueOf(root.val));
return ret;
}
List<String> right = binaryTreePaths(ro... |
0d4d9129-8c88-47f3-b0fd-cd7d3c5ffaea | 8 | final boolean method2391(AbstractToolkit var_ha, int i, int i_9_, int i_10_) {
anInt10514++;
if (((Npc) this).definition == null
|| !method2447(97, 131072, var_ha))
return false;
Class101 class101 = var_ha.method3705();
int i_11_ = ((Mob) this).aClass264_10217
.method2019((byte) -78);
class101.method8... |
62e45d1a-f3fb-4cd5-9ad4-3b41f61fac42 | 4 | public void run() {
Thread thisThread = Thread.currentThread();
while (runner == thisThread) {
try {
if (reset > -1) {
clearScreenAndReset();
}
nextpoints(alg);
long diff = (System.currentTimeMillis() - lastRunTime);
if (diff > 5000) {
lastRunTime = System.currentTimeMillis();
... |
2f207d5d-f271-4912-bf96-25c4ec4ea98e | 8 | public static void main(String[] args) {
System.out.println("Program searching dengan bisaction ");
System.out.println("===================================");
Scanner in=new Scanner(System.in);
System.out.print("masukan jumlah data=");
int jumlah=in.nextInt();
... |
ba675fa5-7114-4915-b80b-132c05b361ee | 9 | @Override
public void keyPressed(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_W:
System.out.println("Move up");
break;
case KeyEvent.VK_S:
currentSprite = characterDown;
if (robot.isJumped() == false) {
robot.setDucked(true);
robot.setSpeedX(0);
}
break;
case KeyEvent.V... |
e63c28be-93b0-42da-8ad5-148572d84f6f | 1 | public String toString(){
StringBuilder builder = new StringBuilder();
for(Record record:records){
builder.append(record.toString());
builder.append(NewL);
}
return builder.toString();
} |
ce0bfad6-b783-44fb-b9ee-5e5f504e81dd | 2 | public static double[][] data(int n, int m){
double[][] d = new double[2*n][m];
for(int i=0; i<2*n; i++){
for(int j=0; j<m; j++){
d[i][j]=dataFill;
}
}
return d;
} |
0a1cb49c-c74b-41cb-ab73-a1a879279a7f | 2 | private Vertex getCentroid() {
double A = getArea();
int n = vertices.length;
double sum = 0;
for(int i = 0; i < n; i++) {
sum =+ (vertices[i].x+vertices[(i+1)%n].x)*(vertices[i].x*vertices[(i+1)%n].y-vertices[(i+1)%n].x*vertices[i].y);
}
double x = (1/(6*A))*sum;
for(int i = 0; i < n; i++) {
... |
41fc8215-fcf1-4700-9bf8-be4ceabf5a7f | 9 | public void drawButtons(Graphics g){
g.setColor(Color.green);
g.fill3DRect(50, 555, 100, 40, this.model == 0 ? true : false);
g.fill3DRect(160, 555, 100, 40, this.model == 1 ? true : false);
g.fillRect(270, 555, 100, 40);
//清除
g.setColor(Color.red);
g.fillRect(380, 555, 100, 40);
g.drawImage(this.gra... |
3bf6b03e-6378-49f1-bbad-348a43d906ad | 5 | public boolean compareScreensForShotBoundary(long seconds)
{
ScreenShot last = null;
ScreenShot lastButOne = null;
// Screenshots are create in ascending order of appearance (logical)
// So we just need to browse the list and remember two last screenshots
// until the screen... |
1398452d-e37f-46fc-95a4-11aaf4cfafaf | 3 | @Override
public byte[] getPayload() throws IOException {
File f=getFile();
if(f==null) {
log(this,Level.WARNING,"getPayload() called for null file - "+this.describeNode());
return null;
}
if(f.length() > 10240*1024) {
log(this,Level.WARNING,"getPa... |
3558de56-5bd0-42f1-b99f-91bd70146367 | 8 | public static void main(String[] args) throws Exception {
if (args.length != 9) {
System.err
.print("Syntax error. Correct syntax:\n"
+ " <trainfile_supervised> <trainfile_semisupervised> "
+ " <testset>"
+ "<supervised_weight> <observation_feature> <state_feature> "
+ "<modelfile... |
77f693d4-59bf-414d-90d6-bacb26f771d2 | 0 | public MainWindow() {
initComponents();
} |
4a701c2e-e871-41d0-9684-6fbdb516cb28 | 3 | public boolean needsItem(String itemName){
for(String s : neededItems){
if(s!=null && s.equals(itemName)){
return true;
}
}
return false;
} |
ce0351fd-fdd9-4d50-b78e-9615242ad12d | 0 | public String getRegEx() {return regex;} |
9e176f38-1c27-4e47-8727-0ef121513159 | 0 | public GameScreen(Game game, Level level) {
super(game);
this.level = level;
yScroll = 120;
} |
69b5dfec-4c3f-43c7-82fb-adff08555e6d | 9 | final public void Parameter_list() throws ParseException {
/*@bgen(jjtree) Parameter_list */
SimpleNode jjtn000 = new SimpleNode(JJTPARAMETER_LIST);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
jj_consume_token(LEFTPARENTHES... |
bbdaee12-ddc4-43d4-8cd2-1d90bbb36afd | 6 | public static void main(String args[])
{
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://... |
58e36e9d-2c2f-428c-8856-fc15c0e065c7 | 8 | public void actionPerformed(ActionEvent e) {
if (e.getSource() == toggle || e.getSource() == mb.showHideDecks) {
dp.toggle();
if (dp.isVisible()) {
sp.setVisible(true);
} else {
sp.setVisible(false);
}
}
if (e.getSource() == dp.create) {
JFileChooser fc = new JFileChooser();
FileNa... |
9899dd42-bae2-4a44-bb45-20a5291b3b99 | 1 | public void backup(int amount) {
inBuf += amount;
if ((bufpos -= amount) < 0)
bufpos += bufsize;
} |
a6a06d81-5094-428a-b31c-8ecf9e7dd689 | 9 | private static boolean processDecision(String decision) {
Solution solution;
SolutionType lastSolution = situation.getLastSolution().getSolutionType();
if (decision.equals("c")) {
if (lastSolution == SolutionType.CHECK) {
solution = new Solution(SolutionType.CHECK);
} else {
solution = new Solution(... |
f35ded30-8d3d-4858-83ed-26e7b1bb6fe6 | 7 | public String simplifyPath(String path) {
String[] paths = path.split("/+");
Stack<String> stack = new Stack<String>();
for (String s : paths) {
if (s.length() > 0) {
if (s.equals("..")) {
if (stack.empty()) {
continue;
... |
3deaf832-6080-45ba-b3fa-94637ccf8ddf | 1 | public int getChannelCount()
{
int count = (outputChannels==BOTH_CHANNELS) ? 2 : 1;
return count;
} |
98c5f3ab-4218-4a1d-8b2e-9a27569ea1ff | 2 | public CPSwatchesPalette(CPController controller) {
super(controller);
title = "Color Swatches";
// innerContainer.setSize(innerContainer.getPreferredSize());
setLayout(new GridLayout(5, 5));
CPColorSwatch swatch;
for (int i = 0; i < 25; i++) {
swatch = new CPColorSwatch();
if (i < initColors.length... |
d315a652-e205-4807-a923-466a1dcf7629 | 2 | public static void enterchk(){
for (String value:GosLink.gb.enters){
if (value.startsWith("1")){
GosLink.TC1.write(value.substring(2));
}
else{
GosLink.TC2.write(value.substring(2));
}
}
GosLink.gb.enters.clear();
} |
a5559c81-1dfb-459f-a2e8-e38e6db1640e | 3 | @Override
public int decidePlay(int turn, int drawn, boolean fromDiscard) {
int[] votes = new int[game.rack_size+1];
for (Model m: ensemble)
votes[m.decidePlay(turn, drawn, fromDiscard)+1]++;
int max = 0, max_idx = 0;
for (int i=0; i<votes.length; i++){
if (votes[i] > max){
max = votes[i];
max_id... |
2165e6d9-fe2a-4578-83e3-9fb5915aecee | 3 | public boolean clear(){
//checks to see if it overlaps anything
for(int b=0;b<objects.size();b++){
if(objects.get(b).kind!=0) //if the object is not a meteor, skip
continue;
boolean obstacle = collisionCircle((int)(x+vx),(int)(y+vy),h/2,(int)(objects.get(b).x),(i... |
4ceb226d-a356-41a8-b0ee-36861f59bcf4 | 0 | @Override
public Product factory() {
return new ConcreteProduct1();
} |
6f843131-90fd-4f9f-b816-458c0abbc4a0 | 9 | public void calculaCMOFooter(List<PATAMAR> listPatamares, int mesInicial, int mesFinal,int anoInicial,int anoFinal){
//List<String[]> cmo = getCMODados();
//String[][] dataArray = null;
for (int indicePatamar = 0; indicePatamar < listPatamares.size(); indicePatamar++) {
if (listPatamares.get(indicePatamar).... |
e67d3283-652b-4f9c-ae3f-2ba40170ad67 | 9 | public void updatePosition() {
if (xPos < xDestination)
xPos++;
else if (xPos > xDestination)
xPos--;
if (yPos < yDestination)
yPos++;
else if (yPos > yDestination)
yPos--;
if (xPos == xDestination && yPos == yDestination)
{
if(moving)
{
moving = false;
agent.msgAnimationDone();... |
d884f1db-009e-40eb-a917-f06b5767e119 | 7 | public static void checkOpenFile(final String path, final int mask) {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
// write
if (isFlag(mask, Constants.O_CREAT) ||
isFlag(mask, Constants.O_WRONLY)||
isFlag(mask, Constant... |
a309a975-f9d4-4f02-b124-cc186ad3d30b | 4 | public List<Student> getAllStudents() throws SQLException{
List<Student> mylist= new ArrayList();
try {
MyConnection mc=new MyConnection();
dbConnection=mc.getConnection();
statement = dbConnection.createStatement();
String selectTableS... |
b9533a27-ebe8-4275-80ee-f01174c5eef3 | 4 | private static String pluralize(String singular) {
return singular
+ ((singular.endsWith("s") || singular.endsWith("x")
|| singular.endsWith("sh") || singular.endsWith("ch")) ? "es"
: "s");
} |
2189d4bf-786a-45e6-9b93-777917b25d73 | 8 | @Override
public boolean remove(T t) {
boolean result = false;
boolean removed = false;
int removedindex = -1;
//Find Value
for(int i = 0; i < array.length && !removed; i++)
{
//Remove the Value.
if(array[i].equals(t)){
array[i] = null;
removed = true;
result = true;
removedindex = i;... |
f0e3cb97-39a6-44ae-a74c-b52ab23f6a9b | 0 | public Boolean getWypoz() {
return wypoz;
} |
4daf6422-742a-4cbd-ab35-f241e345965a | 1 | @Override
public void update(float dt) {
Body body = this.getBody();
if (body != null) {
float bodyX = this.getX() / Constants.WORLD_SCALE;
float bodyY = this.getY() / Constants.WORLD_SCALE;
body.setTransform(bodyX, bodyY, body.getAngle());
}
} |
f2a42fd6-df09-4f8f-88d3-fe16fb78ffbf | 3 | public byte[] _enumKeys(int key, int subkeyIndex, int maxKeyNameLength) throws RegistryErrorException
{
try
{
return (byte[])enumKey.invoke(null, new Object[] {new Integer(key), new Integer(subkeyIndex), new Integer(maxKeyNameLength)});
}
catch (InvocationTargetException ex)
{
throw ne... |
66837a69-42ef-4285-9030-da5443a0e3f5 | 0 | protected int getMaxLitterSize()
{
return MAX_LITTER_SIZE;
} |
c3a7c1f1-93ba-49d1-b1f6-7a00a5d6a4d1 | 2 | @Resource
public void setSessionFactory(SessionFactory sessionFactory) {
if (null == hibernateTemplate)
hibernateTemplate = new HibernateTemplate(sessionFactory);
if(null == session)
session = sessionFactory.openSession();
} |
c02aa72a-814c-4cf6-a7b6-4c91d70a0a5c | 0 | public void setPayment(PaymentEntity payment) {
this.payment = payment;
} |
65285610-928c-4024-a2f2-c46c1812b9e0 | 4 | public void loadModulesFromKmdFiles() throws FileNotFoundException, IOException {
log.debug("Loading dependencies");
depModuleManager = new ModuleManager();
depModuleManager.addModules(loadModuleDescriptors(dependencyKmdFiles));
depModuleManager.resolveModules();
ModuleDefinition module = fusionMo... |
566f7472-0870-4182-b1be-e80bc9882e90 | 1 | private void db(final String s) {
if (ClassHierarchy.DEBUG) {
System.out.println(s);
}
} |
f339b01b-abc2-4bc1-96c7-655bd7af0d4b | 3 | public int compute()
{
subSequence[0] = seq[0];
len = 1;
for (int i = 1; i < seq.length; i++) {
if (seq[i] < subSequence[len-1]) {
subSequence[len++] = seq[i];
} else if (seq[i] > subSequence[0]) {
subSequence[0] = seq[i];
}... |
7bc8d363-9093-474f-9ddf-e1367f479e7b | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Address other = (Address) obj;
if (address == null) {
if (other.address != null)
return false;
} else if (!address.equals(other.address)... |
e794fee6-8172-4e13-9d94-71b8094000c0 | 2 | public void UpdateFriendsListForPlayer(EntityManager em, Player player,
ArrayList<Long> friendIDs, ArrayList<String> friendNames,
ArrayList<String> friendImageURLs) {
// Since it's not that much data, and for simplicity sake we're just
// going to clear
// the FriendsList for the user (if they had one store... |
d6316547-8380-44b2-978a-6f581e75ed4c | 9 | private ItemStack generateItem(String name) {
Map<Item, Double> list = plugin.getPluginConfig().getLotto(name);
double total = 0;
for(final Double d : list.values().toArray(new Double[0]))
{
total += d.doubleValue();
}
double high = 1.0;
if(total != 100)
{
final double adj = 100 / total;
Iterat... |
2be31131-a500-417b-ae88-164884b33cae | 8 | public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null) return false;
if (obj.getClass() != this.getClass()) return false;
Picture that = (Picture) obj;
if (this.width() != that.width()) return false;
if (this.height() != that.height()) return... |
beead959-fa34-48aa-adca-c8652894fe3e | 3 | private void parse(String filename) {
try {
// use the default parser
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
// parse the input
saxParser.parse(filename, this);
}
catch (ParserConfigurationException pce) {
pce.printStackTra... |
66d6d6af-56a4-4abc-a8ee-fba0a5a33289 | 2 | public void testToStandardWeeks_years() {
Period test = Period.years(1);
try {
test.toStandardWeeks();
fail();
} catch (UnsupportedOperationException ex) {}
test = Period.years(-1);
try {
test.toStandardWeeks();
fail();
... |
d405e458-3723-440a-ae33-2dd28b0082b3 | 3 | public static List<Ryhma> haeRyhmat(String nimi) {
Connection c = connect();
if (c == null)
return null;
try {
List<Ryhma> ryhmat = new ArrayList<Ryhma>();
PreparedStatement ps = c.prepareStatement("SELECT * FROM ryhma WHERE nimi LIKE ?;");
ps.setString(1, "%" + nimi + "%");
ResultSet rs = ps.exec... |
9b7a72f1-a0a4-40d6-9514-de6ce4fd4d8e | 0 | @FXML
private void handleBtnCreateAction(ActionEvent event) {
userAction = UserAction.SUBMIT;
hide();
} |
ae6e28b0-323f-4c36-8e65-87a7bbe77b81 | 0 | private void postRequest()
{
System.out.println("post request !");
} |
f44762bc-9a36-49c3-b759-4a3de4a34e03 | 0 | @Override
public DataStructures getKit() {
return outData;
} |
fa19ddc9-2210-4bbf-bcb9-957dd8ad2612 | 9 | private void collectTypeHierarchy(Set<Class<?>> typeHierarchy, Class<?> type) {
if (type != null && !IGNORED_CLASSES.contains(type)) {
if (typeHierarchy.add(type)) {
Class<?> superclass = type.getSuperclass();
if (type.isArray()) {
superclass = primitiveTypeToWrapperMap.get(superclass);
}
... |
af7d8638-c846-4d57-ad50-9a1dad0a3018 | 7 | static int CacheAsociativa(int i) {
int Etiqueta = Integer.parseInt(Integer.toBinaryString(0x1000 | i).substring(1).substring(0, 9));
int Palabra = Integer.parseInt(Integer.toBinaryString(0x1000 | i).substring(1).substring(9, 12), 2);
int Linea = leastRecentlyUsed.consult(Integer.parseInt(Integ... |
d830219f-5f74-4e7c-8c7a-49c39721222f | 5 | protected void showSelectedCity(SessionRequestContent request) {
String selected = request.getParameter(JSP_SELECT_ID);
City currCity = null;
if (selected != null) {
Integer idCity = Integer.decode(selected);
if (idCity != null) {
List<City> list = (List<C... |
172c8264-903d-4883-9add-e67224b15a79 | 9 | public LinkedList<Node> findPath()
{
//Creating open_list and close_list
open_list_ = new LinkedList<AStarNode>();
closed_list_ = new LinkedList<AStarNode>();
AStarNode current, start = new AStarNode(map_[start_.x][start_.y].getNode()),
goal = new AStarNode(map_[goal_.x][goal_.y].ge... |
08543141-20a1-4a7e-861b-be586c02f248 | 9 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
ArrayList<Integer> prime = new ArrayList<Integer>();
prime.add(2);
prime.add(3);
int[] temp = new int[10001];
for (int i = 4; i <= 10000; i++) {
boolean p = true;
for (in... |
7e3b898c-2744-49b2-93c6-97b21a2f6188 | 3 | private synchronized void checkGridletCompletion()
{
ResGridlet obj = null;
int i = 0;
double len;
// NOTE: This one should stay as it is since gridletFinish()
// will modify the content of this list if a Gridlet has finished.
// Can't use iterator since it wi... |
98439b99-bdf7-4a1d-9cff-7724de425f37 | 5 | @Override
public boolean action() throws JSONException, NextField {
JSONObject result = getResult();
if (result.getJSONObject("action").getString("cont").equals("knast")) {
Output.printClockLn("In den Knast", Output.INFO);
if (getKlatsche().useCardAsk(PlanBundesklatsche.CARD_KNASTRAUS)) {
return true;
... |
bd4ed6ce-c273-4829-a440-168926bf6989 | 3 | public boolean checkIsbn(int uid) {
if(isbn%56000<999) // Checking if the ISBN is valid i.e, within range 56000-56999
{
for(int i=1;i<=3;i++)
if( this.isbn== uid)
{
return true;
}
}
else
System.out.println("Invalid ISB... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.