method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4929920b-9a25-4bf1-af54-d526dc0dcd7e
5
@Override protected void paintComponent(Graphics g) { for (int i = 0; i < field.length; i++) { int elementSize = new Integer( CoreConstants.getProperty("game.element.size")); for (int n = 0; n < field[i].length; n++) { if (field[i][n] != null) { field[i][n].setBounds(i * elementSize, n * elemen...
26829097-0a78-4b31-b906-9488a9c57085
8
public void commandLoop() throws IOException { for (Object handler : allHandlers) { if (handler instanceof ShellManageable) { ((ShellManageable)handler).cliEnterLoop(); } } output.output(appName, outputConverter); String com...
82e80840-2b61-42f0-a228-d96abdbc2af6
4
@SuppressWarnings("unchecked") public static void initComptes(){ ArrayList<Player> list = null; try{ if((new File("tmp/listCompte.ser").exists())){ FileInputStream fileIn = new FileInputStream("tmp/listCompte.ser"); ObjectInputStream in = new ObjectInputStream(fileIn); list = (ArrayList<Player...
cd56a9c8-8f23-45f0-90a7-e175912df832
9
public void calculateVisionEntity(Entity e) { int mm = 5; for (int y = e.y() - mm; y < e.y() + mm; y++) { for (int x = e.x() - mm; x < e.x() + mm; x++) { if (x >= 0 && y >= 0 && x < width && y < height) { if (data[y][x] != null) { i...
a144654c-5829-44f5-b0ef-a830fef96f46
1
public void Connect() { try { this.dbConnection = DriverManager.getConnection(this.dbConnector); } catch (SQLException ex) { System.out.println("Impossible de créer la connexion avec le répertoire.\n" + ex.getMessage()); } }
9927b658-da27-4a3a-8ab3-6097a23dc62e
2
public static void main(String[] args) { Set<Integer> c = new HashSet<Integer>() { }; for (int i = 0; i < 10; i++) { c.add(i); c.add(i+2); //demonstrate how the Set works. Only unique added. } for (Integer i : c) { System.out.print(i + ", "); ...
57460b91-a9b6-43c4-a14e-8565337ead32
2
public boolean isSelectedHeight() { for(int i=0;i<markers;i++) { if(marker[i].isSelectedHeight()) { return true; } } return false; }
97cf403a-16b1-4a3b-b809-382e57df7d22
5
@Override public List<TravelLog> sortRating() { List<Journal> j = db.getAllJournals(); List<TravelLog> toReturn = new ArrayList<TravelLog>(); for(Journal journal : j) { List<TravelLog> tmp = journal.sort("Rating"); if(toReturn.size() == 0) toReturn.addAll(tmp); else { for(TravelLog t : t...
aa316c02-ddea-4d8b-8313-219d1385cbb7
7
public void saveAs(File f, String ext) throws IOException { // check args if (f == null || ext == null || ext.length() != 3) { throw new IllegalArgumentException("Wrong arguments for saveAs"); } // check if modified if (!isModified() && f.equals(currentImageFile)) { ...
a98d3992-33e9-4bdc-a871-53b4bc98d78a
4
public int rsiLookback( int optInTimePeriod ) { int retValue; if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) ) optInTimePeriod = 14; else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) ) return -1; retValue = optInTimePeriod + (this.unstablePeriod[FuncU...
0c8d9df2-ebce-400b-9d33-f098def2bcd0
3
@Override protected void format(CellContext arg0) { // 从CellContext获取tree中的文字和图标 JTree tree = (JTree) arg0.getComponent(); DefaultMutableTreeTableNode node = (DefaultMutableTreeTableNode) arg0.getValue(); Object obj = node.getUserObject(); _label.setText(obj.toString()); ...
ebf6d6a0-f1d0-49af-b7b8-b3cd91fe1d1a
2
public void checkhidden() { hide = false; for (String item : Config.hideObjectList) { if (name.contains(item)) { hide = true; break; } } }
b749223e-b336-49e5-9920-ecfbd72d74a0
5
public static final ServerMechanism getInstance(String mechanism) { if (mechanism == null) { return null; } mechanism = mechanism.trim().toUpperCase(); if (mechanism.equals(Registry.SASL_SRP_MECHANISM)) { return new SRPServer(); } if (mechanism.equals(Registry.SASL_...
09c89b33-8ff1-4a73-82fa-da443077faec
3
public boolean CanStackRule(Stack<Character> s) { if (s.size() > 3) { int k = s.size(); String tmp = ""; for (int i = 0; i < 3; i++) { k -= 1; tmp += s.elementAt(k); } if (word.contains(tmp)) { return true; } } return false; }
7efe9a85-7a23-40b1-888c-88d3ebf62db9
5
public static ArrayList<Reservation> searchByProductID(int productID) { try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList<Reservation>...
bcc9a5ae-01a1-426d-bb3f-8a86ca025812
6
public void CaptureCapital(int x, int y) { int loser = 0; for (int i = 0; i < Game.builds.size(); i++) { if (Game.builds.get(i).x == x && Game.builds.get(i).y == y) { Game.player.get(Game.builds.get(i).owner).defeated=true;//Makes a player lose. loser = Game.builds.get(i).owner; System.out.println("G...
ebc080a0-e46a-449a-8ea2-a60a54691471
5
public static List<String> getPluginInventory() { List<String> pluginList = new ArrayList<String>(); try { File jarLocation = new File(ControllerEngine.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()); String parentDirName = jarLocation.getParent(); // to get the parent dir nam...
f8ec9775-09a8-4d93-bdd8-5870998ba272
0
@Override public void modifiedStateChanged(DocumentEvent e) {}
f04f1b88-e7ca-482d-8524-9c186f606a64
0
public void setName(String name) { this.name = name; }
324c7d48-96e9-4dca-902d-d064e916eb4a
0
public void setjPasswordFieldMdp(JPasswordField jPasswordFieldMdp) { this.jPasswordFieldMdp = jPasswordFieldMdp; }
ed743eac-9122-4ecf-a881-3ecc79839ffa
3
public void printDog() { for (Pet temp : list) { try { if (temp instanceof Dog) System.out.println(temp.getName()); } catch (NullPointerException ex) { System.out.println("- Empty"); } } }
f22bd03e-dbcd-43b9-8561-85b2ddac4a17
1
public void close() { try { _socket.close(); } catch (Exception e) { // Let the DCC manager worry about anything that may go wrong. } }
4cdc0cf3-3c06-4785-b6f9-4466195b9f79
1
public static void main(String[] args) { TaskThread taskThread=new TaskThread(); Thread[] threads=new Thread[Threads]; for(int i=0;i<Threads;i++){ threads[i]=new Thread(taskThread); threads[i].start(); } //cThread.start(); }
8a86e03f-b2ad-4fdd-9014-72db7e0a8bfa
2
public int getInt(String key) throws JSONException { Object object = this.get(key); try { return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object); } catch (Exception e) { throw new JSONException("JSONObject[" ...
d2943ba6-0151-400e-8d85-945ffe9668e8
4
void GMEaddSpecies( node v, double[][] D, double[][] A ) { edge e; // loop variable edge e_min; //points to best edge seen thus far double w_min = 0.0; //used to keep track of tree weights // initialize variables as necessary //CASE 1: T is empty, v is the first node //create a tree with v as only vert...
44d91a99-6f22-46c7-a71c-8138f03bad90
1
public synchronized void close() { if (isAlive) { isAlive = false; taskQueue.clear(); interrupt(); } }
cc1ee425-1022-443e-bd17-7a31919378af
1
public int getPages(int intRegsPerPag, ArrayList<FilterBean> alFilter, HashMap<String, String> hmOrder) throws Exception { int pages; try { oMysql.conexion(enumTipoConexion); pages = oMysql.getPages("profesor", intRegsPerPag, alFilter, hmOrder); oMysql.desconexion(); ...
d85719c7-a9e9-410e-92e9-4e860f71eca5
5
private List<Integer> generateMovesToCaseSwitch(int curX,int curY,int goalY) { ArrayList<Integer> ret = new ArrayList<Integer>(); if(curY < 2 || (curY == 2 && goalY >= 2)) while(curY-- >= 0) ret.add(Integer.valueOf(Move.UP)); else while(curY++ < 5) ret.add(Integer.valueOf(Move.DOWN)); return ret; ...
cab60cff-31db-419c-87a4-abe14101b428
7
private static final ScoreValue getDefaultValue(String type) { switch (ScoreKeywords.getIDFromKeyword(type)) { case "bool": return new ScoreBool(); case "char": return new ScoreChar(); case "float": return new ScoreFloat(); case "int": return new ScoreInt(); case "string": return ne...
e454e237-52eb-4e3f-8878-367b56d04b2c
1
private void logFetched(Map<String, Integer> offered) { for (Map.Entry<String, Integer> offer : offered.entrySet()) { getLogger().info( "append fetcher task:" + offer.getValue() + " " + offer.getKey()); } }
05a5ce3c-a237-455e-9a93-e07f718129a5
9
private int storeItemStack(ItemStack par1ItemStack) { for (int var2 = 0; var2 < this.mainInventory.length; ++var2) { if (this.mainInventory[var2] != null && this.mainInventory[var2].itemID == par1ItemStack.itemID && this.mainInventory[var2].isStackable() && this.mainInventory[var2].stack...
8f4e80f5-61b5-4907-ba34-58dfb74244c9
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 && ...
ec3ed7c3-e9f0-4d7c-9951-f81aae93d32f
5
public ymlLoader(Plugin p, String f) { ymlFile = new File(p.getDataFolder(), f); if (!ymlFile.exists()) { ymlFile.getParentFile().mkdirs(); copy(p.getResource(f), ymlFile); } yml = new YamlConfiguration(); try { yml.load(ymlFile); } catch (FileNotFoundException e) { e.printStackTrace(); } catc...
49dc1078-ed8d-418a-baa6-bf8093e9026d
7
public void execute(final MapleClient c, final MessageCallback mc, String[] splitted) throws Exception { MapleCharacter player = c.getPlayer(); int fee = ((player.getTaoOfSight() / 200) + 1); if (splitted[0].equalsIgnoreCase("rebirth")) { if(player.getReborns() < 50){ ...
e195cb51-396c-405a-9a1e-15944e3ac09c
5
@SuppressWarnings("unchecked") public static void printMap(Map map, int depth) { final Iterator i = map.keySet().iterator(); Object key = null; for (int k = 0; k < depth; k++) System.out.print(" "); System.out.println("Dictionary:"); while (i.hasNext() && (key =...
2044cd14-6642-4a26-87bd-e4b1ce079516
8
protected boolean checkCollisionWithTile(float delta) { Rectangle objRect = rectPool.obtain(); objRect.set(getBounds().x, getBounds().y, getBounds().width, getBounds().height); int startX, endX, startY, endY; boolean collide = false; getVitesse().scl(delta); /* * Collision sur Y * on deplace le carre...
8ca3684f-9768-4963-9294-b3f0ef1ed8c6
1
public void run() { println("Enter coefficients for the quadratic equation: "); //prompts the user to enter coefficients double a = readDouble("a: "); double b = readDouble("b: "); double c = readDouble("c: "); double radicand = (b * b) - (4 * a * c); //calculates radicand if (radicand < 0) { ...
5f7ca67d-4acf-41f9-abdf-ceb0774e9b71
4
public static int executeBackup(String backupPath, String fileName) throws SQLException, ClassNotFoundException { try (PreparedStatement stmt = getConnection().prepareStatement(SQL_BACKUP_DATABASE)) { String tempPath = Controller.getProperty(ApplicationProperties.APPLICATION_PATH) + File.separatorChar + ...
d90222fb-5994-40a1-8408-66c95c57f5f7
2
public void add(Object o) { Node n = new Node( o, null); if(last != null) { last.next = n; } else if(first == null) { first = n; } last = n; size++; }
453e14a9-1dc0-443b-8808-892ef56e7463
2
public Boolean process() { // Permissions if(!plugin.permission.isAdmin(player)) { noPermission(); return true; } sendMessage("Statistics for registered types:"); for(Stat stat : plugin.statsData.getStats()) { String type = stat.getType(); Integer spins = stat.getSpins(); Double won =...
d1521ccb-2894-419a-a9b3-5b615fa060a8
3
@Override public void sendUsageImpl(CommandSender sender) { if (!(sender instanceof Player)) return; sender.sendMessage(EdgeCore.usageColor + "/credit apply <amount>"); sender.sendMessage(EdgeCore.usageColor + "/credit pay <amount>"); sender.sendMessage(EdgeCore.usageColor + "/credit info"); User u = E...
f7b5c670-555f-4c94-9460-d5a54ad743a2
7
public void remove(SigDig oldSigDig) { if(isEmpty()){ System.out.println("nothing to remove"); }else if((oldSigDig == mostSig) && (oldSigDig.next == null)){ mostSig = null; }else if((oldSigDig.previous != null) && (oldSigDig.next != null)){ oldSigDig.previous.next = oldSigDig.next; oldSigDig.next.prev...
efffb973-1185-4a48-9ef2-d34105c04bf1
6
public void separateTrainTest4Dynamic() { int cvFold = 10; ArrayList<String> parentFakeList = new ArrayList<String>(); String parentFakeString = "37 198 90 84 358 468 381 361 452 164 323 386 276 285 277 206 402 293 354 62 451 161 287 232 337 471 143 93 217 263 260 175 79 237 95 387 391 193 470 196 190 43 135 458...
488e07a1-0a53-431d-a14c-d934b25ba372
2
public MP3Container lookFor(MP3Filter filter) { Vector<MP3> searchList = new Vector<MP3>(); Vector<Integer> resList = new Vector<Integer>(); for (int i = 0; i < size();i++) { MP3 s = list.get(i); if (filter.fit(s)) { searchList.add(s); resList.add(i); } } ...
f296541b-65aa-47a4-97b1-4ebe515116d6
6
private void buscarBDFC(String idProd, int cantidad){ ArrayList<HashMap> lct= new ArrayList<>(); try{ CallableStatement proc= this.getConexion().prepareCall("CALL ultimasFacturas(?,?)"); proc.setString("idProd", idProd); proc.setInt("cantidadVenta", cantidad); ...
b004a406-d835-4cbc-8e51-2c83e5e26ec8
0
public static org.hibernate.SessionFactory getSessionFactory() { return sessionFactory; }
9e14966a-cb1b-4bd4-8717-473671cee633
8
public Registration readClass (Input input) { int classID = input.readVarInt(true); switch (classID) { case Kryo.NULL: if (TRACE || (DEBUG && kryo.getDepth() == 1)) log("Read", null); return null; case NAME + 2: // Offset for NAME and NULL. return readName(input); } if (classID == memoizedClassId) ...
7b86ff96-27aa-46ef-87ca-d24fcfb76a49
2
private void setNextActivePlayer() { int lastIndexOfActivePlayer = getPlayerNumber(getActivePlayer()); lastIndexOfActivePlayer++; if (lastIndexOfActivePlayer >= players.size()) { lastIndexOfActivePlayer = 0; } setActivePlayer(players.get(lastIndexOfActivePlayer)); getActivePlayer().incrementActionsWithTh...
a69b40fc-1390-4dc8-9a66-4217c2d7fdaf
3
public Long convertStringToLong(final String urlParameter, final boolean required) throws UrlParameterException { Long parameterValue = null; if (urlParameter == null) { if (required) { throw new UrlParameterException("Parameter should be present"); } } el...
173ecbb4-f450-4c32-b1ac-29ac5cc2588c
1
@Override public void run() { try { processPackets(); } catch (IOException e) { isreceiving = false; e.printStackTrace(); } finally { isreceiving = false; socket.close(); } }
cabb539b-bb96-4d3b-abf6-4163033e0a05
4
private String getDecimalPart(String decimal_part) { String dec_part_bin = ""; double dec_part = Double.parseDouble("0." + decimal_part); while (dec_part > 0) { if(dec_part_bin.length()>32) return "ERROR"; if (dec_part == 1) { //dec_part_bin += "1"; break; } double tmp = dec_part * 2; i...
a71ebb92-da22-4b41-9f46-e1eb890c8607
9
public void keyPressed(KeyEvent e) { int Key = e.getKeyCode(); if(Key==KeyEvent.VK_SPACE){ MakeShip(); }else if(Key==KeyEvent.VK_S){ if(this.ship.size()>0){ for(int x =0;x<ship.size();x++){ Enemy LittleShip = (Enemy) this.ship.get(...
bc6b8eae-8222-4018-8bd3-83a633c5026d
0
public DefaultComboBoxModel getModeleJComboBoxSecteur() { return modeleJComboBoxSecteur; }
5eca7ab9-9178-4c6b-b322-747bef076c67
0
private UnchokeMessage(ByteBuffer buffer) { super(Type.UNCHOKE, buffer); }
8688d5d3-df1a-4730-89a7-321362fff661
6
private void updateStudentInDB(Student student) throws ServerException { if (log.isDebugEnabled()) log.debug("Method call. Arguments: " + student); NodeList groups = document.getElementsByTagName("group"); Element group = getGroupNodeByNumber(groups, student.getGroupNumber()); if (group == null) { ServerE...
7e931a1c-08f2-4547-a6ba-1aa3f49b1515
5
public static void warpSelf(Player player, Warp to) { if (Settings.delay == 0 || (Settings.opsBypassDelay && player.isOp()) || (Settings.permsBypassDelay && player.hasPermission("easywarp.delay.bypass"))) { warp(player, to); return; } delayedTeleport(player, to); }
44e53fac-381d-482a-b029-713b127f5159
8
public static int findLongestPalindromicSubstring(char[] input) { boolean[][]palindrom = new boolean[input.length][input.length]; int longestPalindome = 0; // all single letter palindrome for( int i = 0; i < input.length ; i++) { palindrom[i][i] = true; longest...
ec335e51-5ea6-4785-a45c-634ef1e94827
7
@EventHandler public void GhastStrength(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Ghast.Strength...
29f292bf-abef-4cef-a0e3-cdfaa3546eef
9
public String getCard(){ char c, p; String tmp = Integer.toBinaryString(this.code); if(tmp.length() < 2) tmp = "00".concat(tmp); if(tmp.length() < 3) tmp = "0".concat(tmp); switch(Integer.parseInt(tmp.substring(tmp.length()-2), 2)){ case 0: p = 'C'; break; case 1: p = 'T'; break; ca...
4de22439-0eba-4b4e-bf65-2790a9933f6f
5
private ArrayList<ArrayList<String>> performRecognition(Client restClient, byte [] file) throws Exception { String language = "English"; ProcessingSettings settings = new ProcessingSettings(); settings.setLanguage(language); settings.setOutputFormat(ProcessingSettings.OutputFormat.txt); Task task = null; ...
6cffe81a-da34-4e27-a54c-41f658d9efcb
3
public void validatePath() { String testPath = gamePath; if(testPath.equals("")){ JOptionPane.showMessageDialog(null, "Invalid game path."); } else { //If there is atleast some form of path here if(new File(testPath + "/data").isDirectory()){ //Correct factorio path if(new File(testPath + "/confi...
051faabd-650e-4ae4-8235-c5c23b2846a6
6
private int getCurrentX(Node node2, int edgeNumber) { if (edgeNumber == 0) { if (node2.getCorridor((heading + 1) % 4).getWeight() == 1) { return 0; } else { return 3; } } else if (edgeNumber == 1) { return 3; } else if (edgeNumber == 2) { if (node2.getCorridor((heading + 1) % 4).getWeight()...
48ae8367-dd3f-46e5-8165-6d9e71332ce5
6
void merge(int array[], int low, int high) { int arr[] = new int[high-low+1], mid = (low+high)/2; int i = low, j = mid+1, k = 0; //walk through both halves of the array while(i <= mid && j<=high) { if(array[i] > array[j]) arr[k++] = array[j++]; else arr[k++] = array[i++]; } while(i<=m...
039113eb-2070-4812-9008-9863bb81a8fd
6
public BlockMapSlot init(float x, float y, float z) { xSlot = (int) (x / 16F); ySlot = (int) (y / 16F); zSlot = (int) (z / 16F); if (xSlot < 0) { xSlot = 0; } if (ySlot < 0) { ySlot = 0; } if (zSlot < 0) { zSlot = 0; ...
aac7bc59-16e5-453a-9f2c-4ae9e48f8204
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...
3a224f7e-35d7-43fc-8bce-b0a8b49cf40e
0
@Before public void setUp() { this.p = new Piste(0, 0); this.e = new Este(0, 0, 100, 100); this.t = new Taso(50, 0); this.pe = new Pelaaja(); this.pe.setTaso(t); }
de7575e2-e620-42fc-a808-dd59f8e96486
7
private boolean byteArrayEquals(byte[] left, byte[] right) { if (left != null && right != null) { if (left.length != right.length) return false; for(int i = 0; i < left.length; i++) { if (left[i] != right[i]) { return false; } ...
783793bb-7e87-4523-97e7-f8e0e467e58d
9
public static String toWords(String base){ String word = ""; int lenght = base.length(); char last = base.charAt(lenght - 1), secL = base.charAt(lenght - 2); if(last == '=' && secL != '='){ word = base.substring(0, lenght - 2); } else if(last == '=' && secL == '=') { word = base.substring(0, lengh...
8cc3675a-9fda-4092-9484-8c8e9d7d5eda
3
public void shiftRight(int anzShifts, boolean fillIn) { if (anzShifts <= 0) return; for (int i = anzShifts; i < size; i++) bits[i - anzShifts] = bits[i]; for (int i = size - anzShifts; i < size; i++) { bits[i] = fillIn; } }
8de43397-63a4-4a73-a005-7bb95d345f45
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Broadcast other = (Broadcast) obj; if (network == null) { if (other.network != null) return false; } else if (!network.equals(other.netw...
646056b0-938c-4fef-b416-1315b3be0f14
4
public static void arc(double x, double y, double r, double angle1, double angle2) { if (r < 0) throw new RuntimeException("arc radius can't be negative"); while (angle2 < angle1) angle2 += 360; double xs = scaleX(x); double ys = scaleY(y); double ws = factorX(2*r); doubl...
05c27725-90af-4ec2-a393-7570be16c999
7
private static void initText() throws FileNotFoundException, IOException { java.io.BufferedReader reader; String line; String[] splitLine; for (File f : Main.filenameResolver.listFiles("localisation")) { if (!f.getName().endsWith(".csv")) continue; // Could ...
44597d5a-4f8c-44c8-9d7f-46f983dc941f
2
private static boolean notFindInArray(String prefix, String[] values) { int len = values.length; for (int i = 0; i < len; i++) if (values[i].startsWith(prefix)) return false; return true; }
a8c211b5-2808-461b-bc3e-3ac6b923e72c
2
public String toString(){ String s; s = "Teams details\n\tTeam Name = " + this.getTeamName() + "\n\tPlayers\n"; if (this.teamRoster != null){ for (Player p : this.teamRoster){ s = s + p.toString(); } } return s; }
ab7a3205-3bb0-48e2-805c-8163f0510028
0
public Queue() { queue = new DynamicArray(); dequeue = 0; }
2d7e5282-9a23-4bbd-9e75-85819d17e238
6
public void onNick(IRCUserInfo user, String nickNew) { String nick = user.getNick(); if (nickNew.equals(conn.getNick())) mainFrame.setNick(nickNew); String line = "* Nick: "+ nick +" is now known as "+ nickNew; int tabsAmount = mainFrame.getTabCount(); for (int i = 0; i < tabsAmount; i++) { ...
4ef31644-af0b-4fd9-812e-0c7f6b6e813a
6
private void initializePacket(Location center) throws PacketInstantiationException { if (packet != null) { return; } try { packet = packetConstructor.newInstance(); if (version < 8) { String name = effect.getName(); if (data != null) { name += data.getPacketDataString(); } ...
db82461d-4466-4fbc-bf34-92db7b542266
3
private final boolean ends(String s) { int l = s.length(); int o = k-l+1; if (o < 0) return false; for (int i = 0; i < l; i++) if (b[o+i] != s.charAt(i)) return false; j = k-l; return true; }
ede1a8e6-1d1a-42bd-91f0-d3dbdca780d9
2
private void addTrackButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addTrackButtonMouseClicked // TODO add your handling code here: Agrega una pista al calendario. //Deshablilita el boton Add(>>) si la lista de pistas esta vacia. if (addTrackButton.isEnabled()) { ...
fc285ae4-2419-4107-84f0-2813735f6af7
4
protected void slice_check() { if (bra < 0 || bra > ket || ket > limit || limit > current.length()) // this line could be removed { System.err.println("faulty slice operation"); // FIXME: report error somehow. /* fprintf(stderr, "faulty slice operation:\n"); debug(z, -1, 0); ...
48578d95-c82f-4328-95e4-b79052dfdbb9
6
public List<?> invoke(Object[] varargs) throws IllegalArgumentException { if (varargs == null) { if (this.parameters != null) { throw new IllegalArgumentException("Error: The argument is not expected to be null"); } } else { if (varargs.length != parameters.length) { throw new Illega...
cb722d0e-8c83-4935-b3cb-b0976c3c4c2f
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Note other = (Note) obj; if (changed != other.changed) return false; if (deleted != other.deleted) return false; if (id != other.id) ...
31c5fd8d-8318-495f-b1d1-0e540872cfe3
8
public static char[] findLongestPalindrome(char[] input){ boolean palindrome[][] = new boolean[input.length][input.length]; int start = -1; int maxlength = 0; //fill all single letter palindrome for(int i=0; i< input.length; i++){ palindrome[i][i] = true; ...
f4a8950a-774e-492a-8d8f-5efe814d4fa0
4
private void selectPlayerCount(int numPlayers) { playerNames = new JTextField[numPlayers]; playerType = new JCheckBox[numPlayers]; namePnl.removeAll(); if (checkBoxListener == null) { checkBoxListener = new ActionListener() { public void actionPerformed(ActionEvent event) { if (event.getSource() ins...
702d56c5-d5f6-4f30-99fd-176466df4250
0
public static void main(String[] args) { float x = 1.3f; float y = 1.8f; System.out.println((int) (x + y)); // 3 System.out.println((int) x + (int) y); // 2 }
270b765e-f4b2-4538-914b-2f5bd6cd8aa8
7
public int evaluate(Card[] hand) { long product = 1; for (int i = 0; i < 6; i++) { int prime = FiveCardEvaluator.primes[hand[i].rank.ordinal()]; product *= prime; } //System.out.println(ranks); int rank = ranks.get(product); // Look for flushes for (int i = 0; i < 4; i++) lengths[i] = 0; ...
681f8f25-ba06-4467-abaa-7e3815014e7c
1
public int getFileOccurrencesAmount(int file) { RendezVous rv = meetings.get(file); if (rv == null) { return 0; } else { return rv.getPlaces().size(); } }
25911900-5a7e-450f-9f45-39ba1f6451a4
5
private void parseText(String text) { if(text.contains(";")) { String[] lineArray = text.split(";"); for(int i = 0; i<lineArray.length; i++) { if(i > 0 && !lineArray[i].startsWith("<") && lineArray[i - 1].contains("<")) { lineArray[i] = lineArray[i - 1].substring(lineArray[i - 1].lastIndexOf('<'), ...
302a9f10-bde5-476a-83f5-ce8905a4ba8c
4
public void move(int heroX, int heroY) // may change to protected { int moveX = 0; int moveY = 0; if (this.x - heroX < 0) // hero is to the right { moveX = 1; } else if (this.x - heroX > 0) // hero is to the left { moveX = -1; ...
bfc5d25f-238a-4eb5-81df-76f6b3c05020
8
public static boolean delete (Object bean) { String sql; PreparedStatement stmt=null; try{ if(bean instanceof Patient){ sql = "DELETE FROM patients WHERE pid = ?"; stmt = conn.prepareStatement(sql); return deletePatient((Patient)bean, stmt); } if(bean instanceof Employee){ sql = "DELE...
3c64d6ee-90c2-4953-af5a-3e99e3ed45d9
7
private boolean matchInputActions(STS sts1, STS sts2, Map<Action, Action> correspAction) { if (sts1.getInputActions().size() != sts2.getInputActions().size()) { return false; } for (Action act1 : sts1.getInputActions()) { String actName = act1.getName(); if (!actName.contains("Xor")) { Action act2 =...
566a91ca-c494-4648-8d55-0f941b48ed72
0
@Override public void init(List<String> argumentList) { }
27d80bb1-c7ad-43b5-b45d-57a3f0b33472
9
@SuppressWarnings({ "unchecked", "rawtypes" }) public static Class<?>[] searchForAnnotation(Class<?> annotation) { ArrayList<Class<?>> classes = new ArrayList<Class<?>>(); final String TARGET_FORMAT = ".class"; URL[] roots = findClassPaths(); for (URL root : roots) { for (String relativePath : getChildren(...
2fe6bb4c-b52b-4fcd-83dd-7b08d0995677
7
public boolean overlapWithObstacles(BitSet bs) { if (obstacles == null || obstacles.isEmpty()) return false; int length = bs.length(); if (length <= 0) return false; for (Obstacle obs : obstacles) { for (int i = 0; i < length; i++) { if (bs.get(i) && obs.contains(atom[i])) return true; } ...
93acb0f9-28bf-4d3c-a648-2948729a2ea9
2
private static int lookFor(int аrray[][], int example, int start) { //поиск элемента для замены for (int i = start; i < аrray.length; i++) { if (аrray[0][i] == example) { return i; } } return 0; }
f8948092-51aa-4b66-b1af-9ddbb7d40fd1
1
public boolean isElementPresent(By by) { try { driver.findElement(by); return true; } catch (NoSuchElementException e) { return false; } }
1c97db36-2d0b-4153-a028-1d337ff16897
4
private void traverse() { // TODO Auto-generated method stub List<SootMethod> first_node = graph.getHeads(); if(first_node.size()>1){ return; } queue.add(first_node.get(0)); methods_already_seen.add(first_node.get(0)); while(!queue.isEmpty()){ SootMethod m = queue.remove(); //process m ...
ea2c6f52-6f67-43ff-8e11-ffba06056f82
7
private int whenTypeOfToken(int state) { if (state == 1) return 0; // id if (state == 2) return 2; // int if (state < 20) return 3; // if if (state < 30) return 1; // keyword if (state < 40) return 4; // operator if (state < 50) return 5; // breckets if (state < 6...
43cd1b1e-bb91-406a-adc2-d17b4ba14991
0
public int GetOutputBuffer() { return outputBuffer; }
445c82ea-986b-42a7-86d7-905e4a81c38b
8
public final GalaxyXPreprocessorParser.assignment_statement_return assignment_statement() throws RecognitionException { GalaxyXPreprocessorParser.assignment_statement_return retval = new GalaxyXPreprocessorParser.assignment_statement_return(); retval.start = input.LT(1); int assignment_statement...