method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b7d2a690-8cd2-447b-b20e-05677add2b50
7
@EventHandler public void onPlayerMove(PlayerMoveEvent event) { // Respect other plugins if (event.isCancelled()) { return; } Player player = event.getPlayer(); if (preChecks(player, event.getTo())) { JumpPort port = JumpPorts.getPort(event.getTo()); if (checkInstant(event)) { return; } if (checkJump(event)) { return; } if (checkFall(event)) { return; } // Tell them info about the pad if (!ignoredPlayers.contains(player.getName())) { player.sendMessage(Lang.get("port.triggered").replaceAll("%N", port.getName()).replaceAll("%D", port.getDescription())); if (port.getPrice() > 0) { player.sendMessage(Lang.get("port.price").replaceAll("%P", "" + port.getPrice())); } player.sendMessage(Lang.get("port.triggers")); ignoredPlayers.add(player.getName()); } } }
be5e77a4-72af-4281-bcd3-ac353474a4ee
3
private void addPiece(final BusyTile busyTile, final Position position, final boolean activate) { add(busyTile); if(busyTile.getColor())//ovvero se è bianco if (activate) { busyTile.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { board.removeMarkers(); FactoryOfPlays factory= new FactoryOfPlaysForPiece(position,board); for (AbstractPlay play : factory) board.setMarker(play); getContentPane().removeAll(); invalidate(); showBoard(activate); validate(); } }); } }
427ea6c8-343d-4a5b-a131-1ae918215bae
2
private void sortFiles(File[] files) { if (directoryComparator != null) { try { Arrays.sort(files, directoryComparator); } catch (ClassCastException cce) { cce.printStackTrace(); } } else { Arrays.sort(files); } }
98b33444-4dfc-413c-9053-23b875df1a17
6
public Object getValueAt(int row, int col) { CounterParty c = (CounterParty)counterParties.getBusinessObjects().get(row); if (col == 0) { return c; } else if (col == 1) { return Utils.toString(c.getAliases()); } else if (col == 2) { return c.getBankAccountsString(); } else if (col == 3) { return c.getBICString(); } else if (col == 4) { return c.getCurrencyString(); } else if (col == 5) { return c.getAccount(); } else return ""; }
44492020-6930-416f-86a3-601dff3f480f
4
public MainGeneration() throws Exception{ int x = 0; Scanner sc = new Scanner(System.in); /*Tant que le résultat est différent des réponses attendues On continue de demander une réponse adéquate*/ while(x != 1 && x != 2 ){ System.out.println("Génération Controlée(1)"); System.out.println("Génération Aléatoire (2)"); System.out.println("Choix :"); x = sc.nextInt(); } switch (x) { case 1: generationControlee(); break; case 2: generationAleatoire(); break; default: break; } sc.close(); }
ce2eb178-4832-44fb-99c2-06bd8e2eca68
3
public CoreInterface getTreeObject(CoreInterface ci){ if(ci.getClass() == Dvd.class){ return dvdTree.get(ci); }else if(ci.getClass() == Location.class){ return locationTree.get(ci); }else if(ci.getClass() == Genre.class){ return genreTree.get(ci); } return null; }
d0b97510-f48d-4272-b4e8-47006b1f6c43
3
private void checkEnoughCapacity(int number) { int len = keys.length; if (len - currentSize < number) { // Make inner arrays two times longer changeCapacityBy(keys, len); changeCapacityBy(values, len); } else if (currentSize < len / 4 && len / 2 > INITIAL_CAPACITY) { // Make inner arrays two times shorter if only quarter is used changeCapacityBy(keys, -len / 2); changeCapacityBy(values, -len / 2); } }
c25f01e6-59a9-45c4-b5a2-36ac51f53a69
1
public Course(ResultSet rs) throws Exception{ DBConnector db = new DBConnector(); if(rs.next()){ setCourseID(rs.getInt("courseid")); setTitle(rs.getString("title")); setYear(rs.getInt("year")); setSeason(rs.getString("season")); setTeacher(db.getPerson(rs.getInt("teacherid"))); } }
b4779fb7-5dab-42c5-a195-1d90e3d2e3d3
9
protected boolean canAct(Tickable ticking, int tickID) { switch(tickID) { case Tickable.TICKID_AREA: if(!(ticking instanceof Area)) break; //$FALL-THROUGH$ case Tickable.TICKID_MOB: case Tickable.TICKID_ITEM_BEHAVIOR: case Tickable.TICKID_ROOM_BEHAVIOR: { if((--tickDown)<1) { tickReset(); if((ticking instanceof MOB)&&(!canActAtAll(ticking))) return false; final int a=CMLib.dice().rollPercentage(); if(a>chance) return false; return true; } break; } default: break; } return false; }
3465d3cc-8878-4d5e-a1db-15770d210c52
5
private void update(DocumentEvent event) { String newValue = ""; try { Document doc = event.getDocument(); newValue = doc.getText(0, doc.getLength()); } catch (BadLocationException e) { e.printStackTrace(); } if (newValue.length() > 0) { int index = targetList.getNextMatch(newValue, 0, Position.Bias.Forward); if (index < 0) { index = 0; } targetList.ensureIndexIsVisible(index); String matchedName = targetList.getModel().getElementAt(index).toString(); if (newValue.equalsIgnoreCase(matchedName)) { if (index != targetList.getSelectedIndex()) { SwingUtilities.invokeLater(new ListSelector(index)); } } } }
26e5fdcf-44c5-442a-b41a-14e28a7b138b
5
private void collectFiles(String path, File... files) { for (File file : files) { if (!file.canRead()) { logger.warn("Can't read from file %:", file.getAbsolutePath()); continue; } UpdateItem ui = new UpdateItem(); ui.setNewData(true); ui.setIsAnti(false); ui.setSize(0); ui.setmTime(file.lastModified()); ui.setmTimeDefined(file.lastModified() != 0L); ui.setmTimeDefined(true); String childName; if (!path.isEmpty()) { childName = path + File.separator + file.getName(); } else { childName = file.getName(); } ui.setName(childName); ui.setFullName(file.getAbsolutePath()); ui.setIsDir(file.isDirectory()); ui.setIsAnti(false); ui.setSize(file.length()); if (file.isDirectory()) ui.setAttrib(16); else ui.setAttrib(32); ui.setAttribDefined(true); updateItems.add(ui); if (file.isDirectory()) { collectFiles(childName, file.listFiles()); } } }
624ce2cb-1345-4cb0-99c1-aae948057a7e
6
public String getAlfrescoProperty(String filename, String property) { Document doc = (Document) session.getObjectByPath("/" + filename); List<Property<?>> properties = doc.getProperties(); String propertyValue = ""; for (Property<?> p : properties) { if (p.getFirstValue() == null) { if (p.getId().equals(property)) { System.out.println(p.getId() + "\t" + p.getLocalName() + "=" + p.getFirstValue()); propertyValue = p.getFirstValue() + ""; } } else { if (p.getId().equals(property)) { System.out.println(p.getId() + "\t" + p.getLocalName() + "=" + p.getFirstValue()); propertyValue = p.getFirstValue() + ""; } } } return propertyValue; }
9f708ba7-1a9c-4043-96ea-2447c036e138
8
private void makewt(int nw) { int j, nwh, nw0, nw1; float wn4r, wk1r, wk1i, wk3r, wk3i; double delta, delta2, deltaj, deltaj3; ip[0] = nw; ip[1] = 1; if (nw > 2) { nwh = nw >> 1; delta = 0.785398163397448278999490867136046290 / nwh; delta2 = delta * 2; wn4r = (float) Math.cos(delta * nwh); w[0] = 1; w[1] = wn4r; if (nwh == 4) { w[2] = (float) Math.cos(delta2); w[3] = (float) Math.sin(delta2); } else if (nwh > 4) { makeipt(nw); w[2] = (float) (0.5 / Math.cos(delta2)); w[3] = (float) (0.5 / Math.cos(delta * 6)); for (j = 4; j < nwh; j += 4) { deltaj = delta * j; deltaj3 = 3 * deltaj; w[j] = (float) Math.cos(deltaj); w[j + 1] = (float) Math.sin(deltaj); w[j + 2] = (float) Math.cos(deltaj3); w[j + 3] = (float) -Math.sin(deltaj3); } } nw0 = 0; while (nwh > 2) { nw1 = nw0 + nwh; nwh >>= 1; w[nw1] = 1; w[nw1 + 1] = wn4r; if (nwh == 4) { wk1r = w[nw0 + 4]; wk1i = w[nw0 + 5]; w[nw1 + 2] = wk1r; w[nw1 + 3] = wk1i; } else if (nwh > 4) { wk1r = w[nw0 + 4]; wk3r = w[nw0 + 6]; w[nw1 + 2] = (float) (0.5 / wk1r); w[nw1 + 3] = (float) (0.5 / wk3r); for (j = 4; j < nwh; j += 4) { int idx1 = nw0 + 2 * j; int idx2 = nw1 + j; wk1r = w[idx1]; wk1i = w[idx1 + 1]; wk3r = w[idx1 + 2]; wk3i = w[idx1 + 3]; w[idx2] = wk1r; w[idx2 + 1] = wk1i; w[idx2 + 2] = wk3r; w[idx2 + 3] = wk3i; } } nw0 = nw1; } } }
d8f285b9-352b-44de-a4a4-a2f7a94be6f5
8
public SortedSet<Map.Entry<String,Integer>> runRandom(final int n){ final Map<String,Integer> results = new HashMap<String,Integer>(); final int threadCount = 10; final int threadLoad = n/threadCount; if(n<threadCount){ for(int i = 0;i<n;i++){ String seq = backtrackF(0, len - 1); Integer freq = results.get(seq); results.put(seq, freq == null?(1):freq+(1)); } return sortByFreq(results); } class workerThread extends Thread{ public void run(){ for(int i=0;i<threadLoad;i++){ String seq = backtrackF(0, len - 1); Integer freq = r.get(seq); r.put(seq, freq == null?(1):freq+(1)); } } public HashMap<String,Integer> r = new HashMap<String,Integer>(); } workerThread ts[] = new workerThread[threadCount]; for(int i = 0 ;i <ts.length;i++){ ts[i] = new workerThread(); ts[i].start(); } for(int i =0;i<threadCount;i++){ try { ts[i].join(); for(Map.Entry<String,Integer> entry:ts[i].r.entrySet()){ Integer count = entry.getValue(); Integer existing = results.get(entry.getKey()); results.put(entry.getKey(), existing==null?count:existing+count); } } catch (InterruptedException e) { e.printStackTrace(); } } return sortByFreq(results); }
ff7625de-15a0-44cb-a2f1-fd2df4a2223d
4
protected void dispatchEvent(AWTEvent event){ super.dispatchEvent(event); // interested only in mouseevents if(!(event instanceof MouseEvent)) return; MouseEvent me = (MouseEvent)event; // interested only in popuptriggers if(!me.isPopupTrigger()) return; // me.getComponent(...) retunrs the heavy weight component on which event occured Component comp = SwingUtilities.getDeepestComponentAt(me.getComponent(), me.getX(), me.getY()); // interested only in textcomponents if(!(comp instanceof JTextPane)) return; // no popup shown by user code if(MenuSelectionManager.defaultManager().getSelectedPath().length>0) return; // create popup menu and show Point pt = SwingUtilities.convertPoint(me.getComponent(), me.getPoint(), textPane); popupMenu.show(textPane, pt.x, pt.y); }
0cfe15e8-2234-4b39-8315-d5ab281bb65b
2
private void updateMatchResults(Player winner) { if(null!=winner) { GameScore gs = players.get(winner); if(gs.hasWon()) { matchWinner = winner; matchWinner.win(); } } }
9dbcfd30-cab9-423e-b6e7-7f8a97d292d0
4
public String getHelpText(HelpType command) throws Connect4Exception { String helpText = ""; switch (command) { case BOARD: case GAME: case SPACES: case TOKENS: helpText = command.getHelpText(); break; default: throw new Connect4Exception(ErrorType.ERROR105.getMessage()); } return helpText; }
5fd9a130-2395-4fdf-9077-bc5bf596f130
5
public static void ChangeTile() { if (!intrfce.Menu.runMenu) { for (int h = 0; h < Engine.mb.BLOCKS[layer - 1].length; h++) { for (int w = 0; w < Engine.mb.BLOCKS[layer - 1][h].length; w++) { if (r.intersects(Engine.mb.BLOCKS[layer - 1][h][w].r)) { if (isPressed) { Engine.mb.ID[layer - 1][h][w] = blockToChangeTo; currentBlock = Engine.mb.BLOCKS[layer - 1][h][w].name; Engine.mb.BuildBlocks(); } } } } } }
b20d499a-8c73-4017-89c7-1a386b841760
5
public boolean updateConnections(Node n) throws WrongConfigurationException{ boolean edgeAdded = false; // For the given node n, retrieve only the nodes which are possible neighbor candidates. This // is possible because of the rMax filed of the GeometricNodeCollection, which indicates the maximum // distance between any two connected points. Enumeration<Node> pNE = Runtime.nodes.getPossibleNeighborsEnumeration(n); while( pNE.hasMoreElements() ){ Node possibleNeighbor = pNE.nextElement(); if(n.ID != possibleNeighbor.ID){ // if the possible neighbor is connected with the the node: add the connection to the outgoing connection of n if(isConnected(n, possibleNeighbor)){ // add it to the outgoing Edges of n. The EdgeCollection itself checks, if the Edge is already contained edgeAdded = !n.outgoingConnections.add(n, possibleNeighbor, true) || edgeAdded; // note: don't write it the other way round, otherwise, the edge is not added if edgeAdded is true. } } } // loop over all edges again and remove edges that have not been marked 'valid' in this round boolean dyingLinks = n.outgoingConnections.removeInvalidLinks(); return edgeAdded || dyingLinks; // return whether an edge has been added or removed. }
a4878106-9bea-49d2-a1c4-1470185f79cf
1
public void Command (CommandSender sender, Command cmd, String commandlabel, String[] args) { if (args[0].equalsIgnoreCase("reload")) { return; } }
071b58b5-7d8f-4ad6-9e21-7fb08182597c
0
@Override public String toString() { return "isStatic()"; }
68aab12b-dd9a-46e2-b675-fc8159088305
2
public void flush() { FileOutputStream saveFile = null; try { saveFile = new FileOutputStream(".contacts.txt"); ObjectOutputStream expt = new ObjectOutputStream(saveFile); expt.writeObject(this.IDgenerator); expt.writeObject(this.contactList); expt.writeObject(this.meetingList); }catch(IOException ex){ ex.printStackTrace(); }finally{ try { saveFile.close(); }catch(IOException ex){ ex.printStackTrace(); } } }
bff7c8f1-dc57-486b-bb31-038b5dd1716b
1
public void cleanup() { final Iterator iter = cleanup.iterator(); while (iter.hasNext()) { final Node node = (Node) iter.next(); node.cleanup(); } vars = null; phis = null; pushes = null; pops = null; defs = null; def = null; cleanup = null; }
220cdc96-d44c-4bb8-8785-1c1b7fefb093
0
public boolean checkDefeated(){ return monster.isAlive(); }
43c97fc5-7217-4c50-92ce-ec49c1a883c7
6
public void draw(Graphics g){ final STATE state = this.now_state; switch(state){ case STATE_NORMAL: int frame_count = player.get_frame_count(); int chip_size = MapChip.CHIP_SIZE;//1チップの大きさ /* 移動アニメーションのためにオフセットを計算する */ double one_frame = (double)chip_size / (double)Frame_Of_Move; double frame_offset = 0; if(frame_count < 0) frame_offset = 0; else frame_offset = one_frame * ((double)Frame_Of_Move - (double)frame_count - 1); int dx = Object.DirectionVector[player.get_now_dir().ordinal()][0]; int dy = Object.DirectionVector[player.get_now_dir().ordinal()][1]; /* 描画する位置は、通常座標から1フレームごとに近づけていく(アニメーション) */ int pX = player.get_posX() * chip_size - (int)frame_offset * dx; int pY = player.get_posY() * chip_size - (int)frame_offset * dy; /* 左上(原点)とする座標を(offsetX,offsetY)を決定する */ int offsetX = Math.min(player.get_start_x() * chip_size - pX,0); offsetX = Math.max(offsetX, MainPanel.WIDTH - ROW * chip_size); int offsetY = Math.min(player.get_start_y() * chip_size - pY,0); offsetY = Math.max(offsetY, MainPanel.HEIGHT - COL * chip_size); /* 左上をタイルに変換 */ int sx = -offsetX / chip_size; int sy = -offsetY / chip_size; //System.out.println(new Point(sx,sy)); //画面の範囲内にあるマップチップを描画 for(int y = sy; y <= Math.min(sy + DISPLAY_COL,COL - 1); y++){ for(int x = sx; x <= Math.min(sx + DISPLAY_ROW,ROW - 1); x++){ map_chips[y][x].draw(offsetX,offsetY,g); } } /* 画面の範囲内にあるオブジェクトを描画 */ for(int i = 0; i < objects.size(); i++){ objects.get(i).draw(offsetX,offsetY,g); } break; case STATE_STOP://ロード中 break; } }
228f8e45-7061-4d4d-b535-4a3e3af9af9a
8
public void oneLevelDeepPost(String container1, String url1, String dest) { String fileData = ""; BufferedWriter bufferWritter = null; try { String container = container1; String url = url1; String destination = dest; Document doc = postUrl(url); Elements links = doc.select(container + " a[href]"); print("\nLinks: (%d)", links.size()); try { for (Element link : links) { boolean connected = false; int attempts = 0; while (!connected) { if (attempts++ == 1) { break; } try { org.jsoup.Connection connection = org.jsoup.Jsoup.connect(link.attr("abs:href")).timeout(10 * 1000); connection.followRedirects(false); org.jsoup.Connection.Response response = connection.execute(); if (response.statusCode() == 200) { Document doc1 = connection.get(); fileData += doc1.toString().concat("\n"); } } catch (Exception ex) { System.out.println("Connection failure #" + attempts + ": " + link); System.out.println(ex.getMessage()); } } } FileWriter fstream = new FileWriter(destination + "out.txt", true); bufferWritter = new BufferedWriter(fstream); bufferWritter.write(fileData); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } finally { try { bufferWritter.close(); } catch (IOException e) { e.printStackTrace(); } JLabel errorFields = new JLabel("<HTML><FONT COLOR = Blue>Success</FONT></HTML>"); JOptionPane.showMessageDialog(null, errorFields); } }
14405c12-98ee-4ba9-a368-f4d4ddbc8786
4
public void toggle(KeyEvent key, boolean pressed){ int keyCode = key.getKeyCode(); if(keyCode == KeyEvent.VK_UP) up = pressed; if(keyCode == KeyEvent.VK_DOWN) down = pressed; if(keyCode == KeyEvent.VK_LEFT) left = pressed; if(keyCode == KeyEvent.VK_RIGHT) right = pressed; }
47a10939-9240-4517-bc59-053abf08e91a
4
public boolean isNear(double x, double y, double zoom) { double distance = Math.abs(dist(x, y)); if (zoom >= 0 && distance > 5.0 / Math.sqrt(zoom)) return false; double d = (from.getX() - to.getX()) * (from.getX() - to.getX()) + (from.getY() - to.getY()) * (from.getY() - to.getY()); double d1 = (from.getX() - x) * (from.getX() - x) + (from.getY() - y) * (from.getY() - y); double d2 = (to.getX() - x) * (to.getX() - x) + (to.getY() - y) * (to.getY() - y); if (d1 > d || d2 > d) return false; return true; }
123d2de6-37e6-4fad-81d8-44854b51afcb
6
public Complex[] getData1() { for (k = 0; k < power; k++) { for (j = 0; j < 1 << k; j++) { bfsize = 1 << (power - k); for (i = 0; i < bfsize / 2; i++) { Complex temp1 = new Complex(0, 0); Complex temp2 = new Complex(0, 0); p = j * bfsize; x2[i + p] = temp1.plus(x1[i + p], x1[i + p + bfsize / 2]); temp2 = temp1.minus(x1[i + p], x1[i + p + bfsize / 2]); x2[i + p + bfsize / 2] = temp1.times(temp2, wc[i * (1 << k)]); } } x = x1; x1 = x2; x2 = x; } for (j = 0; j < count; j++) { p = 0; for (i = 0; i < power; i++) { if ((j & (1 << i)) != 0) p += 1 << (power - i - 1); } fd1[j] = x1[p]; } return fd1; }
a94ed3a6-fa7e-43a2-9653-10fa10eb73c1
7
public static void main(String[] args) { final long startTime = System.currentTimeMillis(); /* if (args.length > 3 && !args[1].equals("-k") || args.length < 3) { System.err.println("Usage: [-DataCounter implementation] [-sorting routine] [filename of document to analyze]"); System.exit(1); }*/ // DataCounter implementation DataCounter<String> counter = null; if (args[0].equals("-b")) { counter = new BinarySearchTree<String>(new StringComparator()); } else if (args[0].equals("-a")) { counter = new AVLTree<String>(new StringComparator()); } else if (args[0].equals("-m")) { counter = new MoveToFrontList<String>(new StringComparator()); } else if (args[0].equals("-h")) { counter = new HashTable<String>(new StringComparator(), new StringHasher()); } //implemented in phase B else { System.err.println("Must use -b (BinarySearchTree), -a (AVLTree), -m (MoveToFrontList), " + "or -h (HashTable) for argument 1."); System.exit(1); } // Count the words and retrieve the array representation /*if(!args[1].equals("-k")){ countWords(args[2], counter); }else{*/ countWords(args[3], counter); //} DataCount<String>[] counts = getCountsArray(counter); // Choose the sorting routine and sort /* if (args.length == 3) { if (args[1].equals("-is")) { Sorter.insertionSort(counts, new DataCountStringComparator()); } else if (args[1].equals("-hs")) { Sorter.heapSort(counts, new DataCountStringComparator()); } else if (args[1].equals("-os")) { Sorter.otherSort(counts, new DataCountStringComparator()); } else { System.err.println("Must use -is (Insertion sort), -hs (Heap sort), -os (Other sort)," + " or -k <number> (Top-k sort) for argument 2."); System.exit(1); } } else */if (args.length == 4) { //implemented in phase B if (args[1].matches("-k")) { Sorter.topKSort(counts, new InverseDataComparator(), java.lang.Integer.parseInt(args[2])); } //implemented in phase B else if (args[1].equals("-hs")) { Sorter.heapSort(counts, new DataCountStringComparator()); } } else { System.err.println("Must use -is (Insertion sort), -hs (Heap sort), -os (Other sort)," + " or -k <number> (K-Sort) for argument 2."); System.exit(1); } if(args[1].matches("-k")){ //printDataCountk(counts,java.lang.Integer.parseInt(args[2])); }else{ //printDataCount(counts); } printDataCountk(counts,java.lang.Integer.parseInt(args[2])); final long endTime = System.currentTimeMillis(); System.out.println("Total execution time: " + (endTime - startTime) ); }
ecf72214-f4ec-416b-a008-51e7521c9bea
0
@Override public String toString() { return "isPublic()"; }
4423b66f-0808-461f-9115-62acf279a9ca
4
private Integer differenceBetweenSpecieLists(List<Specie> list1, List<Specie> list2) { Integer difference1 = 0; for (Specie s : list1) { if (!list2.contains(s)) { difference1++; } } Integer difference2 = 0; for (Specie s : list2) { if (!list1.contains(s)) { difference2++; } } return Math.max(difference1, difference2); }
9a537d50-985c-422b-9825-617c044b9ac5
4
private int jjMoveStringLiteralDfa4_5(long old0, long active0) { if (((active0 &= old0)) == 0L) return 4; try { curChar = input_stream.readChar(); } catch (java.io.IOException e) { return 4; } switch (curChar) { case 93: if ((active0 & 0x200000L) != 0L) return jjStopAtPos(4, 21); break; default: return 5; } return 5; }
e2ecbd55-311f-4535-bc53-8623966d7f45
6
public void drawSkillEffects(Graphics2D g2d, Character character, boolean isMonster) { int buffAmount = character.getBuffs().size(); if (buffAmount > 0) { for (int i=0; i<character.getBuffs().size(); i++) { if (!isMonster) { g2d.drawImage(character.getBuffs().get(i).getEffectGraphic().getImage(), 100+40*i, 480, null); }else { g2d.drawImage(character.getBuffs().get(i).getEffectGraphic().getImage(), 660-40*i, 480, null); } } } int debuffAmount = character.getDebuffs().size(); if (debuffAmount > 0) { for (int i=0; i<character.getDebuffs().size(); i++) { if (!isMonster) { g2d.drawImage(character.getDebuffs().get(i).getEffectGraphic().getImage(), 100+40*i, 520, null); }else { g2d.drawImage(character.getDebuffs().get(i).getEffectGraphic().getImage(), 660-40*i, 520, null); } } } }
9c21f5ef-5df7-4d2c-bba8-933f1c0dc41a
6
private void vender() { dtmcv = (DefaultTableModel) JT_CarrinhoCompras.getModel(); JT_Venda_Produtos.selectAll(); int linha = JT_Venda_Produtos.getSelectedRow(); int codigo = Integer.parseInt((String) JT_Venda_Produtos.getValueAt(linha, 0)), quantidade = Integer.parseInt(JTF_Qtde.getText()); String descricao = (String) JT_Venda_Produtos.getValueAt(linha, 1); Double preco = Double.parseDouble((String) JT_Venda_Produtos.getValueAt(linha, 2)); Boolean existe = false; int linhas = JT_CarrinhoCompras.getRowCount(); if (linhas > 0) { for (int j = 0; j < linhas; j++) { int cod = (int) JT_CarrinhoCompras.getValueAt(j, 0); if (cod == codigo) { existe = true; linha = j; } } } if (existe) { JT_CarrinhoCompras.setValueAt(quantidade, linha, 3); } else { dtmcv.addRow(new Object[]{codigo, descricao, preco, quantidade}); } String sql = "SELECT id, descricao, valor_venda FROM b_produtos WHERE liberar_venda = 1;"; try { rs = st.executeQuery(sql); limpaTabela(); while (rs.next()) { dtm.addRow(new Object[]{rs.getString("id"), rs.getString("descricao"), rs.getString("valor_venda")}); } } catch (SQLException ex) { System.out.println("Pesquina não encontrada: " + ex.toString()); } JTF_Produto.setText(""); JTF_Codigo.setText("1"); JTF_Qtde.setText("1"); JTF_Produto.requestFocus(); }
ad02bcb1-964e-4e77-bcfb-e8c633beca9d
5
@Test public void testExecutingState() throws ProcessExecutionException, ProcessRollbackException { IProcessComponent<?> comp = TestUtil.executionSuccessComponent(true); // use reflection to set internal process state TestUtil.setState(comp, ProcessState.EXECUTING); assertTrue(comp.getState() == ProcessState.EXECUTING); // test valid operations TestUtil.setState(comp, ProcessState.EXECUTING); try { comp.pause(); } catch (InvalidProcessStateException ex) { fail("This operation should have been allowed."); } // test invalid operations TestUtil.setState(comp, ProcessState.EXECUTING); try { comp.execute(); fail("InvalidProcessStateException should have been thrown."); } catch (InvalidProcessStateException ex) { // should happen } TestUtil.setState(comp, ProcessState.EXECUTING); try { comp.rollback(); fail("InvalidProcessStateException should have been thrown."); } catch (InvalidProcessStateException ex) { // should happen } TestUtil.setState(comp, ProcessState.EXECUTING); try { comp.resume(); fail("InvalidProcessStateException should have been thrown."); } catch (InvalidProcessStateException ex) { // should happen } }
02764622-80e9-40c8-8fd5-893ee6b75832
7
public static final List<String> loadEnumerablePage(final String iniFile) { final StringBuffer str=new CMFile(iniFile,null,CMFile.FLAG_LOGERRORS).text(); if((str==null)||(str.length()==0)) return new Vector<String>(); final List<String> page=Resources.getFileLineVector(str); for(int p=0;p<(page.size()-1);p++) { String s=page.get(p).trim(); if(s.startsWith("#")||s.startsWith("!")) continue; if((s.endsWith("\\"))&&(!s.endsWith("\\\\"))) { s=s.substring(0,s.length()-1)+page.get(p+1).trim(); page.remove(p+1); page.set(p,s); p=p-1; } } return page; }
8488018f-afe3-4ab0-a24e-b87fc6c32084
1
@Override public GameFont getClonedObject(String name, Map<String, String> data) { // Get an existing GameFont, remember this can possibly return null if // it wasn't a validFont. GameFont cachedFont = getObject(name, data); if (cachedFont == null) { return cachedFont; } return cachedFont.getShallowClone(); }
d704a4fc-7240-4cfc-bde0-024fb3f3a87e
0
public void f() { System.out.println("public f()"); }
26538eb2-316b-48bf-938e-be84b09efa26
1
public HostInfo(String address, int port) { try { this.address = InetAddress.getByName(address); this.port = port; } catch (Exception e) { System.err.println("Cannot get IP address" + address + ":" + port); } }
3293cdd7-d12d-4138-9d4a-2f8f37f7d3ce
5
public void update() { for (int i = 0; i < bullets.size(); i++) { Bullet bullet = bullets.get(i); bullet.fly(); for (int j = 0; j < enemies.size(); j++) { Enemy enemy = enemies.get(j); if (GameTool.isCollision(bullet, enemy)) { // 敵人要消失 enemies.remove(enemy); // 子彈要消失 bullets.remove(bullet); } } } for (int i = 0; i < eBullets.size(); i++) { EnemyBullet eb = eBullets.get(i); eb.fly(); if (GameTool.isCollision(eb, player)) { // 自己要消失 player = null; // 子彈要消失 eBullets.remove(eb); } } }
bd915b04-8616-4c69-aa5e-27bb660cd0b0
9
public void quickClear(Space center) { if (center.getState() == State.REVEALED && !center.isMine()) { int nearFlags = 0; List<Space> adjacent = center.getAllAdjecentSpaces(this); for (Space s : adjacent) { if (s.getState() == State.FLAGGED) { nearFlags++; } if (s.getState() == State.QUESTIONED) { return; } } if (nearFlags == ((Empty) center).getNumber()) { for (Space s : adjacent) { if (s.getState() == State.COVERED && !parent.isLost()) { singleClear(s); } } } } }
3a7c7892-3940-48f2-a176-96a4dbf3e37a
7
@Override public List<Point> findWay(Node<Point> start, Node<Point> goal, ListGraph<Point> graph) { // Closed list is only a fraction of the complete graph int initSize = (int) Math.log(graph.getVerticesSizes()); System.out.println(initSize); this.closedList = new HashSet<Node<Point>>(initSize); // Open list can be very big // Min-Heap based on the F values initSize = Core.currentGame.getHeight() * 2; this.openList = new PriorityQueue<>(initSize, (n1, n2) -> { return (int) (n1.getF() - n2.getF()); }); Node<Point> current = start; // ADD IT TO OPEN LIST openList.add(current); while (!openList.isEmpty()) { // REMOVE FIRST NODE // O(1) current = openList.poll(); // ADD TO CLOSED LIST // O(1) closedList.add(current); // TEMP SAVE THE LAST ADDED NODE lastNode = current; // GOAL FOUND - STOP ASTAR if (current.equals(goal)) return getPath(); // GET POSSIBLE NEXT NODES List<Node<Point>> neighbors = graph.getNeighbors(current); // CHECK POSSIBILITIES for (Node<Point> neighbor : neighbors) { // NODE IS OUTSIDE THE FIELD if (neighbor == null) continue; // IGNORE NODES WHICH ARE IN CLOSED LIST if (closedList.contains(neighbor)) continue; // O(N) if (openList.contains(neighbor)) { // NEW PATH IS BETTER if (neighbor.getG() < current.getG()) { // REMOVE AND ADD TO OPENLIST TO RESTORE SORT // O(N) openList.remove(neighbor); // UPDATE PREV AND G neighbor.setPreviosNode(current); neighbor.setG(current.getG() + 1); // LOG(N) openList.add(neighbor); } } else { // NODE IS NOT IN OPEN NOR CLOSED LIST - ADD IT neighbor.setPreviosNode(current); // LOG(N) openList.add(neighbor); } } } return null; }
ecb6cb88-a13d-408d-aced-464758cd8241
7
@Override public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (!f.hasTag(SCRIPT_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args); } int id = f.methodId(); switch (id) { case Id_constructor: { String source = (args.length == 0) ? "" : ScriptRuntime.toString(args[0]); Script script = compile(cx, source); NativeScript nscript = new NativeScript(script); ScriptRuntime.setObjectProtoAndParent(nscript, scope); return nscript; } case Id_toString: { NativeScript real = realThis(thisObj, f); Script realScript = real.script; if (realScript == null) { return ""; } return cx.decompileScript(realScript, 0); } case Id_exec: { throw Context.reportRuntimeError1( "msg.cant.call.indirect", "exec"); } case Id_compile: { NativeScript real = realThis(thisObj, f); String source = ScriptRuntime.toString(args, 0); real.script = compile(cx, source); return real; } } throw new IllegalArgumentException(String.valueOf(id)); }
56752188-a838-4eca-b299-7acd26bbb554
1
public Set<Point3> getAlivePositions() { Set<Point3> points = new HashSet<Point3>(); synchronized (beings) { for (Being b : beings) { points.add(new Point3(b.getPosition())); } } return points; }
99ca353c-caf5-43e2-8875-2c80132efaf4
1
private Message errorMessage(Stat stat) { Message msg = new Message(); String subject = stat.getName() + ": validation failed"; if (stat.getStateDescription() != null) subject += " (" + stat.getStateDescription() + ")"; msg.subject(subject); addNameValue(stat, msg); msg.add("Validation failed: ").add(stat.getStateDescription()); return msg; }
2506d651-19f2-4e95-8c82-4ff4d8de68fa
1
public Set getDeclarables() { Set used = new SimpleSet(); if (instr != null) instr.fillDeclarables(used); return used; }
f8a8efdc-7121-4bb8-a55e-4824fa1d26a9
5
private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_exitMenuItemActionPerformed {//GEN-HEADEREND:event_exitMenuItemActionPerformed if(hasChanges) { int dialogResult = JOptionPane.showConfirmDialog(this, "You have unsaved changes, would you like to save these first?", "Question", JOptionPane.YES_NO_CANCEL_OPTION); switch(dialogResult) { case 0: if(hasSavedToFile) saveFile(curFile); else saveAs(); System.exit(0); break; case 1: System.exit(0); break; case 2: //cancel break; } } else { System.exit(0); } }//GEN-LAST:event_exitMenuItemActionPerformed
494e321f-fa39-4748-991b-703ac41048b7
8
@Override public void update(GameContainer gc, int delta, Level level) { Input input = gc.getInput(); if (input.isKeyDown(Input.KEY_LEFT) || input.isKeyDown(Input.KEY_A)) { velocity.x -= runSpeed; } else if (input.isKeyDown(Input.KEY_RIGHT) || input.isKeyDown(Input.KEY_D)) { velocity.x += runSpeed; } if (input.isKeyDown(Input.KEY_UP) || input.isKeyDown(Input.KEY_W)) { jump = true; } if (input.isKeyDown(Input.KEY_Z)) { SideScroller.getWorld().setCurrentLevel(0); } else if (input.isKeyDown(Input.KEY_X)) { SideScroller.getWorld().setCurrentLevel(1); } move(level); }
61c8c6d7-1e38-42e4-b2ad-9b9d93f5007c
9
public void create(Qualificador qualificador) { if (qualificador.getQualificadorAplicacaoCollection() == null) { qualificador.setQualificadorAplicacaoCollection(new ArrayList<QualificadorAplicacao>()); } if (qualificador.getQualificadorProdutoCollection() == null) { qualificador.setQualificadorProdutoCollection(new ArrayList<QualificadorProduto>()); } EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); Collection<QualificadorAplicacao> attachedQualificadorAplicacaoCollection = new ArrayList<QualificadorAplicacao>(); for (QualificadorAplicacao qualificadorAplicacaoCollectionQualificadorAplicacaoToAttach : qualificador.getQualificadorAplicacaoCollection()) { qualificadorAplicacaoCollectionQualificadorAplicacaoToAttach = em.getReference(qualificadorAplicacaoCollectionQualificadorAplicacaoToAttach.getClass(), qualificadorAplicacaoCollectionQualificadorAplicacaoToAttach.getCodigoQualificadorAplicacao()); attachedQualificadorAplicacaoCollection.add(qualificadorAplicacaoCollectionQualificadorAplicacaoToAttach); } qualificador.setQualificadorAplicacaoCollection(attachedQualificadorAplicacaoCollection); Collection<QualificadorProduto> attachedQualificadorProdutoCollection = new ArrayList<QualificadorProduto>(); for (QualificadorProduto qualificadorProdutoCollectionQualificadorProdutoToAttach : qualificador.getQualificadorProdutoCollection()) { qualificadorProdutoCollectionQualificadorProdutoToAttach = em.getReference(qualificadorProdutoCollectionQualificadorProdutoToAttach.getClass(), qualificadorProdutoCollectionQualificadorProdutoToAttach.getCodigoQualificadorProduto()); attachedQualificadorProdutoCollection.add(qualificadorProdutoCollectionQualificadorProdutoToAttach); } qualificador.setQualificadorProdutoCollection(attachedQualificadorProdutoCollection); em.persist(qualificador); for (QualificadorAplicacao qualificadorAplicacaoCollectionQualificadorAplicacao : qualificador.getQualificadorAplicacaoCollection()) { Qualificador oldCodigoQualificadorOfQualificadorAplicacaoCollectionQualificadorAplicacao = qualificadorAplicacaoCollectionQualificadorAplicacao.getCodigoQualificador(); qualificadorAplicacaoCollectionQualificadorAplicacao.setCodigoQualificador(qualificador); qualificadorAplicacaoCollectionQualificadorAplicacao = em.merge(qualificadorAplicacaoCollectionQualificadorAplicacao); if (oldCodigoQualificadorOfQualificadorAplicacaoCollectionQualificadorAplicacao != null) { oldCodigoQualificadorOfQualificadorAplicacaoCollectionQualificadorAplicacao.getQualificadorAplicacaoCollection().remove(qualificadorAplicacaoCollectionQualificadorAplicacao); oldCodigoQualificadorOfQualificadorAplicacaoCollectionQualificadorAplicacao = em.merge(oldCodigoQualificadorOfQualificadorAplicacaoCollectionQualificadorAplicacao); } } for (QualificadorProduto qualificadorProdutoCollectionQualificadorProduto : qualificador.getQualificadorProdutoCollection()) { Qualificador oldCodigoQualificadorOfQualificadorProdutoCollectionQualificadorProduto = qualificadorProdutoCollectionQualificadorProduto.getCodigoQualificador(); qualificadorProdutoCollectionQualificadorProduto.setCodigoQualificador(qualificador); qualificadorProdutoCollectionQualificadorProduto = em.merge(qualificadorProdutoCollectionQualificadorProduto); if (oldCodigoQualificadorOfQualificadorProdutoCollectionQualificadorProduto != null) { oldCodigoQualificadorOfQualificadorProdutoCollectionQualificadorProduto.getQualificadorProdutoCollection().remove(qualificadorProdutoCollectionQualificadorProduto); oldCodigoQualificadorOfQualificadorProdutoCollectionQualificadorProduto = em.merge(oldCodigoQualificadorOfQualificadorProdutoCollectionQualificadorProduto); } } em.getTransaction().commit(); } finally { if (em != null) { em.close(); } } }
f7413df5-bb13-400b-97a8-9e22879d8278
9
static final synchronized AbstractToolkit createToolkit (int i, int i_168_, int i_169_, IndexLoader loader, int i_170_, d var_d, Canvas canvas, int i_171_) { try { anInt4576++; if (i_170_ == i_171_) return Class348_Sub5.createSoftwareToolkit(true, i_168_, i_169_, canvas, var_d); if (i_171_ == 2) return Class306.createSafeToolkit(-6, i_168_, var_d, canvas, i_169_); if (i_171_ == 1) return Deque.createDirect3dToolkit(3, i, canvas, var_d); if (i_171_ == 5) return Class93.createOpenglToolkit(canvas, var_d, loader, 25542, i); if (i_171_ == 3) return Class96.createDirectxToolkit(i, i_170_ ^ 0x4a31, var_d, loader, canvas); throw new IllegalArgumentException("UM"); } catch (RuntimeException runtimeexception) { throw Class348_Sub17.method2929 (runtimeexception, ("ha.TJ(" + i + ',' + i_168_ + ',' + i_169_ + ',' + (loader != null ? "{...}" : "null") + ',' + i_170_ + ',' + (var_d != null ? "{...}" : "null") + ',' + (canvas != null ? "{...}" : "null") + ',' + i_171_ + ')')); } }
48ba5184-e2c4-40ea-ac0b-322f2e332850
8
public void body() { // Process events Object obj = null; while ( Sim_system.running() ) { Sim_event ev = new Sim_event(); super.sim_get_next(ev); // get the next event in the queue obj = ev.get_data(); // get the incoming data /**** NOTE: debugging System.out.println(super.get_name() + ".body(): ev.get_tag() is " + ev.get_tag()); System.out.println(super.get_name() + ".body(): ev.get_src() is " + ev.get_src()); *****/ // if the simulation finishes then exit the loop if (ev.get_tag() == GridSimTags.END_OF_SIMULATION) { break; // Check forecast of active flow and pass it onto Entity if still active } else if(ev.get_tag() == GridSimTags.FLOW_HOLD) { //System.out.println(super.get_name() + ".body(): checkForecast() + at time = " + GridSim.clock()); checkForecast(ev); // Update flow duration forecast as a flow's bottleneck bandwidth has changed } else if (ev.get_tag() == GridSimTags.FLOW_UPDATE) { //System.out.println(super.get_name() + ".body(): updateForecast() + at time = " + GridSim.clock()); updateForecast(ev); } // if this entity is not connected in a network topology if (obj != null && obj instanceof IO_data) { //System.out.println(super.get_name() + ".body(): getDataFromEvent() + at time = " + GridSim.clock()); getDataFromEvent(ev); // if this entity belongs to a network topology } else if (obj != null && link_ != null) { //System.out.println(super.get_name() + ".body(): getDataFromLink() + at time = " + GridSim.clock()); getDataFromLink(ev); } ev = null; // reset to null for gc to collect } //System.out.println(super.get_name() + ":%%%% Exiting body() at time " + // GridSim.clock() ); }
6549bc70-e41b-4d85-bfe5-d71b3b08f061
3
@Override public void deserialize(Buffer buf) { super.deserialize(buf); level = buf.readUByte(); if (level < 1 || level > 200) throw new RuntimeException("Forbidden value on level = " + level + ", it doesn't respect the following condition : level < 1 || level > 200"); int limit = buf.readUShort(); additional = new FightResultAdditionalData[limit]; for (int i = 0; i < limit; i++) { additional[i] = ProtocolTypeManager.getInstance().build(buf.readShort()); additional[i].deserialize(buf); } }
15248251-a941-401a-ae10-30937f539e4c
8
public final Variable addend() throws RecognitionException, TokenStreamException { Variable result = new Variable("","","");; Variable e1, e2; try { // for error handling e1=factor(); result = e1; { _loop313: do { switch ( LA(1)) { case OP_PRODUCTO: { { match(OP_PRODUCTO); e2=factor(); if(e2.getTipo().equals("number") && result.getTipo().equals("number")) { result = new Variable("","number",String.valueOf(Float.parseFloat(result.getValor()) * Float.parseFloat(e2.getValor()))); } } break; } case OP_DIVISION: { { match(OP_DIVISION); e2=factor(); if(e2.getTipo().equals("number") && result.getTipo().equals("number")) { result = new Variable("","number",String.valueOf(Float.parseFloat(result.getValor()) / Float.parseFloat(e2.getValor()))); } } break; } default: { break _loop313; } } } while (true); } } catch (RecognitionException re) { mostrarExcepcion(re); } return result; }
ab370264-7bfd-4953-9a8c-bf3e3ac1d505
4
@Override public void setBoolean(long i, boolean value) { if (ptr != 0) { Utilities.UNSAFE.putLong(ptr + sizeof * i, value == true ? 1 : 0); } else { if (isConstant()) { throw new IllegalAccessError("Constant arrays cannot be modified."); } data[(int) i] = value == true ? 1 : 0; } }
c1bfd0e2-7189-445b-b113-e3d07091e337
2
private static PixImage randomImage(int i, int j) { /** * Visit each cell (in a roundabout order); randomly pick a color. */ PixImage image = new PixImage(i, j); Random random = new Random(0); // Create a "Random" object with seed 0 int x = 0; int y = 0; for (int xx = 0; xx < i; xx++) { x = (x + 78887) % i; // This will visit every x-coordinate once for (int yy = 0; yy < j; yy++) { y = (y + 78887) % j; // This will visit every y-coordinate once image.setPixel(x, y, (short) random.nextInt(256), (short) random.nextInt(256), (short) random.nextInt(256)); } } return image; }
2de3ed66-4087-4e57-ac61-db535eb3961d
6
public ServerFinder(JFrame parent) { super(parent, I18n.getInstance().getString("sfTitle")); setLayout(new BorderLayout()); table = new JTable(); table.setCellSelectionEnabled(false); table.setColumnSelectionAllowed(false); table.setRowSelectionAllowed(true); table.setModel(new ServerTableModel(new Vector<ServerEntry>())); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getFirstIndex() > -1) connectBtn.setEnabled(true); else connectBtn.setEnabled(false); } }); this.setModalityType(ModalityType.APPLICATION_MODAL); this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); JScrollPane scrollPane = new JScrollPane(table); scrollPane.setPreferredSize(new Dimension(320, 240)); getContentPane().add(scrollPane, BorderLayout.NORTH); JPanel loginPane = new JPanel(); loginPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 5)); loginPane.setLayout(new GridLayout(2, 2)); loginPane.add(new JLabel("Username")); userName = new JTextField(); loginPane.add(userName); loginPane.add(new JLabel("Password")); password = new JPasswordField(); loginPane.add(password); getContentPane().add(loginPane, BorderLayout.CENTER); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 5)); refreshBtn = new JButton(I18n.getInstance().getString("refresh")); refreshBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { connectBtn.setEnabled(false); refreshBtn.setEnabled(false); table.clearSelection(); updateEntries(); refreshBtn.setEnabled(true); } }); buttonPane.add(refreshBtn); buttonPane.add(Box.createHorizontalGlue()); connectBtn = new JButton(I18n.getInstance().getString("connect")); connectBtn.setEnabled(false); connectBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int index = table.getSelectedRow(); if (index > -1) { ServerEntry entry = ((ServerTableModel) table.getModel()).getEntry(index); System.out.println(entry); String host = entry.getRemoteAddress(); String sport = entry.getPort(); String user = userName.getText(); String pass = String.valueOf(password.getPassword()); int port = 0; try { port = Integer.valueOf(sport); } catch (NumberFormatException ne) { port = 12345; } if (user.equals("") || pass.equals("")) { JOptionPane.showMessageDialog(ServerFinder.this, I18n.getInstance() .getString("inputFail")); return; } try { Client.getInstance().connect(host, port, user, pass); } catch (Exception ee) { JOptionPane.showMessageDialog(ServerFinder.this, I18n.getInstance() .getString("connectFail")); return; } dispose(); } } }); buttonPane.add(connectBtn); buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); JButton cancelBtn = new JButton(I18n.getInstance().getString("cancel")); cancelBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { ServerFinder.this.dispose(); } }); buttonPane.add(cancelBtn); getContentPane().add(buttonPane, BorderLayout.SOUTH); this.pack(); this.setResizable(false); this.setAlwaysOnTop(true); this.setLocationRelativeTo(this.getParent()); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { updateEntries(); } }); this.setVisible(true); }
623d12f8-78b0-44da-a109-7d8182630e1c
7
public void run() { try { while(!finished && !socket.isClosed()) { Packet packet = Packet.unpack(in); if(packet == null) { // The other side closed the connection break; } //System.out.println("Received packet: " + packet); if((packet.getFlags() & Packet.FIN) != 0) { gotFIN = true; return; } // store it storePacket(packet); } }catch(IOException e) { System.err.println("Encountered IOException when trying to receive packet."); //e.printStackTrace(); } try { socket.close(); } catch (IOException e) { } synchronized (parent) { if (parent != null) { parent.IOFinish(); } } }
0c36e268-a6e9-4196-91db-7781d22162b2
2
public static pgrid.service.corba.repair.IssueState from_int (int value) { if (value >= 0 && value < __size) return __array[value]; else throw new org.omg.CORBA.BAD_PARAM (); }
c46421be-69e1-4a51-9905-e2aaee1b8b55
3
public void setAuthorities(String roles) { this.authorities = new HashSet<GrantedAuthority>(); for (final String role : roles.split(",")) { if (role != null && !"".equals(role.trim())) { GrantedAuthority grandAuthority = new GrantedAuthority() { public String getAuthority() { return role.trim(); } }; this.authorities.add(grandAuthority); } } }
7f752f7a-595a-4c46-95f0-0cc56d16756a
2
public void updateViews() { for (IUpdateView iv : viewList) { if (iv != null) { iv.updateView(); } } }
1dcdc2a5-6aac-4473-b8da-1801c1e6ffeb
8
public static void main(String argv[]) throws Exception { PORT = Integer.parseInt(argv[0]); FILENAME = argv[1]; SERVER_SOCKET = new DatagramSocket(PORT); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int expected_number = 0; boolean eof = false; do { byte[] packet_buffer = new byte[1024]; try { DatagramPacket packet = new DatagramPacket(packet_buffer, packet_buffer.length); SERVER_SOCKET.receive(packet); int packet_number = Utilities.getPacketNum(packet_buffer); InetAddress src_ip = packet.getAddress(); int src_port = packet.getPort(); // Clean up end-of-file packet and set eof flag if (Utilities.isEOF(packet_buffer)) { packet_buffer = Utilities.cleanUpEOF(packet_buffer); eof = true; } if (packet_number == expected_number) { baos.write(Utilities.getData(packet_buffer)); SERVER_SOCKET.send(Utilities.createAckPacket(packet_number, src_ip, src_port)); // Make sure last packet is received if (eof == true){ for(int x = 0; x < 20; x++){ SERVER_SOCKET.send(Utilities.createAckPacket(packet_number,src_ip, src_port)); } } expected_number++; } else if (packet_number < expected_number) { // Re-send acknowledgment for previously accepted packet SERVER_SOCKET.send(Utilities.createAckPacket(packet_number, src_ip, src_port)); eof = false; } else { // Re-send acknowledgment for previous expected packet SERVER_SOCKET.send(Utilities.createAckPacket(expected_number - 1, src_ip, src_port)); eof = false; } } catch (Exception e) { } } while (eof == false); FileOutputStream writeToFile = new FileOutputStream(FILENAME); System.out.println("WRITING TO FILE!"); writeToFile.write(baos.toByteArray()); byte[] packet_buffer = new byte[1024]; do { DatagramPacket packet = new DatagramPacket(packet_buffer, packet_buffer.length); SERVER_SOCKET.receive(packet); int packet_number = Utilities.getPacketNum(packet_buffer); InetAddress src_ip = packet.getAddress(); int src_port = packet.getPort(); SERVER_SOCKET.send(Utilities.createAckPacket(packet_number, src_ip, src_port)); } while (true); }
58fbfb86-713e-4870-bcd0-7057aea740f4
0
private NetworkingPreference(ProxyInfo proxy) { System.setProperty("http.proxyHost", proxy.getHost()); System.setProperty("http.proxyPort", proxy.getPort()); }
6a6ab160-730f-41c0-8828-4bf8303ae383
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); TEXT = atts.getValue(A_TEXT); setEnabled(false); addActionListener(this); Outliner.documents.addUndoQueueListener(this); Outliner.documents.addDocumentRepositoryListener(this); }
e611195e-7919-418c-80ab-5cc3e5b29da5
5
public void jsFunction_waitCraft(String wnd, int timeout) { deprecated(); int cur = 0; while (true) { if (cur > timeout) break; if (UI.instance.make_window != null) if ((UI.instance.make_window.is_ready) && (UI.instance.make_window.craft_name.equals(wnd))) return; Sleep(25); cur += 25; } }
3f1b5e15-c405-4379-b5f6-9cf1c238c3af
1
public Value naryOperation(final AbstractInsnNode insn, final List values) throws AnalyzerException { if (insn.getOpcode() == MULTIANEWARRAY) { return newValue(Type.getType(((MultiANewArrayInsnNode) insn).desc)); } else { return newValue(Type.getReturnType(((MethodInsnNode) insn).desc)); } }
a6cd1377-e5b3-4a1f-ac49-01ad2494c9d6
2
public void addCards(PlayingCard... nCards) { int nL=this.cards.length+nCards.length; PlayingCard[] newCards=new PlayingCard[nL]; for (int i=0;i<this.cards.length;i++) { newCards[i]=cards[i]; } for (int i=0;i<nCards.length;i++) { newCards[i+this.cards.length]=nCards[i]; } this.cards=newCards; }
4bbef4af-3610-490d-bc4a-3081636e67be
8
Object[] allocateArray(Object data[], int num) { Object newData[] = null; if (data instanceof javax.vecmath.Point3f[]) { newData = new Point3f[num]; } else if (data instanceof javax.vecmath.Vector3f[]) { newData = new Vector3f[num]; } else if (data instanceof javax.vecmath.Color3f[]) { newData = new Color3f[num]; } else if (data instanceof javax.vecmath.Color4f[]) { newData = new Color4f[num]; } else if (data instanceof javax.vecmath.TexCoord2f[]) { newData = new TexCoord2f[num]; } else if (data instanceof javax.vecmath.TexCoord3f[]) { newData = new TexCoord3f[num]; } else if (data instanceof javax.vecmath.TexCoord4f[]) { newData = new TexCoord4f[num]; } else if (data instanceof IndexRow[]) { // Hack so we can use compactData for coordIndexOnly newData = new IndexRow[num]; } else throw new IllegalArgumentException( J3dUtilsI18N.getString("GeometryInfo9")); return newData; } // End of allocateArray
fb4ad2af-be4f-4226-af9a-1e011136bff0
1
@Override public void closeChannel() throws IOException{ this.input.close(); this.output.close(); if(tcpchannelsocket != null) tcpchannelsocket.close(); }
4ddd0995-d790-4775-b9f6-f698e2da7c93
9
public static Stella_Object wrapKifWithForall(Stella_Object tree, Cons declaredvariables) { if (Stella_Object.safePrimaryType(tree) == Logic.SGT_STELLA_CONS) { { Cons tree000 = ((Cons)(tree)); if (Stella_Object.symbolP(tree000.value)) { { GeneralizedSymbol testValue000 = ((GeneralizedSymbol)(tree000.value)); if (testValue000 == Logic.SYM_STELLA_AND) { { Cons sentences = Stella.NIL; { Stella_Object conjunct = null; Cons iter000 = tree000.rest; Cons collect000 = null; for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) { conjunct = iter000.value; if (collect000 == null) { { collect000 = Cons.cons(Logic.wrapKifWithForall(conjunct, declaredvariables), Stella.NIL); if (sentences == Stella.NIL) { sentences = collect000; } else { Cons.addConsToEndOfConsList(sentences, collect000); } } } else { { collect000.rest = Cons.cons(Logic.wrapKifWithForall(conjunct, declaredvariables), Stella.NIL); collect000 = collect000.rest; } } } } return (Cons.cons(Logic.SYM_STELLA_AND, sentences.concatenate(Stella.NIL, Stella.NIL))); } } else if (testValue000 == Logic.SYM_LOGIC_leg) { return (Logic.wrapKifWithForall(Logic.kifBiconditionalToTwoImplies(tree000), declaredvariables)); } else { } } } } } else { } { List undeclaredvariables = List.newList(); Logic.collectUndeclaredVariables(tree, declaredvariables, undeclaredvariables); switch (undeclaredvariables.length()) { case 0: undeclaredvariables.free(); return (tree); case 1: return (Cons.list$(Cons.cons(Logic.SYM_STELLA_FORALL, Cons.cons(undeclaredvariables.first(), Cons.cons(Cons.cons(tree, Stella.NIL), Stella.NIL))))); default: return (Cons.list$(Cons.cons(Logic.SYM_STELLA_FORALL, Cons.cons(Stella_Object.copyConsTree(undeclaredvariables.theConsList), Cons.cons(Cons.cons(tree, Stella.NIL), Stella.NIL))))); } } }
6ff8e782-7f84-42ef-8532-24b04ac81c1f
5
@Override public void changeUserPassword(String username, String oldPassword, String newPassword) throws UserLockedOutException { // throws UserLockedOutException if this isn't allowed lockoutService.allowAttempt(username); for(LdapServer ldapServer : ldapServers) { try { if(ldapServer.verifyPassword(username, oldPassword)) { ldapServer.setPassword(username, newPassword); logger.debug("Successfully changed password for " + username + " at " + ldapServer.getDescription()); lockoutService.clearIncorrectAttempts(username); return; } } catch(AuthenticationException ex) { logger.debug("Didn't find " + username + " in " + ldapServer.getDescription()); // ignore... we'll try another server } catch(NameNotFoundException ex) { logger.debug("Didn't find " + username + " in " + ldapServer.getDescription()); // ignore... we'll try another server } catch(ObjectRetrievalException ex) { logger.debug("Multiple results found for " + username); // ignore it... try the next server } } lockoutService.registerIncorrectAttempt(username); logger.debug("Couldn't find server for " + username + " or bad password."); throw new NameNotFoundException("Couldn't find username " + username + " in any of provided servers or bad password."); }
e50289cb-24e7-46d6-89a5-ce4b43455f83
1
private boolean jj_2_76(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_76(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(75, xla); } }
b42b5007-8784-4e56-9e8f-e01a09109184
4
@Override public void process(JCas aJCas) throws AnalysisEngineProcessException { String inputDocument = aJCas.getDocumentText(); Matcher questionMatcher = questionPattern.matcher(inputDocument); // Find all question patterns, and create Question annotations while (questionMatcher.find()) { Question newQuestion = new Question(aJCas); newQuestion.setBegin(questionMatcher.start(1)); newQuestion.setEnd(questionMatcher.end(1)); newQuestion.setCasProcessorId(PROCESSOR_ID); newQuestion.setConfidence(1D); newQuestion.addToIndexes(); } Matcher answerMatcher = answerPattern.matcher(inputDocument); // Find all answer patterns, and create Answer annotations while (answerMatcher.find()) { Answer newAnswer = new Answer(aJCas); newAnswer.setBegin(answerMatcher.start(2)); newAnswer.setEnd(answerMatcher.end(2)); newAnswer.setCasProcessorId(PROCESSOR_ID); newAnswer.setConfidence(1D); if (answerMatcher.group(1).equals("1")) { newAnswer.setIsCorrect(true); } else if (answerMatcher.group(1).equals("0")) { newAnswer.setIsCorrect(false); } newAnswer.addToIndexes(); } }
8a3066dd-bdae-4b4a-a050-9906f38acee4
0
public ArrayReverseIterator(T[] source) { this._source = source; this._position = this._source.length - 1; }
f688f717-3f5e-4661-8c30-58275773a550
3
public void setFullScreen( DisplayMode dm ){ this.setUndecorated(true); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.pack(); this.setSize(1920, 1080); this.setResizable(false); this.setVisible(true); vc.setFullScreenWindow(this); if( dm != null && vc.isFullScreenSupported() ){ try{ vc.setDisplayMode(dm); }catch(Exception ex){ex.printStackTrace();} } }
e30b13ba-a304-48a6-b253-4888185126a8
6
@Override protected boolean canDeleteChild(int index, Construct child, boolean isUser) { if(mState == null || mState.mPlaceholders == null) { return super.canDeleteChild(index, child, isUser); } Placeholder descriptor = getPlaceholderForConstruct(child); if(descriptor == null || descriptor.isPermanent()) { Application.showErrorMessage("Cannot delete this construct"); return false; } if(isUser == true && child.getClass().equals(PlaceholderConstruct.class)) { Application.showErrorMessage("Cannot delete this construct"); return false; } return true; }
3ffafb32-f342-4cb9-89a4-d8aa9107d1a0
1
private void readLines(final BufferedReader reader, final MyObjects myObjects) throws IOException { String line; while ((line = reader.readLine()) != null) { myObjects.addLine(line); } }
5b52bf50-4658-4b42-b4ba-5669595412c3
0
public List<Partner> findAllPartnersByHallEventId(final Long hallEventId) { return new ArrayList<Partner>(); }
23d50658-7bf7-4bba-ab7d-d1984ebfe35b
8
private void dispatch(UpdateRequest ur) { if (ur instanceof PrintRequest) { print((PrintRequest) ur); } else if (ur instanceof RemoveRequest) { remove(((RemoveRequest) ur)); } else if (ur instanceof HighlightRequest) { HighlightRequest hr = (HighlightRequest) ur; highlightBlob(hr.getBlob(), hr.isBool()); } else if (ur instanceof ContractRequest) { ContractRequest cr = (ContractRequest) ur; contract(cr.getBlob()); } else if (ur instanceof ExpandRequest) { ExpandRequest er = (ExpandRequest) ur; expand(er.getBlob()); } else if (ur instanceof MoveCaretRequest) { moveCaret(((MoveCaretRequest) ur).getWhere()); } else if (ur instanceof AddRequest) { add((AddRequest) ur); } else if (ur instanceof MoveRequest) { move((MoveRequest) ur); } }
06b0fc62-0c0b-4081-8bf7-a8ce3596015a
7
public FightThread() { int mapTime = HyperPVP.getTime(); int left = HyperPVP.getMinutesLeft(); int third = mapTime / 3; int one = mapTime; int two = mapTime - third; int three = mapTime - third - third; ChatColor status = ChatColor.GREEN; if (left <= one && left > two) { status = ChatColor.GREEN; } else if (left <= two && left > three) { status = ChatColor.GOLD; } else if (left <= three) { status = ChatColor.RED; } String motd = status + HyperPVP.getMap().getMapName(); try { CraftServer craftServer = (CraftServer) Bukkit.getServer(); MinecraftServer server = craftServer.getServer(); server.setMotd(motd); } catch (Exception e1) { e1.printStackTrace(); } HyperPVP.setMinutesLeft(HyperPVP.getMap().getTime()); HyperPVP.setTimeString(HyperPVP.getTime() + ":00"); HyperPVP.setCycling(false); HyperPVP.setWinningTeam(null); Bukkit.broadcastMessage(ChatColor.DARK_PURPLE + "Now playing " + ChatColor.GOLD + HyperPVP.getMap().getMapName() + ChatColor.DARK_PURPLE + " by " + ChatColor.RED + HyperPVP.getMap().getAuthor().replace(", ", ChatColor.DARK_PURPLE + ", " + ChatColor.RED)); HyperPVP.getMap().getWorld().setTime(0); HyperPVP.getMap().getWorld().setStorm(false); HyperPVP.getMap().getWorld().setThundering(false); HyperPVP.getMap().getWorld().setWeatherDuration(999999); try { PreparedStatement statement = HyperPVP.getStorage().queryParams("UPDATE servers SET current_type = ?, current_name = ?, status = ?, mins_left = ?, map_status = ? WHERE bungee_name = ?"); { statement.setString(1, HyperPVP.getMap().getType().getType()); statement.setString(2, HyperPVP.getMap().getMapName()); statement.setInt(3, 3); statement.setInt(4, HyperPVP.getMinutesLeft()); statement.setString(5, "STARTING"); statement.setString(6, HyperPVP.getConfiguration().getConfig().getString("Server").toLowerCase()); statement.execute(); } } catch (Exception e) { e.printStackTrace(); } }
442814fd-cd43-4a2f-ae52-9b6f2f7560cf
5
public static String getName(Object instance) { Class<? extends Object> type = instance.getClass(); if (type.isArray() || Collection.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type)) { return "Array"; } else { if (packages.contains(type.getPackage().getName())) { return type.getSimpleName(); } else { return type.getName(); } } }
2368f2a1-82d8-43e9-9f09-fa2c06633e75
0
public String getKodPocztowy() { return kodPocztowy; }
ffca32ad-ea01-4836-b397-c8bbcb084406
8
private void encode(String message) { int index = 0; // initialize dictionary w/ single symbols for(int i = 0; i < message.length(); i++) { if(i + 1 == message.length()) { if(!dictionary.containsKey(message.substring(i))) dictionary.put(message.substring(i), index++); } else { if(!dictionary.containsKey(message.substring(i, i + 1))) dictionary.put(message.substring(i, i+1), index++); } } // search for longest sequence int subcount = 1; for(int j = 0; j < message.length(); j+=subcount) { if(!(j + 1 >= message.length())) { subcount = 1; while(dictionary.containsKey(message.substring(j, j+subcount))) { subcount++; } if((dictionary.size() < size)) dictionary.put(message.substring(j, j+subcount), index++); output.add(dictionary.get(message.substring(j, j+(subcount-1)))); subcount--; } else { output.add(dictionary.get(message.substring(j))); } } printEncodedDictionary(); }
483bd128-6dca-4e2d-8b8c-2c627ce32718
1
public static double stddev(double[] vals) { double mean = mean(vals); double squareSum = 0; for (double v : vals) { squareSum += v * v; } return Math.sqrt(squareSum / vals.length - mean * mean); }
925594ec-b3f6-402c-a0e3-dd82c5e3ff93
1
private int getEhtoY(Pelihahmo h){ if (h==h1){ return ehtoh1y; } else { return ehtoh2y; } }
12f9305f-ef3d-459c-ac72-1c91c7fabc2d
0
public double getX() { return x; }
c439310d-8e5e-400c-9f79-3f3d375cba84
8
public void actionPerformed(ActionEvent e) { if (e.getSource() == b1) count[0]++; else if (e.getSource() == b2) count[1]++; else if (e.getSource() == b3) count[2]++; else if (e.getSource() == b4) count[3]++; else if (e.getSource() == b5) count[4]++; else if (e.getSource() == b6) { String s= JOptionPane.showInputDialog("Enter Password :"); if(s.equals("qwert")) { for (int i = 0; i < 5; i++) // System.out.println("Total votes of candidate " + (i + 1) + "are" + count[i]); JOptionPane.showMessageDialog(null,"Total votes of candidate " + (i + 1) + " are :" + count[i]); } else JOptionPane.showMessageDialog(null,"Incorrect Password"); } }
026af5ea-8d07-4af4-a672-27dfc0b1990d
0
public JButton getjButtonQuitter() { return jButtonQuitter; }
a0415f91-ab77-4634-b5d0-95aa4d02ab5a
0
public void loadAntBrains(AntBrain red, AntBrain black) { redAntBrain = red; blackAntBrain = black; }
4b832a48-3bce-4f1c-bd01-6849532d9eab
3
private boolean isInTrack(int var1, int var2, int var3) { for (int var4 = 0; var4 < this.connectedTracks.size(); ++var4) { ChunkPosition var5 = (ChunkPosition) this.connectedTracks.get(var4); if (var5.x == var1 && var5.z == var3) { return true; } } return false; }
34a10eae-76de-47c2-9636-53123897ee5e
3
public void leerArchivoOrigen() { try { FileInputStream file=new FileInputStream("articulos.txt"); int c; while((c=file.read())!=-1) { dataInput=dataInput+String.valueOf((char)c); } file.close(); } catch(FileNotFoundException e) { System.out.println("Se creara un nuevo registro debido a que el anterior no existe o esta ilegible."); crearArchivoOrigen(); } catch(IOException e) { System.out.println("El archivo es ilegible, se procedera a crear uno nuevo."); crearArchivoOrigen(); } }
f315b9e5-90d0-4b1f-88d3-b64a7efcf76c
8
private void compareFiles() { progress = 0; long start = System.currentTimeMillis(); for (int i=0; i<fileArray.size(); i++) { calculataAndPublishProgress(i, fileArray.size(), "State 4 of 5: Find duplicate files! "); ArrayList<File> duplicateFileArray = new ArrayList<File>(); for (int j=(i+1); j<fileArray.size(); j++) { if ( (fileArray.get(i).getName().equals(fileArray.get(j).getName())) && (fileArray.get(i).length() == fileArray.get(j).length()) && (!isAlreadyAdded(fileArray.get(i))) && (compareContentFile(fileArray.get(i), fileArray.get(j))) ) { if (!notFirst) { duplicateFileArray.add(fileArray.get(i)); duplicateFileArray.add(fileArray.get(j)); fileArray.remove(j); j--; notFirst = true; } else { duplicateFileArray.add(fileArray.get(j)); fileArray.remove(j); j--; } } } notFirst = false; if (duplicateFileArray.size()>0) resultFilesArray.add(duplicateFileArray); } st = 2; publish("Finish search dup files", "2"); System.out.println("2 "+(System.currentTimeMillis() - start)); }
96eac32c-f166-4a6a-8f5a-aa1929420c44
1
private SkinPreviewVO getSelectedListEntry() { SkinPreviewVO ret = null; if (this.previewList.size() > this.selectedIndex) { ret = this.previewList.get(this.selectedIndex); } return ret; }
eef23d31-6dc9-4467-92f4-8d1382d7d3e6
6
@Override public boolean activate() { furnace = SceneEntities.getNearest(Constants.FURNACE_IDS); if (!Players.getLocal().isMoving() && furnace.isOnScreen() && !Bank.isOpen() && Inventory.getCount(Constants.STEEL_BAR_ID) > 0) { if (Inventory.getCount(Constants.IRON_ORE_ID) <= 1 && Inventory.getCount(Constants.COAL_ID) < 2) { return true; } } return false; }
07309035-b389-44cb-b743-680df22b235a
2
public OrgaEinheit getOrgaEinheitZuLeitername(String Leitername) { OrgaEinheit rueckgabe = null; ResultSet resultSet; try { resultSet = db .executeQueryStatement("SELECT * FROM OrgaEinheiten WHERE Leitername = '" + Leitername + "'"); if(resultSet.next()) rueckgabe = new OrgaEinheit(resultSet, db, this); resultSet.close(); } catch (SQLException e) { System.out.println(e); } return rueckgabe; }
73ae4234-fa6c-4bb3-a502-a85f1bf4a155
4
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Cliente other = (Cliente) obj; if (this.idCliente != other.idCliente) { return false; } if (this.ativo != other.ativo) { return false; } return true; }
a4ad25ea-a1cd-450f-ba6c-79afdfc1661d
2
@Override public void show() { // Get list of styles and populate comboBox. styles.removeAllItems(); File[] fileNames = CSS_DIR.listFiles(); for (int i = 0; i < fileNames.length; i++) { File file = fileNames[i]; if (file.isFile()) { styles.addItem(file); } } super.show(); }
35c38e20-4b80-414e-9c8e-cf149213fdcb
5
private Response takeAnswer() throws IOException{ //Implementation to take answer input. Used for storing user responses and storing answer keys. String s = null; @SuppressWarnings("unchecked") ArrayList<String> copy = (ArrayList<String>) right.clone(); //Replacement of responses so responses are not lost HashMap<String, ArrayList<String>> dictAns = new HashMap<String, ArrayList<String>>(); //HashMap to pass to Response for (int i=1; i <= left.size(); i++){ //Assign ranks for every value ArrayList<String> arr = new ArrayList<String>(); //Stores the rankings Out.getDisp().renderLine("Enter the value at rank " + i + ":"); boolean hasFailed = true; //Boolean to keep looping until valid input confirmed while (hasFailed){ //Input loop s = Input.inputString(); for (int j = 0; j < copy.size(); j++){ //Compare to every valid response if (s.equals(copy.get(j))){ //Good input hasFailed = false; //Stop looping copy.remove(j); //Remove the response as an option to avoid duplicates } } if (hasFailed) Out.getDisp().renderLine("Given Answer Not In Given Options. Please enter again."); } //while (hasFailed) arr.add(s); //Pop on the single rank dictAns.put(getLeft().get(i-1), arr); //Add to the Dict } //for (int i=1; i <= val; i++) return new RespDict(dictAns); }
c5a36ce9-b3ab-4b61-bb26-94fbe9947050
7
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof KeyedValueDataset)) { return false; } KeyedValueDataset that = (KeyedValueDataset) obj; if (this.data == null) { if (that.getKey() != null || that.getValue() != null) { return false; } return true; } if (!ObjectUtilities.equal(this.data.getKey(), that.getKey())) { return false; } if (!ObjectUtilities.equal(this.data.getValue(), that.getValue())) { return false; } return true; }
0bba69b3-03de-44f9-b23b-a352685d803f
4
private int getOnlinePlayers() { try { Method onlinePlayerMethod = Server.class.getMethod("getOnlinePlayers"); if (onlinePlayerMethod.getReturnType().equals(Collection.class)) { return ((Collection<?>) onlinePlayerMethod.invoke(Bukkit.getServer())).size(); } else { return ((Player[]) onlinePlayerMethod.invoke(Bukkit.getServer())).length; } } catch (Exception ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } } return 0; }