method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3e959e8d-8b17-4ab7-9c75-3f3274f9bacf
6
public boolean check() { for (InputNode in : this.input) { if (!in.check()) { // System.out.println("Input Node " + in.getName() + " is not valid"); return false; } } for (InnerNode in : this.inner) { if (!in.check()) { // System.out.println("Inner Node " + in.getName() + " is not valid"); ...
34df034e-955d-4bd3-a2e3-0c969e754243
1
protected void onEntryRemove(Object key, ICacheable data){ if(null != mDiskLruCache){ mDiskLruCache.put(key, data); } }
daa9f210-4795-44d4-b93b-2c2ccde13b0e
4
public static final boolean isPrimitiveArray(Object array) { if (array != null) { Class<?> clazz = array.getClass(); if (clazz.isArray()) { String className = array.getClass().getName(); return className.length() == 2 && className.charAt(0) == '['; } } return false; }
febedf7c-19e5-43e8-87b5-0c5035defcb7
5
public static void main(String[] args) { QArrayCount<Integer> q = new QArrayCount<Integer>(); for (int i = 1; i <= 567; i++) q.enqueue(i); for (int i = 1; i <= 89; i++) q.dequeue(); for (int i = 8; i <= 9; i++) q.enqueue(i); for (int i = 1; i <= 43; i++) q.dequeue(); for (Integer i : q) ...
83af6892-793d-48d3-ab0d-064f2ce0b5b2
2
public void setHmac(Key key){ Mac hmac = null; try { hmac = Mac.getInstance("HmacSHA256"); } catch (NoSuchAlgorithmException e) { // TODO vernuenftiges handling e.printStackTrace(); } try { hmac.init(key); } catch (InvalidKeyException e) { // TODO vernuenftiges handling e.printStackTrace()...
f1c704bb-65af-4fe3-839f-946a2c853da4
2
@Override public Move chooseMove(State s) { // return if there are no moves available if (s.findMoves().size() == 0) return null; synchronized (s) { try { s.wait(); } catch (InterruptedException e) {} return Board.getMove(); } }
fbd5c856-4383-4b12-96f7-a7f5d86a4409
5
@Test public void testRandom () { System.err.println ("testRandom"); int numRects = 100000; int numRounds = 10; Random random = new Random (1234); // same random every time for (int round = 0; round < numRounds; round++) { tree = new PRTree<Rectangle2D> (converter, 10); List<Rectangle2D> rects = ne...
cadce98b-28e9-4bdf-acaf-af84e2719514
2
public void replenishmentOrder(String manu, String modNum, int q) { System.out.println("Sending replenishment order..."); Statement s = null; String updateRep = "UPDATE ProductDepot p SET p.replenishment = '" + q + "' WHERE p.manufacturer = '" + manu + "' AND p.model_number = '" + modNum + "'"; try { s =...
d23cc4d8-3feb-4232-b9a7-74e938d1de8c
1
private String getDescription() { String desc = "@MongoBatchInsert(" + this.getParsedShell().getOriginalExpression() + ")"; if (!StringUtils.isEmpty(globalCollectionName)) { desc = ",@MongoCollection(" + globalCollectionName + ")"; } return desc; }
a11bb83b-0842-4842-9961-5c22b0da4f5a
3
@SuppressWarnings("unchecked") @Override public B get(A a) { B b = null; try { b = (B) getMethod.invoke(a, new Object[0]); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTra...
1b5d7eb9-d4d8-4333-9bc3-60db86fa2ce9
2
@Override public int compareTo(CButton o) { final int compareTo = this.getText().compareTo(o.getText()); if (this != o && compareTo == 0) return this.name.compareTo(o.getText()); else return compareTo; }
69a64ecb-0365-4285-be64-ea78e278affb
0
private static void updateSecondProjectView() { getInstance().secondProjectTitleL.setText("Second Project: " + getInstance().secondProject.getProjectName()); getInstance().secondProjectScreensCBL.setListData(getScreenCheckBoxes( getInstance().secondProject, false)); getInstance().secondProj...
ae43a97b-5196-4b4e-bf0e-e83e4aa8fce6
7
private static void printConfiguration (int indent, Configuration c) { String temp; // atypical: should always be able to read configuration if (c == null) { indentLine (indent, "<!-- null configuration -->"); return; } indentLine (indent, "<config value='" + c.getConfigurationValue () +...
12a96d83-d258-422d-aa88-5c179088cf06
2
private int sMax(int sMax) { if (radius <= 100) { return (int) Math.floor(0.65 * sMax); } else if (radius >= 800) { return sMax; } else { double result = 0.18 * Math.log1p(radius) - 0.2; return (int) Math.floor(result*sMax); } }
08d30ab2-273a-4d5e-b37a-fe685ed53aee
8
private static void mergePreferences( CommonPrefResource prefFile, Properties properties, MultiStatus status) { if (prefFile == null && properties == null) return; if (!prefFile.exists) return; InputStream input = null; // Added this code for testing /*try { input = prefFile.getInputStream(...
5cb2a5d0-3325-4631-a5cc-5c1a54102288
6
@Override public ItemStack transferStackInSlot(EntityPlayer player, int slot) { ItemStack stack = null; Slot slotObject = (Slot) inventorySlots.get(slot); // null checks and checks if the item can be stacked (maxStackSize > 1) if (slotObject != null && slotObject.getHasStack()) { ItemStack stackInSlot =...
ae7d0b15-3d61-4b67-b382-538962f2c59a
1
@Override protected boolean doDelete(final String key) { try { return cache.remove(key); } catch (Throwable e) { CacheErrorHandler.handleError(e); return false; } }
0386a2b1-7b32-4d98-bb30-e3dfe2dc932e
8
public List<Integer> analyze() { List<Integer> features = new ArrayList<Integer>(); try { // find min and max values: for (String chr : decompressorISS.getChromosomes()) { boolean lastBaseOverThreshold = true; CompressedCoverageIterator it = decompressorISS .getCoverageIterator(); while (it....
9072549d-e47a-4492-b028-307d7213d2c0
7
private boolean gameInitFromFile(File fin){ DataInputStream file; try{ file = new DataInputStream(new BufferedInputStream(new FileInputStream(fin))); }catch (FileNotFoundException ex){ return false; } try{ asteroids = new ArrayList<Asteroid>(); bullets = new ArrayList<Bullet>(); //write ...
a58cbf0a-6c73-4aab-853b-b5c20bb54565
1
public void createObj(){ for(int i=0; i<1100000;i++){ TestGarbageCollector t = new TestGarbageCollector(); } System.out.println(Runtime.getRuntime().freeMemory()/1024+"MB"); }
0571ac72-b38e-425a-9481-bd4035c5181e
4
public double characterEnergy() { if (P2character.equals("White")) { return whiteKnight.characterEnergy(); } else if (P2character.equals("Bond")) { return jamesBond.characterEnergy(); } else if (P2character.equals("Ninja")) { ...
4f228e9a-d23c-4224-b60c-a1657920e8a6
2
public TreeNode nodeAtPoint(Point2D point, Dimension2D size) { Iterator it = nodeToPoint.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); Point2D p = scalePoint((Point2D) entry.getValue(), size); TreeNode node = (TreeNode) entry.getKey(); if (nodeDrawer.onNode(no...
e7d261b3-f227-4336-9cc7-bc950133ed16
6
public void updateFiles() throws ClassNotFoundException, IOException{ boolean found=false; File dropins = new File("./dropins/plugins/"); File [] names = dropins.listFiles(new PluginFilter(dropins)); if(names.length==0){ return; } Collection<File> pluginstmp = new ArrayList<File>(); for(File p...
10d5a2b6-1389-49de-a942-0d6fd100f718
7
public void damageTile(int x, int y, int damage) { if (x < 0 || x >= width || y < 0 || y >= height) { return; } if (getTile(tiles[x + y * width][0]).isSolid() && getTile(tiles[x + y * width][0]).canBeDamaged()) { tiles[x + y * width][1] += damage; if (getTile(tiles[x + y * width][0]).getMaxDamage() <=...
877e5fdb-243d-4412-bfc3-e47c4c67e6e3
7
public static byte[] unencodedSeptetsToEncodedSeptets(byte[] septetBytes) { byte[] txtBytes; byte[] txtSeptets; int txtBytesLen; BitSet bits; int i, j; txtBytes = septetBytes; txtBytesLen = txtBytes.length; bits = new BitSet(); for (i = 0; i < txtBytesLen; i++) for (j = 0; j < 7; j++) if ((txt...
5a81823c-9b7c-4c79-b74a-31b90706a134
6
@Override public String onFactionCall(L2Npc npc, L2Npc caller, L2PcInstance attacker, boolean isPet) { if (attacker == null) return null; L2Character originalAttackTarget = (isPet ? attacker.getPet() : attacker); if (attacker.isInParty() && attacker.getParty().isInDimensionalRift()) { byte riftType =...
dcbde9be-7238-4c3c-bbcf-918f39b00f65
3
private void click() { if(curPage == 0) { if(options.get(curPage)[curOption].getTitle().equals("Resume")) { game.enterState(Game.IN_GAME_STATE_ID, new FadeOutTransition(), new FadeInTransition()); } else if(options.get(curPage)[curOption].getTitle().equals("Exit to Main M...
b1916827-fe4b-432f-96af-bff542edffc3
7
@Override public String toString() { String[][] board = new String[8][8]; Iterator<Piece> it = this.whitePieces.iterator(); while (it.hasNext()) { Piece next = it.next(); Point p = next.getPosition(); if (next.isKing()) board[p.x][p.y] = "W"; else board[p.x][p.y] = "w"; } // end while ...
2a9d82b0-6c71-4d6a-bfb4-06f41f96ea58
7
public static Object kettleCast(Object value) { if (value == null) { return value; } Class<?> c = value.getClass(); if (c == Integer.class || c == int.class) { return ((Integer) value).longValue(); } if (c == Float.class || c == float.class) { return ((Float) value).doubleValue(); } if (c == Bi...
39c9a514-a043-422c-9efd-1b8031b3166e
9
public double lorentzInnerProduct(Matrix matrix2, boolean isRowVector) { // Can only operate on a "vector" (nx1 matrix) if ((!isRowVector && ((numCols > 1) || (matrix2.numCols > 1))) || (isRowVector && ((numRows > 1) || (matrix2.numRows > 1)))) return Double.NaN; double result = 0.0; for (int i = 0; i...
76431ba3-57df-432d-a352-2ac636f9e65d
7
public List<ZoneResource> listZoneRecords(final Zone zone) { Set<ZoneResource> zoneResources = new HashSet<ZoneResource>(); boolean readMore = true; Map<String, String> query = new HashMap<String, String>(); while (readMore) { String result = pilot.executeResourceRecordSetGet(zone.getExistentZoneId(), ...
934318e0-6061-46de-93d6-15ecacdf3653
3
private void btnAgregarEventoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarEventoActionPerformed //obtenemos lo necesario de la vista: int idCliente = obtenerClaveClienteSeleccionado(); int idEmpleado = obtenerClaveEmpleadoSeleccionado(); int idMesa = obten...
3c9264de-9451-4d15-8705-949267102c92
6
public List<Noeud> genererPlanDepuisXML() throws XmlParserException { File xml = this.fichierATraiter; ArrayList<Noeud> listeDesNoeuds=null; if (xml != null) { try { // creation d'un constructeur de documents a l'aide d'une fabrique ...
bcd2b7f3-d684-463c-a110-5ee195e3c5bb
2
public static long directorySize(File directory) { long length = 0; for (File file : directory.listFiles ()) { if (file.isFile ()) { length += file.length (); } else { length += directorySize (file); } } return length; }
f81e3e8d-54a5-4220-a500-1c353bce42a6
9
public TagParseResult clone() { ByteArrayOutputStream byteOut = null; ObjectOutputStream out = null; ByteArrayInputStream byteIn = null; ObjectInputStream in = null; try { byteOut = new ByteArrayOutputStream(); out = new ObjectOutputStream(byteOut); out.writeObject(this); byteIn = new By...
0ab2535a-37b3-437d-b9aa-589f462b1fc8
8
private void requestFriends(int startIndex) { HttpGet httpget = new HttpGet("http://m.facebook.com/" + user.getUserUIDString() + "?v=friends&startindex=" + startIndex); CloseableHttpResponse response = null; HttpEntity entity = null; String str = null; try { response = httpClient.execute(httpget...
913ea201-3a04-4fd7-9199-0cd70ad065d8
8
protected void onPrivateMessage(String sender, String login, String hostname, String message) { if (sender.equals("geordi") || sender.equals("clang")) { sendMessage(MAINCHAN,message); return; } if (message.startsWith("?") && sender.equals("IsmAvatar")) this.sendRawLineViaQueue(message.substring(1))...
e07cd8f3-9c58-4e8c-a8dd-09e5f0e76ac5
8
public static boolean processTripleMegaPhone(final MapleClient c, final List<String> message, final byte numlines, final boolean ear) { String tag = ""; String legend = ""; final List<String> messages = new LinkedList<String>(); String msg = "-"; for (byte i = 0; i < numlines; i+...
44cef35b-8f4c-4aad-9f03-42397d437890
8
public void draw(Graphics2D g, int rotation) { if (!isFinished()) { setRotationAngle(getRotationAngle() + rotation); double xRotation = getXRotation(); double yRotation = getYRotation(); boolean canDraw = true; boolean leftTurn = false; for (Block block : blockArray) { if (rotation > 0)...
0af277e4-b921-49d1-b66f-5448568b54c7
5
public synchronized boolean updateCrashedPeers(Set<Byte> crashedPeerOrds) { boolean somethingChanged = false; //DEBUG for (byte b : crashedPeerOrds) { System.out.println(String.format("MORTO: %s", b)); } if (crashedPeerOrds.contains(this.getOrd())) { gameTable.forceEndGame("La tua connessione è troppo...
de0faaf8-83ad-465f-8453-c6048392f8a5
5
String readByteXByteSIBmsg() { //configurable buffer size int buffsize= 4 *1024; StringBuilder builder = new StringBuilder(); char[] buffer = new char[buffsize]; String msg = ""; int charRead =0; try { while ((charRead = in.read(buffer, 0, buffer.length)) != (-1)) { builder.append(buffer, ...
a94650e2-f59f-4388-b940-fe8f887080ee
4
double getAttack(Match match, Team team) { int countMatches = 0; int[] goals = new int[deep]; Match currentMatch = getPrevMatch(team, match); for (int i = 0; i < deep && currentMatch != null; i++, currentMatch = getPrevMatch( team, currentMatch), countMatches++) { ...
abf59f65-7554-4191-b169-2fc62df7aee3
5
@Override public String toString() { int i; StringBuilder sb = new StringBuilder(); if (this.getMarks() != null) { try { if (average() != 0) { sb.append(super.toString()); sb.append("\n\tPromotion: " + p.getName()); sb.append("\n\tId: ").append(id).append("\n\tMarks: "); for (i = 0; ...
e8bf845a-5ebf-416b-a3c0-a98088fc22b4
9
public synchronized String kick(String player) { player = player.toLowerCase().trim(); MiniServer bannedPlayer = null; System.out.println("1. " + player); System.out.println("2. " + host.getClientName().toLowerCase().trim()); if(player.equals(host.getClientName().toLowerCase().trim())) { try { host....
00fec439-67fc-445e-909d-67c21445c9b5
6
public boolean almostEquals(Object obj) { if (this == obj) return true; if (getClass() != obj.getClass()) return false; Root other = (Root) obj; if (expr == null) { if (other.expr != null) return false; } else if (!expr.equals(other.expr)) return false; if (nthRoot != other.nthRoot) retur...
98af8376-cb35-46bc-a4fd-ffcabbfa2d15
7
@Override public boolean isReallyNeutral(FactionMember M) { if(M != null) { Faction F=null; Faction.FRange FR=null; for(final Enumeration<String> e=M.factions();e.hasMoreElements();) { F=CMLib.factions().getFaction(e.nextElement()); if(F!=null) { FR=CMLib.factions().getRange(F.faction...
2ae39519-96dc-4fa6-9971-e9b6f1f321d5
0
@Override public String introduceYourself() { return "DecisionQuest"; }
a2b9200c-c429-4422-8934-a14bf30d1714
9
public void newGame() { final int rows = this.mRows; final int cols = this.mCols; if (null == this.mCellsState) { this.mCellsState = new CellState[rows][cols]; } for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { this.mCel...
9d075aef-0644-41d2-9952-c2135e2ac409
9
private static boolean isKingInCheckAfterMoveRec(byte[][] board, byte piece, int hPos, int vPos, int skiphPos, int skipvPos, int tohPos, int tovPos, int hAdd, int vAdd) { hPos += hAdd; vPos += vAdd; if (hPos < 0 || hPos > 7 || vPos < 0 || vPos > 7 || (hPos == tohPos && vPos == tovPos)) { return false; } ...
a0ff5153-254d-4e63-b340-d54f26c80d90
1
public void notifyWorldModelListeners() { for (final WorldModelListener listener : this.listenersWorld) { notifyWorldModelListener(listener); } }
914d80ec-3e9e-46cf-908e-ff02f67a7d69
0
*/ private GrammarTable initGrammarTable() { grammarTable = new GrammarTable(new GrammarTableModel(grammar) { public boolean isCellEditable(int r, int c) { return false; } }); return grammarTable; }
e3aea9b4-df47-4ffb-88a5-1f10a2380ef7
7
@Override public int[] next() { if (started == false) { this.current = new int[size]; for (int i = 0; i < size; i++) this.current[i] = i + 1; this.started = true; return this.current; } int[] new_digits = current.clone(); int n = new_digits.length - 1; int j = n - 1; while...
1d5d6155-516c-4f06-b87c-10aadd8e57cc
3
public void tick() { snake.move(); for (int i = 0; i < food.getFood().size(); i++) { if (snake.getHead().getX() == food.getFood().get(i).getX() && snake.getHead().getY() == food.getFood().get(i).getY()) { food.ateMeat(i); snake.increase...
ca55d74d-ba31-48d4-9fe2-499fbd27b0b0
2
@Override public T validate(String fieldName, T value) throws ValidationException { if (value == null) { return null; } if (max.compareTo(value) <= 0) { throw new ValidationException(fieldName, value, "must be less than " + max); } return value; }
d01c9648-43e4-4687-945b-4e6016dca7e3
3
public static String half2Fullchange(String QJstr) throws Exception { StringBuffer outStrBuf = new StringBuffer(""); String Tstr = ""; byte[] b = null; for (int i = 0; i < QJstr.length(); i++) { Tstr = QJstr.substring(i, i + 1); if (Tstr.equals(" ")) { ...
067ebac6-2d1c-4d4f-8b39-dce4fcccca35
5
public static void engine() { if (World.world[World.PLAYER_POS_X][World.PLAYER_POS_Y] .equals(GlobalParams.paling)) { System.out.println("Забор не помеха? Ну-ну..."); World.PLAYER_POS_X = x; World.PLAYER_POS_Y = y; } if (World.world[World.PLAYER_POS_X][World.PLAYER_POS_Y] .equals(GlobalParams....
a7f51e74-39d4-4e68-a559-40c4cf75bc1d
7
public static void main(String[] args) throws Throwable{ BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) ); StringBuilder sb = new StringBuilder( ); int casos = Integer.parseInt( in.readLine( ) ); in.readLine( ); for (int t = 0; t < casos; t++) { lineas = new ArrayList<String>();...
20ad58b7-0cab-412a-ba97-dbe166c93c58
4
private void smoothOver(Run start, Run end) { Run currentRun = start; while(currentRun != end.getNext()) { if(currentRun.next.getRunLength() == 0) remove(currentRun.getNext()); else if((currentRun.getRunType() == currentRun.getNext().getRunType()) && (currentRun.getHungerVal() == curre...
b18ff383-01ce-4c54-b2c0-adef75c5bb28
3
@Override public void deletePerson(Person person) throws SQLException { Connection dbConnection = null; PreparedStatement preparedStatement = null; String deletePerson = "DELETE FROM person WHERE name = '"+ person.getName() + "' AND surname = '" + person.getSurname()+"'"; try { dbConnection = PSQL.getCon...
5528da3a-131e-411b-8cd3-d4ee8ba04a0c
1
private IdentificadorVariavelVetor completarIdVariavelVetor(Identificador id) throws SemanticError { int limiteSuperior = tipoConstante == Tipo.INTEIRO ? Integer.parseInt(valorConstante) : valorConstante.charAt(0); int tamanho = limiteSuperior - valorLimiteInferior + 1; int deslocamentoVetor = deslocam...
92af27d7-4c6a-40c9-8a30-ee685299de8c
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://down...
2d3be795-2b40-469a-8e53-54d067a98725
4
@Override public void run() { BufferedReader reply = makeRequest(); if(reply == null) // Stop immediately if the request did not generate a response. return; /* Send the request to be interpreted and alert the user * about the response. */ if(parseXml(reply)) { if(mReply == REPLY_SUCCESS) { mUi.d...
feb0b050-daf4-47cf-9119-9a0f0bc99f65
3
public void carregarProfessoresDeArquivo(String nomeArquivo) throws ProfessorJaExisteException, IOException { BufferedReader leitor = null; try { leitor = new BufferedReader(new FileReader(nomeArquivo)); String nomeProf = null; do { nomeProf = leitor.readLine(); // lê a próxima linha do arquivo, ...
317263ba-5497-4863-b347-1b1fd1990271
0
public void update(){ }
f10103ed-6897-4144-be2f-0d05357e8d12
9
public void keyReleased(KeyEvent e) { if(e.getKeyCode()==KeyEvent.VK_UP||e.getKeyCode()==KeyEvent.VK_W){ Up = false; } if(e.getKeyCode()==KeyEvent.VK_DOWN||e.getKeyCode()==KeyEvent.VK_S){ Down = false; } if(e.getKeyCode()==KeyEvent.VK_LEFT||e.getKeyCode()==KeyEvent.VK_A)...
3af5cf99-77db-4bdb-abb0-fafd7596a008
4
@Override public int compareTo(Element<T> o) { if(this.isHead()) return 1; if(this.isTail()) return -1; if(o.isHead()) return -1; if(o.isTail()) return 1; return (this.value).compareTo(o.value); }
2f1ee667-321d-4759-ac04-f6839fcb401d
5
public Building(double x, double y, double width, double height) { if (x == 0 && y == 0 && width == 0 && height == 0) { x = Board.getInstance().getWidth() - 1; y = Board.getRandom(200, 250); width = Board.getRandom(500, 1000); height = 300; } this....
8f51136c-7df7-437a-a0ee-1ff1be663038
7
public void setup() { //CREATE WALKER OBJECT Walker walker = new Walker(BUFFER); // load program properties Config config = new Config("props/superD.properties"); //list of directories to scan List<File> rootDirs = new ArrayList<File>(); //Load in all directories to sca...
f7e6a413-0839-454a-ab18-22c5cd3c7444
0
public ArrayList<DrawableItem> getItems() { return items; }
360495fc-5fa7-458f-b03a-22e9182dc260
6
private void saveSQL(PrintStream out) throws IOException { out.println("<br><br>"); out.println("<h3>Script SQL</h3>"); String name, str, text, textFinal, requete; List<String> keywords = sql.getKeywords(); List<String> types = sql.getTypes(); text = sql.ge...
06fe7388-9473-4dbf-bd6b-75ceec25ce6e
4
private void makeRoom(int numValues) { if (values == null) { values = new float[2 * numValues]; types = new int[2]; numVals = 0; numSeg = 0; return; } int newSize = numVals + numValues; if (newSize > values.length) { int nlen = values.length * 2; if (nlen < newSize) nlen = newSize...
5c89e644-2128-4b43-a01d-1113ca1770d4
3
* @param text messages to be added about the meeting. * @throws IllegalArgumentException if the list of contacts is * empty, or any of the contacts does not exist * @throws NullPointerException if any of the arguments is null */ public void addNewPastMeeting(Set<Contact> contacts, Calendar date, String text) t...
5fe04eaa-6efd-4a7c-b575-85a638b43bd6
3
public static void setSkin(Plugin plugin, final Player p, final String toSkin) { new BukkitRunnable() { @Override public void run() { try { Packet packet = new PacketPlayOutNamedEntitySpawn(((CraftPlayer) p).getHandle()); Field ...
b734b0ad-27d5-4aa6-b6bc-6ab02d4cd975
2
private void setUpLogin() { setUpRegister(); login = new JPanel(); // Controls final JTextField username = new PlaceholderTextField("username"); final JPasswordField password = new PlaceholderPasswordField("password"); JButton submit = new JButton("Login"); JButton register = new JButton("Register"); ...
f57d9e3b-ec67-4d89-a64d-2c586a0b0de6
8
public void wdgmsg(Widget sender, String msg, Object... args) { int ep; if((ep = epoints.indexOf(sender)) != -1) { if(msg == "drop") { wdgmsg("drop", ep); return; } else if(msg == "xfer") { return; } } if((ep = equed.indexOf(sender)) != -1) { if(msg == "take") wdgmsg("take", ep, args[0])...
9d9a4487-4ae1-4bb6-9315-158f0fa31693
0
public boolean doCheck() { return this.check; }
c95988d5-95e0-4557-a1e3-c722d6808dd0
4
public void WGOverridePwd(String sender, Command command) { if(command.arguments.length == 3) { User user; for(Game game : games.values()) { user = getUserByNick(game, command.arguments[1]); if(user != null) { user.setPassword(command.a...
df5d807a-fc62-47b5-8829-720275db447b
6
protected void updateView(String machineFileName, String input, JTableExtender table) { ArrayList machines = this.getEnvironment().myObjects; Object current = null; if(machines != null) current = machines.get(0); else current = this.getEnvironment().getObject(); if(current in...
4c4082c6-4ab2-47dc-bab4-ff84577a52ce
8
public static boolean isValid( RushHourCar car, ArrayList<RushHourCar> cars, int width, int height ) { ArrayList<Point> carBlocks = car.getBlocks(); for( Point carBlock : carBlocks ) { if( carBlock.x >= width || carBlock.x < 0 || carBlock.y >= height || carBlock.y < 0 ) { return false; } for( RushHour...
74523a04-c70d-498c-ad01-4bba7579fbbe
1
public static String reverse1(String s) { String rev = ""; int n = s.length(); for (int i = 0; i < n; i++) rev += s.charAt(n - i - 1); return rev; }
02974e89-4e5b-4d50-8ed7-f88759157b53
8
protected void btnSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarActionPerformed if(JOptionPane.showConfirmDialog(rootPane,"Deseja Salvar os dados?") == 0){ /*if(txtNome.getText().isEmpty()){ JOptionPane.showMessageDialog(rootPane, "O campo nome não...
3c69727f-7411-4bd6-889b-60e35531183b
4
public static Image gaussianNoise(Image original, double avg, double dev, double p) { if (original == null) return null; Image gaussian = original.shallowClone(); for (int x = 0; x < original.getWidth(); x++) { for (int y = 0; y < original.getHeight(); y++) { double rand = Math.random(); double n...
b2d32705-809b-4fd3-af47-37542bcfdb16
0
public void setRatingId(int ratingId) { this.ratingId = ratingId; }
2919d32d-5872-457a-ba3b-c139b7ba958a
4
@Override public boolean handleCommandParametersCommand(String providedCommandLine, PrintStream outputStream, IServerStatusInterface targetServerInterface) { String[] commandParts = GenericUtilities.splitBySpace(providedCommandLine); if(commandParts.length == 2) { List<String> params = targetServerInt...
197542f1-a411-42a4-aaa5-f4bd0e51f0b3
4
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Instructions other = (Instructions) obj; if (!Objects.equals(this.gameInstructions, other.gameInstruction...
a842f4b9-bdd8-40e3-870f-ac3608ba7365
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://down...
96df465f-0a5a-40f4-a8ff-bcd2d95d7bfa
7
protected void onMouseClick(int mouseX, int mouseY, int mouseButton) { if (mouseButton == 0) { // Left-click for (Button button : buttons) { if (button.active && mouseX >= button.x && mouseY >= button.y && mouseX < button.x + button.width && mouseY < button.y ...
acbd0037-ff56-44dd-af23-5d3873145109
8
private void jTableProductosMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableProductosMousePressed // TODO add your handling code here: try { jButton1.setEnabled(true); jButton2.setEnabled(true); Cant = Integer.parseInt(JOptionPane.showInputDialog(...
88333be0-f638-4fc5-91d3-fe662f800423
2
public static InputStream getInputFromJar(String path) throws IOException { if (path == null) { throw new IllegalArgumentException("The path can not be null"); } URL url = plugin.getClass().getClassLoader().getResource(path); if (url == null) { return null; } URLConnection connection = url.openConn...
6282e6be-dc70-4277-84b2-e6b6cf6ebd30
4
public static int fieldNum(String name) { int fieldNum = 0; if (name.equals("NMD.GENE")) return fieldNum; fieldNum++; if (name.equals("NMD.GENEID")) return fieldNum; fieldNum++; if (name.equals("NMD.NUMTR")) return fieldNum; fieldNum++; if (name.equals("NMD.PERC")) return fieldNum; fieldNum++; ...
39e7a993-dc2c-4038-a578-f09e6a868ba1
8
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed if (txtNomUsager.getText().equals("") || txtPrenomUsager.getText().equals("") || txtNomOeuvre.getText().equals("")) { JOptionPane.showMessageDialog(null, "Tous les champs sont requis.", "Err...
9ada07f2-2fe9-4c35-907c-61ef73667843
9
private int requestEngineMove() { int move = Game.NULL_MOVE; int ponder = Game.NULL_MOVE; try { if (client.isPondering()) { client.send("stop"); while (client.isPondering()) client.receive(); } ...
ac12e9ef-289d-4c08-90e6-8bbc0512d810
9
@Override public void task(int tId) { try { int nRow, nCol; int[][] mat; int[] vec; int[] product; File file; BufferedReader reader; PrintWriter printWriter; String line; String[] elements; //read the shared matrix file file = new File("fs/exampl...
8b7bdc3d-25f1-4710-a62b-46678e81f9ce
9
public void createBasis(double[][] A, double[] c, String[] I){ //Identifies how many artificial variables are needed //Finds an identity matrix in A //Indicates in which columns are the necessary columns to form a base B= new double[0][0]; int numArt=0; for (int i = 0; i < A.length; i++) { double[...
1e22bb64-8129-44ad-9fd9-7e08ee2ea79c
3
public static String getSavePath(){ String os = System.getProperty("os.name").toUpperCase(); String path = null; String subFolder = "Operation5a"; if (os.contains("WIN")) path = System.getenv("APPDATA") + "/" + subFolder + "/"; else if (os.contains("MAC")) path = System.getProperty("user.h...
0df52e54-25ba-4b94-b2dd-fa043c4351cc
0
public static void main(String[] args) { new Enter("NetFlow"); }
15a80cac-c039-4c56-961b-a77c9b1223e6
3
public final static Opponent getByName(String name) throws NotFound { Opponent o = new Opponent(); o.setName(name); List<NameValuePair> nvps = new ArrayList<NameValuePair>(); nvps.add(new BasicNameValuePair("playerName", name)); try { JSONObject ob = Utils.getJSON("fights/searchCharacterJson/1", nvps); ...
ff700a8c-e347-467e-9dae-495ba507027c
0
public void setEventDescription(String[] eventDescription) { this.eventDescription = eventDescription; }
fffabda2-d06c-4ddc-8ba8-e77f3599757c
4
private void jButton_passwordOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_passwordOKActionPerformed password = jPasswordField1.getPassword(); StringBuilder str1 = new StringBuilder(); for (int i = 0; i < password.length; i++) { str1.append(password[i]...
f8fe5332-bee9-4d41-a74e-87312352dc9b
9
public ListNode addTwoNumbers(ListNode l1, ListNode l2) { if (l1 == null) { if (l2 == null) return null; return l2; } if (l2 == null) return l1; ListNode out = null; ListNode p1 = l1; ListNode ...