method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
eb0bd75b-7f22-460a-8126-107a0269e597
5
public CheckResultMessage checkE04(int day) { int r1 = get(13, 5); int c1 = get(14, 5); int r2 = get(17, 5); int c2 = get(18, 5); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); if (0 != getValue(r1 + day, c1, 3).compareTo( ...
f2749134-d303-4de9-afe9-628e9a476cf0
4
public int MovePacket(int inputBufferNumber, int outputBufferNumber, int TIME) { //ONLY ONE BUS PRESENT IN THIS FABRIC //if Active status was successful and the flag is true for having //control of the bus //set packet moved default packetMoved = false; //ge...
b8d9e350-9635-49d8-ab71-568c76ee3945
1
public void addMutations() { for (int i = 0; i < this.population.size(); i++) { this.population.get(i).mutate(66, 2); } }
73bd22f8-94d5-4632-be99-b94b3316526d
3
private boolean isConnectedTo(RailLogic var1) { for (int var2 = 0; var2 < this.connectedTracks.size(); ++var2) { ChunkPosition var3 = (ChunkPosition) this.connectedTracks.get(var2); if (var3.x == var1.trackX && var3.z == var1.trackZ) { return true; } }...
98bf7696-6bc3-4777-9813-7a23fe8ca368
3
public HashSet<String> getQueryIDs(String queryString) { HashSet<String> objList = new HashSet<String>(); //System.out.println(queryString); // execute query ItemIterable<QueryResult> results = session.query(queryString, false); for (QueryResult qResult : results) { ...
6e96abba-4fb6-4ddd-b44a-ec5534230470
2
public void recordPackage(String jvmClassName) { String classname = jvmToJavaName(jvmClassName); for (;;) { int i = classname.lastIndexOf('.'); if (i > 0) { classname = classname.substring(0, i); classPool.recordInvalidClassName(classname); ...
60349cd4-06d1-4d2a-b333-7bbca308aebb
9
@Override public String toString() { String result = ""; String newline = "\n"; for (int i = 0; i < colonnes; i++) { for (int j = 0; j < lignes; j++) { if (vampires[i][j] != 0) { result += vampires[i][j] + " vampires " + "sur case " + i + " ," ...
0a309f70-0512-4901-8e95-bddd12f5d975
5
public static int indexOfSubString(String str,String sub){ int curIndex=0; int subIndex=0; while(curIndex<str.length() && subIndex<sub.length()){ //If it matches if(str.charAt(curIndex)==sub.charAt(subIndex)){ curIndex++; subIndex++; continue; }else{ //If it doesn't match, calc new curInd...
4aaf0998-f50f-4dc5-9fa7-11e4c413707f
6
public static boolean question(String question) { System.out.println(question+"\n I/N?"); boolean correct = false; while(!correct) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { String s1 = br.readLine(); if(s1.equals("I") || s1.equals("i")) return true; e...
050176e5-e9cb-4df8-a904-aad13db36d2a
0
public void setName(String name) { this.name = name; }
4c47a36b-6252-4e8d-8d1c-e4ba3c64acee
2
public Aukiolo haeAukiolot() throws DAOPoikkeus { // Esitellään olio Aukiolo aukiolo = new Aukiolo(); // Avataan tietokantayhteys: Connection yhteys = avaaYhteys(); // Haetaan tietokannasta aukioloajat: try { String sql = "select arkialku, arkiloppu, vklpalku, vklploppu from Aukiolot"; Statem...
17c3d9ad-b96f-4446-ba30-d21ab1741384
0
protected void onSetInviteOnly(String channel, String sourceNick, String sourceLogin, String sourceHostname) {}
7eb4ab7a-f1b9-4148-a8bb-90bca074c766
5
@Override public void setCell(int x, int y, boolean live) { if (y<0 || y>=getHeight()) return; if (x<0 || x>=getWidth()) return; if (live) world[y][x] = 0; }
f2bffdf7-5de7-440c-9101-e5673eaca631
7
protected void addLevel2Tree( double cx, double cy, WorldUpdateBuilder ub ) { switch( rand.nextInt(4) ) { case( 0 ): // ring! double rad = 250+rand.nextDouble()*500; double cir = rad * 2 * Math.PI; int count = (int)(cir / 500)+1; double phase = rand.nextDouble(); for( int i=0; i<count; ++i ) { ...
560c613c-f6ad-46e2-bfcb-bbf4c57a4206
0
public NoPreviousEmailKontaktFoundException(String message) { super(message); }
e4f67395-474a-4ac2-a4cb-18e74d1e1325
9
public boolean controlErroresEmpleado(Empleado empleado) { boolean correcto=false; if(empleado.getDisponible()) { if(!empleado.getApellidos().isEmpty() && !empleado.getNombre().isEmpty()) { if(!empleado.getDireccion().isEmpty() && empleado.getSueldo()>...
bfd612ba-d648-4aeb-9691-8c263a324875
6
public void getInput() { String command; Scanner inFile = new Scanner(System.in); do { this.display(); // display the menu // get commaned entered command = inFile.nextLine(); command = comma...
36668bf5-2545-4e29-bba0-16bac0372134
1
public void setFixedOrientation(boolean fixedOrientation) { this.fixedOrientation = fixedOrientation; if(fixedOrientation) mouseListener.show(); else mouseListener.hide(); }
f390fbbb-bd65-40db-937f-9874fc5f6688
1
public JSONObject optJSONObject(String key) { Object object = this.opt(key); return object instanceof JSONObject ? (JSONObject) object : null; }
34e87fc7-1bb9-42d3-9379-a4878dafba4b
0
public String getArea() { return Area; }
a9665e2d-608a-47f6-b330-7d7db7b79558
1
private void loadPoperties() { InputStream resourceFile = null; properties = new Properties(); try { resourceFile = getClass().getResourceAsStream(Constants.PROPERTIES_FILE.toString()); properties.load(resourceFile); LOG.info("Validator Properties are successfully loaded."); } catch (IOException e) { ...
ef804c8f-d62b-40a4-a24b-8b73c9d6ced4
5
@Override public boolean equals(Object o) { if (!(o instanceof ElementStAX)) { return false; } else { ElementStAX i = (ElementStAX) o; if(isText() != i.isText()) { return false; } if(isText()) { return i.text.equals(this.text); } else { return i.attributes.e...
f18d41cc-5fad-46b7-84df-e40465f87870
9
static String writeDate(int year, int month, int day, int hour, int minute, int second) { String retu = ""; if (day > 0) { retu += month + "/" + day + "/" + year; } else { retu += month + "/" + year; } String h = "", m = "", s = ""; if (hour >= 0) { if (hour < 10) { h = "0" + hour; } else...
f174288d-9244-4f8a-8ebf-c9fa140ead1c
7
public void moveUp(){ switch (polygonPaint) { case 0: line.moveUp(); repaint(); break; case 1: curv.moveUp(); repaint(); ...
1672a4e3-3ed7-4c44-9fc7-5308e44ff961
5
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(!(sender instanceof Player)){ sender.sendMessage(ChatColor.DARK_RED + "You need to be a Player!"); return true; } Player player = (Player) sender; if(!player.hasPermission(pluginMain.pluginManag...
531c37e8-5f99-4745-8f1b-d36b6f203e90
8
public boolean accept(File f) { if (f.isDirectory()) { return true; } Utils utils = new Utils() ; String extension = utils.getExtension(f); if (extension != null) { if (extension.equals(Utils.tiff) || extension.equals(Utils.tif) ||...
79f2f1ac-28d8-4537-9af9-4a26fbc81f51
4
@Override public StateBuffer execute(StateBuffer in) { StateBuffer out = new StateBuffer(); int sumDelay = -1; while(!out.isFull() && (!onlyOneStateNeeded || out.isEmpty())) { sumDelay++; System.out.println("FindShortestSequenceSegment: testing delay "+sumDelay+" size="+out.size()); for(State s : in.get...
6179ed1d-04bb-4fdb-8f29-9207f75c6d91
3
@Override public int[] sort(int[] a) { for(int i = 1; i < a.length; i++) { for(int j = i; j > 0; j--) { if(a[j] < a[j-1]) swap(a, j, j-1); } } return a; }
56939140-2895-44f1-a2d3-9c5ce1485648
5
private static String getJSON(String url) throws IOException { BufferedReader bis = null; InputStream is = null; try { URLConnection connection = new URL(url).openConnection(); is = connection.getInputStream(); // warning of UTF-8 data bis = new BufferedReader(new InputStreamReader(i...
11504b49-6fd1-4797-b6d6-bafee7281803
6
protected boolean colidate(int x1, int y1, int x2, int y2){ int left = getX(); int right = getX()+getSWidth(); int top = getY(); int bottom = getY()+getSHeight(); for (int x = x1+5; x < x2-5; x++) { for (int y = y1+5; y < y2-5; y++) { if (x>=left && x<=right && y>=top && y<=bottom) { ...
cca66422-25ce-4efd-9444-0cab87b51905
2
public static Hiscores lookup(String name) { try { final BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(WEBSITE + name).openStream())); final StringBuilder builder = new StringBuilder(); String line; while ((line = reader.readLine()) != n...
00dd8bbc-137b-4257-8a73-b651a5a39fe0
7
@Override public double getTemperature(int i, int j) { if (i >= 0 && i < numLongCells && j >= 0 && j < numLatCells) { return cellValues[i][j]; } // Allow overrunning the "size" of the grid. We are on // a sphere, after all. This is convenient for checking neighbors ...
1a8dcbcd-8d07-486d-9ebd-b344687de709
6
public List getMessByTimeAndUser(String beginTme, String endTime, String username,String rescueStatus) { if(beginTme!=null&&!beginTme.trim().equals("")){ if(endTime!=null&&!endTime.trim().equals("")){ String hql = "from Rescueapply r where r.applytime >=:beginTime and r.applytime <=:endTime and r.applype...
8eb6d41c-055d-4c33-b99e-9ddf47160130
0
public static void main(String[] args) throws JAXBException { Worker worker = new Worker(); worker.setName("Sergii"); worker.setAge(25); worker.setId(7); File file = new File("D:\\Java SE\\src\\xml\\jaxb\\worker.xml"); JAXBContext jaxbContext = JAXBContext.newIn...
b88d67d4-b5d2-4390-b5d4-8c829e9697b6
8
@Override public void execute() { if (Game.getClientState() != Game.INDEX_MAP_LOADED) { BearFurs.stop = 1000; } if (Game.getClientState() == Game.INDEX_MAP_LOADED && BearFurs.stop == 1000) { BearFurs.stop = 50; } if (BearFurs.client != Bot.client()) { WidgetCache.purge(); Bot.context().getEve...
b4546022-0bcd-4afe-b320-f21e8cd8d528
8
protected JTableExtender initializeTable(Object obj) { // System.out.println("In regular multiple initialize"); boolean multiple = false; int inputCount = 0; if(this.getEnvironment().myObjects!=null){ multiple = true; inputCount = 1; } //System.out.println("In initialize:"...
e33d960c-f174-4bb4-9dd4-e18f5118c916
3
public static void main (String[] args) { int pattern[] = new int[6]; for (int i = 0; i < 4; i++) { initialize(pattern, 0, 5); pattern[i] = 1; for (int j = i+1; j < 5; j++) { initialize(pattern, i+1, 5); pattern[j] = 2; ...
c591e3fb-09e8-4dc6-90dd-3c28a478c97e
2
public int login(User loginUser) { // Variable für Anzahl der gefundenen Datensätze int numRows = 0; try { // PreparedStatement für den SQL-Befehl String sqlStatement = "SELECT COUNT(*) FROM bookworm_database.users WHERE username = '" + loginUser.getUserName() + "' AND userpassword = '" + lo...
b9ff987c-f823-4f56-8a50-536aa32c086a
8
public void addShadow(Identifier orig) { if (isPreserved() && !orig.isPreserved()) orig.setPreserved(); else if (!isPreserved() && orig.isPreserved()) setPreserved(); Identifier ptr = this; while (ptr.right != null) ptr = ptr.right; /* Check if orig is already on the ptr chain */ Identifier check...
839f189f-dea6-449f-b6f8-a705c3e38b0e
4
public void setProperties(Object instance, Map map) throws IllegalAccessException, InvocationTargetException { if (map == null) { return; } for (Object object : map.keySet()) { String property = (String) object; Object v = map.get(property); if (is...
648dc289-7d48-4f8f-a49b-e11adce03f87
7
public static void main(String[] args) throws ReadItemLineException, IOException { BufferedReader br = null; Reader r = new InputStreamReader(System.in); br = new BufferedReader(r); String str = null; String outStr = null; try { do{ System.ou...
7381322e-f79a-41e2-8a6f-79870cd78531
2
private void araseLine(int lineNumber){ if(lineNumber < fieldSize) { for (int i = 0; i < fieldSize; i++){ field[i][lineNumber] = DEFAULT_CELL_VALUE; } } else { System.out.println("Wrong data in araseLine"); } }
18d6dbef-0f27-486e-beab-22d8988f0a93
0
public static BoundaryBox clip(BoundaryBox bb, int minX, int minY, int maxX, int maxY){ int newX = Math.min(Math.max(minX, bb.getX()), maxX); int newY = Math.min(Math.max(minY, bb.getY()), maxY); int endX = Math.min(Math.max(minX, bb.getX()+bb.getWidth()), maxX); int endY = Math.min(Math.max(minY, bb.getY()+...
f7624d1f-01a8-4a37-a5ea-dffdd4d7afc2
7
private void gameListMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_gameListMouseClicked // Get the selected game list item int index = gameList.locationToIndex(evt.getPoint()); GameListItem item = (GameListItem) gameModel.get(index); // See if the sele...
e35b2f53-d31f-4cd5-bb04-17ca15271225
1
public Board(TicTacUI owner, Game ownerGame) { this.setLayout(new GridBagLayout()); for(int i = 0; i < gameBoard.length; i++) { gameBoard[i] = new Tile(i, this); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = i % numCols; ...
fdbe587a-bccf-4d25-87fe-2db7c2bb6aae
0
public static List<Labo> selectAll(EntityManager em) throws PersistenceException { List<Labo> lesLabos = null; Query query= em.createQuery("select l from Labo l"); lesLabos = query.getResultList(); return lesLabos; }
55fd48fa-564a-4a51-84c7-dd9d52e91244
4
protected static void doPhoneNumbers() { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); String phone = in.next(); Integer dictionarySize = in.nextInt(); for (int i = 0; i < dictionarySize; i++) { String word = in.next(); ...
03a5f5ce-64f1-488c-81d8-9f1a816a0bf5
3
public static int maxProfit3(int[] prices) { List<Integer> p = maxProfitPoint(prices, 0, prices.length); int profit = p.get(2); List<Integer> p1 = maxProfitPoint(prices, 0, p.get(0)); List<Integer> p2 = maxProfitPoint(prices, p.get(1) + 1, prices.length); profit = profit + (p1.get(2) > p2.get(2...
c16f6241-b697-4e7e-a1d2-79ebf18ae554
1
public boolean add(Object o) { LocalInfo li = (LocalInfo) o; LocalInfo contained = findSlot(li.getSlot()); if (contained != null) { li.combineWith(contained); return false; } else { grow(1); locals[count++] = li; return true; } }
3f49c24d-fd0c-4f64-ac71-bf3423dbcc47
8
public Pair<List<Sentence>, Double> getBestSnippet(ScoreFunction func, int minLength, int maxLength, int delta, int windowSize) { double highscore = Double.MIN_VALUE; List<Sentence> bestSentences = null; for (Pair<Integer, Integer> boundaries : chooseTwo(sentences.size())) { int start = boundaries.first(); ...
fb86e1b5-a5a7-4acc-8e08-39690f952cb8
7
@Override public boolean equals (Object other) { Edge<?> e = (Edge<?>) other; // warning if use Edge<N> - unchecked method invocation if (other == null) {return false;} if (this.getClass() != other.getClass()) {return false;} if (!this.src.equals(e.src)) {return false;} ...
3897b1ea-369e-4750-b0bc-dd2ad5ea9ba6
1
public void paint(Graphics pen) { if(myText.length() == 0) return; Graphics2D p = (Graphics2D)pen; FontRenderContext frc = p.getFontRenderContext(); TextLayout layout = new TextLayout(myText, FONT, frc); layout.draw(p, (float)myBottomLeft.getX(), (float)myBot...
6cc133c1-fe79-429a-8ce0-c8052dbcc012
9
private static String sqlType2JavaType(int type) { String typeStr = ""; if (Types.INTEGER == type || Types.NUMERIC == type) { typeStr = "int"; } else if (Types.VARCHAR == type || Types.CHAR == type || -1 == type) { typeStr = "String"; } else if (Types.DECIMAL == type) { typeStr = "double"; } else if ...
4cc35c0c-70e2-4629-bec3-10f901dc6537
9
@Override public Command planNextMove(Info info) { enemyDistance=null; enemyDistance= new double[info.getEnemies().size()]; enemyAngle=null; enemyAngle= new double[info.getEnemies().size()]; x=info.getX(); y=info.getY(); angle=info.getDirection(); int i=0...
2b030d80-0e91-4bef-942d-ef6790273bc0
2
public boolean hasPlayableCard() { for (Card card : hand) { if (canPlayCard(card)) { return true; } } return false; }
814dc6a4-6f96-4bd3-8482-be408a9af36b
8
public static void main(String[] args) { int i; boolean[] sieve = new boolean[2000000]; long sum = 0; for (i = 2; i < 2000000; sieve[i++] = true) ; for (i = 2; i * i < 2000000; i++) { if (sieve[i]) { System.out.println(i); sum += (long) i; if (sum < 0) { System.out.println("rollover err...
93109f37-4989-4592-8a1c-6414e4dc21cd
2
private void paintEnemies(Graphics2D g2d) { for (Enemy e : gameLogic.getEnemyList()) { if(e.isAlive()){ g2d.drawImage(e.image, e.posX, e.posY, this); } } }
64a57425-118d-4924-8f7d-342f9e370460
9
public void tableChanged(TableModelEvent e) { Object o = e.getSource(); if (o instanceof TableModel && table.getRowSelectionAllowed()) { int row = e.getFirstRow(); int column = e.getColumn(); // tells which student we are // modifying if (row == -1 || column == -1) return; TableMod...
d7230f64-3cb6-452f-8d2f-1a896cd27027
5
public static Board createCompleteBoard(int count, Device.Type... deviceType) throws IOException { Board newBoard = createBoard(); Device device; for (int i = 0; i < count; i++) { String nameDevise = deviceType[rnd.nextInt(deviceType.length)].name(); switch (nameDevis...
82fa8912-0842-4aa2-b62a-fc0d4a71e37e
7
@SuppressWarnings("unchecked") public void poppulateCriteria(HashMap<String, Object> criteria){ if(criteria.containsKey("endDate")){ this.endDate = new LocalDate((String) criteria.get("endDate")); } if(criteria.containsKey("startDate")){ this.strtDate = new LocalDate((String) criteria.get("startDate"));...
135ca06a-c9c9-42a8-aac8-efb730ee01a1
3
public void setPitch(float pitch) { if(pitch <= 90 && pitch >= -90) this.pitch = pitch; else if(pitch > 90) { this.pitch = 90; } else { this.pitch = -90; } }
c7a39105-e705-46e2-afd9-35a559e7a592
2
public boolean canEatFish(Fish f) { if (f instanceof Gyarados || f instanceof Magikarp) { return false; } return true; }
19dc6b69-8e98-4e45-af05-fe617ab80b12
1
public void addMessage(ChatMessage message){ try { Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); String url = "jdbc:derby:" + DBName; Connection connection = DriverManager.getConnection(url); Statement statement = connection.createStatement(); DateFormat dtf = new SimpleDateFormat("yyyy-MM...
7d059ce8-e20d-4c05-973a-bebff983a70f
1
private static boolean confirmQuit(String title) { Game.pauseGame(); return !Game.isActive() || JOptionPane.NO_OPTION != JOptionPane.showConfirmDialog(instance, "Quit the Current Game?", "Confirm " + title, JOptionPane.YES_NO_OPTION ); }
12a0623b-6dda-46aa-87e9-7ba6289fcb2a
5
public boolean equals(TProducto productoB) { return this._id == productoB.getId() && _nombre.equalsIgnoreCase(productoB.getNombre()) && _precio == productoB.getPrecio() && _descripcion.equalsIgnoreCase(productoB.getDescripcion()) && _codigoDeBarras.equalsIgnoreCase(productoB.getCodigoDeBarras()) && _activo ...
3f694675-3676-4c65-8760-3a2a07edf921
0
@Test public void runTestLocationLeak2() throws IOException { InfoflowResults res = analyzeAPKFile("Callbacks_LocationLeak2.apk"); Assert.assertNotNull(res); Assert.assertEquals(2, res.size()); }
7b169716-459a-4a9b-a880-7c15c0a4d425
5
public Popup(int width,int height,PopupPosition pos){ if(width == 0){ throw new IllegalArgumentException("Width cannot be 0"); } if(height == 0){ throw new IllegalArgumentException("Height cannot be 0"); } this.width = width; this.height = height; int screenWidth = JEngine.SCREEN_WIDTH; int screenHe...
5f10e9e6-b898-455a-85df-f02b9fa17ac5
3
private boolean zzRefill() throws java.io.IOException { /* first: make room (if you can) */ if (zzStartRead > 0) { System.arraycopy(zzBuffer, zzStartRead, zzBuffer, 0, zzEndRead-zzStartRead); /* translate stored positions */ zzEndRead-= zzStartRe...
b4f7136e-16a7-4b31-ac93-9562f829b1ac
8
public boolean removeAt(int index) throws InvalidAccessException { DLNode current = new DLNode(); DLNode next = current.getNext(); DLNode prev = current.getPrev(); if (this.head == null) { throw new InvalidAccessException("Empty List!"); } if (index - 1 < 0) { throw new InvalidAccessException("Inde...
b8d4bc6c-560c-4b6c-a3ec-5d6bd3e234a6
7
public void ActivateCognitiveGraphEX(String symbol, int matchresult){ if(symbol.equals("红色") || symbol.equals("玫瑰")){ int result; result=matchresult; //1 if(result==0)//前一个词是对象,后一个词是属性值 { //1.建立一个空节点 //2.将这个空节点链接到表示前一个词的节点后面 //3.对节点的Symbol和Relation赋值//注意,在例子中,属性名只有颜色。所以这里就把过程简单化了,否则应该检查属性...
342ecaf8-57e8-43c9-bc34-3cc9ad5d31d1
3
public void read(Node node) { while (node != null) { if (node instanceof Element) { Element elt = (Element) node; IElementHandler handler = handlers.get(elt.getNodeName()); if (handler != null) { handler.parseElement(elt); } } node = node.getNextSibling(); } }
5039ea32-6c75-4c61-9748-99605f3dc984
0
public Player playGame(Player player1, Player player2) { Game game = new Game(player1, player2); Player winner = game.play(); score(winner); return winner; }
1a8df505-1250-4a00-94ee-5ba9188e370e
7
public boolean search(String word) { if (word == null || word.length() == 0) return false; int len = 0; TrieNode node = root; while (len < word.length()) { boolean found = false; for (int i = 0; i < node.nodes.size(); i++) { if (node....
3892652f-8c4e-4290-a1e7-135b483a38d3
9
public void loadData() { int v = 1; String s = ""; Integer i = 0; Integer l = 1; try { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(this.getDataFolder() + "/ControllerBlock.dat"), "UTF-8")); String version = in.readLine().trim(); if (version.equals("# v2")) { v...
3cf0d988-3853-463c-923e-b110d5d52eb0
8
public String getText(Player other) { if ((other.getCurrentY()+1) == getCurrentY()) { if ((other.getCurrentX()) == getCurrentX()) { return text; } } if ((other.getCurrentY()-1) == getCurrentY()) { if ((other.getCurrentX()) == getCurrentX()) { return text; } } ...
c75f0f7a-2356-4dc0-809c-81d368050b26
9
private void carregaVariaveis() { lblNome.setText(at.getNome()); lblNumVisualizacoes.setText("" + (at.getNumeroVisualizacoes() + 1)); if(at.getClassificacao()==0){ lblPontuacao.setText(bundle.getString("Sem_Classificacao")); }else{ lblPontuacao.setText(...
2e71e6d9-f51c-44b7-bb56-f057d9e49c4d
4
@Override public boolean equals(Object object) { if (object == null) return false; if (object == this) return true; if (this.getClass() != object.getClass()) return false; PointGame point = (PointGame) object; if (this.hashCode() == point.hashCode()) return true; return false; }
4da1ed6a-6186-4c5d-b95d-f83090d1bdbf
3
private boolean parseHandshake(JSONObject o) throws ProtocolException { try { if(!(o.get("message").equals("connect"))){ throw new ProtocolException("Expected 'connect' handshake, but got '" + o.get("message") + "' key"); } if(!(o.getInt("revision") == 1)){ throw new ProtocolException("Wron...
7f50d636-5aea-4f67-b92c-6d401644fc5b
4
protected void sort(SimpleFeatureType featureType, SortBy[] sort, String prefix, StringBuilder sql) throws IOException { if ((sort != null) && (sort.length > 0)) { sql.append(" ORDER BY "); for (int i = 0; i < sort.length; i++) { String order; if (sort[i]...
897e8a76-4e98-4752-96f8-f94ddbdd643e
5
@Override public void putAll( Map<? extends S, ? extends T> map ) { for (Entry<? extends S, ? extends T> e : map.entrySet()) { put( e.getKey(), e.getValue() ); } }
6aae4ce4-9e93-469b-9a8e-645604420331
5
public void addConnection(PlayerMP player, Packet00Login packet){ boolean alreadyConnected = false; for(PlayerMP p : this.connectedPlayers){ if(player.getUsername().equalsIgnoreCase(p.getUsername())){ if(p.ipAddress == null){ p.ipAddress = player.ipAddress; } if(p.port == -1){ p.port = play...
b622a1f0-a2c6-4092-a2ee-aa0b79bde5c7
5
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton2ActionPerformed {//GEN-HEADEREND:event_jButton2ActionPerformed if (!gameover) { if (rule.turn()) { if (rule.check(1, 0)) { rule.pressed(1, 0); if ...
0ce7a835-7d1a-4c85-af38-bfee7e2de0c9
3
public int minPathSum(int[][] grid) { int m = grid.length; int n = grid[0].length; int[] answer = new int[n]; answer[0] = grid[0][0]; for (int i = 1; i < n; i++) answer[i] = grid[0][i] + answer[i - 1]; for (int j = 1; j < m; j++) { answer[0] = gr...
50ef959c-c328-4864-8757-2b47fe1a4744
3
@Override public void rotateXMinus() { if(orientation == X) return; orientation = (orientation == Y ? Z : Y); for(int i = 0; i < others.length; i++) { IntPoint p = others[i]; others[i] = new IntPoint(p.getX(), p.getZ(), -p.getY()); } }
24186eb9-a8ca-404b-982a-8050c487690f
9
protected void stepForward(boolean showSteps) { switch (m_currentPhase) { case PHASE_PREPROCESSING: long precSize = getNumPrecomputedBlocs(); if (precSize > Integer.MAX_VALUE) { JOptionPane.showMessageDialog(null, "Num...
6cef43c7-4d6f-427d-b8e1-7e93578d4efc
8
public void mouseDragged(MouseEvent e) { Rectangle bounds = getBounds(); Dimension d = getSize(); Point p = e.getPoint(); SwingUtilities.convertPointToScreen(p, e.getComponent()); int dx = p.x - lastPoint.x; int dy = p.y - lastPoint.y; switch (dragType) { case DRAG_TOP: Point loc = getLocat...
74d775eb-6333-4f4b-9cfd-6ab04324b3c4
4
private static List<String> readLines(String path) { ArrayList<String> lines = new ArrayList<String>(); //open file File file = new File(path); //Error if not readable if (!file.canRead()) { System.err.println("File " + file.getAbsolutePath() + " could not be read!"); System.exit(1); } BufferedRe...
398c2942-da1d-4cc5-ae19-7fb217285b29
7
private void displayInfo(ChunkyPlayer chunkyPlayer, CommandSender sender) { String sFirstDate = "NA"; Long lFirstDate = chunkyPlayer.getFirstLoginTime(); if (lFirstDate != 0) { sFirstDate = new Date(lFirstDate).toString(); } String sLastDate = "NA"; Long lLast...
05e3f14d-7655-4720-95c1-9906e2729fde
1
public boolean fieldContainsThisPlayersPiece(Field field, Player playersTurn) { return field.hasPiece() && field.getPiece().isWhite == playersTurn.isWhite; }
3da19e76-5e8a-43d7-bde2-23f8457e8c5f
7
public void swap() { Item itm1 = new NoItem(); Item itm2 = new NoItem(); int Itm1W = 0; int Itm1H = 0; int Itm2W = 0; int Itm2H = 1; int amount = 1; for (int h = 0; h < ItemH; h++) { for (int w = 0; w < ItemW; w++) { if (ITEMS[h][w].isSelected) { if (amount == 1) { itm1 = ITEMS[h][w];...
e2a7ea7e-d476-4819-a440-751767b68dc8
9
public void mouseDragged(MouseEvent pEvent) { //Only One drag can occur at a time if(currentDragComponent != pEvent.getComponent() || currentDragComponent==null) return; //This info is all in the context of the Current Drag Component Point _point = pEvent.getPoint(); Point _newLoc =...
c8e10da2-79a8-4968-b7fb-42e4ad6dc4e2
6
public static MapNode crossing(MapNode from, MapNode to, Set<MapNode> neighbors, double direction) { direction = normalize(direction); if (neighbors.size() == 1) { return from; } else if (neighbors.size() == 2) { Iterator<MapNode> iterator = neighbors.iterator(); MapNode tmp = iterator.next(); if ...
e88f7817-d6ad-49e5-b62d-6b7c57d71de9
5
static void initialize() { try { SHIP = ImageIO.read(SpaceShooter.class.getResourceAsStream("img/player/ship.png")); MISSILE = ImageIO.read(SpaceShooter.class.getResourceAsStream("img/player/missile.png")); PLASMA = ImageIO.read(SpaceShooter.class.getResourceAsStream("img/ene...
d0d2579b-4484-4cef-b3f3-def320ca17d1
8
private void addGroupBySelectedFields() { DefaultMutableTreeNode selectNode = (DefaultMutableTreeNode) ((BrowserItems.DefaultTreeItem) node.getParent()).getFirstChild(); for (int i = 0; i < selectNode.getChildCount() ; i++) { BrowserItems.DefaultTreeItem item = (Browser...
2b44ce70-9ce5-4ad6-944e-d8f641655731
9
public static int[][][] fillTable(String seq1, String seq2, String seq3, Map<String, Integer> matrix, int g) { int[][][] scoreTable = new int[seq1.length()+1][seq2.length()+1][seq3.length()+1]; scoreTable[0][0][0]=0; int[][] score2 = linearAlignment.fillTableLinear(seq1,seq2,matrix,g); ...
a0517d89-3416-4a4c-bd27-8e4685367d92
2
public void createDirectory() { File file = new File(source); if (!file.exists()) { if (file.mkdir()) { System.out.println("Directory is created!"); } else { System.out.println("Failed to create directory!"); } } }
6a91f64b-feb6-41fd-b3b9-209257867915
3
public boolean claimAnimal(Player p, Entity animal, ItemMeta meta){ String owner = p.getUniqueId().toString(); String pet = animal.getUniqueId().toString(); if(!plugin.getAnimalData().contains("Farmer." + owner + ".Animals")){ plugin.getAnimalData().set("Farmer."+ owner + ".Name", p.getName() + ".Animals"); ...
d84371f4-b9cf-4554-a3cc-350a5ebd7724
3
@Override public boolean equals(Object obj) { if (!(obj instanceof ChunkyCoordinates)) return false; ChunkyCoordinates coords = (ChunkyCoordinates) obj; return coords.getWorld().equals(this.getWorld()) && coords.getX() == this.x && coords.getZ() == this.z; }
d00808a0-67fb-4a64-b1d1-22bd6699df23
3
@Override public void run(){ while(true){ if(running){ try { sleep(500); loadChannel(); } catch (Exception e) { e.printStackTrace(); } } } }
de659da2-5b9d-442d-b07e-cd3c8c650f12
1
@Override public void mouseMove(MouseEvent e) { if(this.getMouseListener() != null) { this.getMouseListener().MouseMove(this, e); } }