method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
54a8b961-5204-4329-960b-1399aee0bbe0
0
public int compareTo(Object o) { @SuppressWarnings("unchecked") Node<K> other = (Node<K>) o; return this.frequency - other.getFrequency(); }
592e0ed6-44f5-4360-8352-5e059926c41e
9
@Override public boolean equals(Object object) { if (this == object) { return true; } if (object instanceof Map.Entry) { Map.Entry<?, ?> entry = (Map.Entry<?, ?>) object; return (key == null ? entry.getKey() == null : key.equals...
294225a3-0171-4d85-8006-3a30a2173f2f
1
public void testSet_Field() { MutablePeriod test = new MutablePeriod(1, 2, 3, 4, 5, 6, 7, 8); test.set(DurationFieldType.years(), 10); assertEquals(10, test.getYears()); test = new MutablePeriod(1, 2, 3, 4, 5, 6, 7, 8); try { test.set(null, 10); f...
42838148-7cf6-4919-a5e0-a719b85ff044
3
public void testCharacter() { System.out.println("\n*** testCharacter ***"); final Character[] testChars = {'a', 'A', '\t', ' '}; for (final Character character : testChars) { final boolean testResult = DefaultCycObject.isCycLObject(character); assertTrue("char test " + character, testResult); ...
03db7c9d-4682-49cf-85ee-813e6c95c0cd
0
@Override public void mouseMoved(MouseEvent e) { }
0790155a-6fd1-4f0d-993e-e7d404958161
4
public int removeDuplicates(int[] A) { if(A ==null || A.length ==0) return 0; else{ int length = A.length-1; int index =1; for(int i=0;i< length;i++){ if(A[i] != A[i+1]){ A[index++] = A[i+1]; } ...
11f8ffbc-f31c-4fca-b1cb-ab098ab19af0
8
public void keyReleased(KeyEvent e) { if ( e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_RIGHT ) { switch(e.getKeyCode()) { ...
b06e1fd9-c0ec-4a32-8865-6408cfdcef85
3
public boolean mainMenu() { System.out.println("City Connection"); System.out.println("Choose and option by typing the" + " corresponding number and pressing enter:"); System.out.println("1. Show Connecting Cities"); System.out.println("2. Get Shortest Path"); ...
a8a2115f-b0e4-441e-8eea-4f49d38f83b2
3
public void dropCheck(int stateChange) { if(stateChange == ItemEvent.SELECTED){ shadow = true; }else{ shadow = false; } if(selectedDrawings != null){ for(int i=0;i<selectedDrawings.size();i++){ selectedDrawings.elementAt(i).setShadow(shadow); } } }
35ec96d6-6411-41fb-be50-e4f8a8924772
1
@FXML private void handleBtnRegisterAction(ActionEvent event) { if (mode == Mode.MODIFY) { String sql = "update Suppliers set name = ? where suppliercode = ?;"; getPersist().executeUpdate(sql, txtName.getText(), selected.getSuppliercode()); mode = Mode.ADD; } else...
22075cce-2d95-4e98-9335-47aff432cf21
0
public ReportWindow(String reportText){ new JFrame(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setSize(500,250); setResizable(false); setLocation(screenSize.width/2-getWidth()/2, screenSize.height/2-getHeight()/2); setDe...
588b30d9-d1a7-4172-8c13-c6df8aa912bd
9
static void draw_sprites3(osd_bitmap bitmap, int c, int d) { int offs, mx, my, color, tile, i, bank, fx, fy; for (offs = 0x0000; offs < 0x800; offs += 0x40) { mx = spriteram.READ_WORD(offs + c); my = mx >> 8; mx = mx & 0xff; /* if ((my & 0x80) != 0) ...
748f5bdc-7d3b-46c9-8042-3a3c88fb5f16
7
public String listarCuenta() throws SQLException { String Recorrertbl = ""; String colorEstado = ""; String iconoEstado = ""; String nomFuncion = ""; ResultSet listCuentaPro = Cuen.consultarCuentaPro(); ResultSet listCuentaest = Cuen.consultarCuentaEst(); try { ...
fbbebec7-4e4f-41ff-96f0-354f57619473
7
@Override public void actionPerformed(ActionEvent e) { if (Start.getUserLogStatus()) { statusLbl.setText("You have logged in as " + user.getName()); } if (user.getName() != null && user.getName().length() > 0 && !Start.getUserLogStatus()) { Utils.changeUserLastLogDate...
307fca0d-7f6f-4158-93a3-3cdef1a648b4
1
public void interesting() { if (!this.interesting) { logger.trace("Telling " + this + " we're interested."); this.send(Message.InterestedMessage.craft()); this.interesting = true; } }
774ddbea-1e44-4993-90a2-f26e5c599a74
7
public Value execute(Interpreter machine) throws MyException { if (_operands != null && _operands.size() == 1) { if (_operands.get(0).isNumeral()) { double a = _operands.get(0).execute(machine).doubleValue(); if (a >= 0.0) { result = Math.sqrt(a); ...
fd2e4da8-afeb-4d2c-8718-8c8afada6422
2
public boolean addBuddies(String user, String friend){ PreparedStatement st; Integer rs; String query; if(!checkFriendship(user,friend)){ query="INSERT INTO friends(friend1,friend2) VALUES('"+user+"','"+friend+"')"; try { st = conn.prepareStatement(query); rs = st.executeUpdate(); st.close(); ...
92a72403-9926-426f-ab1f-d69d8486fa0f
4
public String getColumnName(int spaltenNr) { switch (spaltenNr) { case 0: return "ID-Nr"; case 1: return "Username"; case 2: return "Rolle"; case 3: return "Password"; default: return null; } }
68d794d0-221b-47f5-9a4e-fc45f497edc4
8
public void setPosition(double x, double y) { if (this.minX != 0.0 && this.minY != 0.0 && this.maxX != 0.0 && this.maxY != 0.0) { if(x < this.minX) { x = this.minX; } else if(x > this.maxX) { x = this.maxX; } if(y < this.minY) { y = this.minY; } else if(y > this.maxY) { y = this.max...
f6213190-5d0b-4ed7-8a72-48e828a87fcf
8
@SuppressWarnings("unused") public Image scale(Image img) { // Offset the image by one pixel so there's a border around it. // This lets us avoid having to check that A-I are in range of the image before samping them sourceGraphics.drawImage(img, 1, 1, null); int line = width + ...
b68ad971-49c0-4f08-8d1c-47fe191fffc0
6
public List<Location> getAllCompatibleActors(Animal actor) { List<Location> allactors = new LinkedList<Location>(); for(int row = 0; row < depth; row++) { for(int col = 0; col < width; col++) { if(getObjectAt(row, col)!=null) { if(actor.getClass().equals(getObjectAt(row, col).getClass...
9cc18591-c254-4232-8489-4cbaa9a0639b
0
public static void main(String[] args) { System.out.println(0.12345); System.out.println(1.2345E-1); System.out.println(1.2345e-1); }
07209e45-f193-4139-959e-325d4e64eb32
9
public static List<Mensalidade> getListaMensalidade(String nome, Date data){ List<Mensalidade> lista = new ArrayList(); Connection conn = Conexao.getConexao(); PreparedStatement stmt = null; ResultSet rs = null; Mensalidade mens = null; try { ...
995d42ff-ee8c-448e-b81f-b5f6220c9f5e
3
public GeneralRegexNameExtractor(Params params) throws Exception { this.params = params; if (params.name == null) throw new Exception("Name muss definiert werden"); if (params.patterns == null || params.patterns.length == 0) throw new Exception("Es müssen Regex zum Extr...
a9a90b3a-3c11-4938-85a5-24094d598bca
4
public void actionPerformed(ActionEvent event) { String command = event.getActionCommand(); if (command.equals("Exit")) { view.dispose(); System.exit(0); } else if (command.equals("Pause/Continue")) { model.setPause(! model.getPause()); } else if (command.equals("Flip Vertically")) { view.setFlipVer...
be7f7f49-eb12-42ee-aef8-ad99343dfe63
2
public static void reset(Graphics g) throws IncorrectUsageException { Throwable t = new Throwable(); StackTraceElement[] elements = t.getStackTrace(); String className = elements[1].getClassName(); String methodName = elements[1].getMethodName(); //@formatter:off if (!cla...
ba96349a-ae30-48e8-a477-486fe194de06
6
public void actionPerformed(ActionEvent evt) { if (evt.getSource().equals(MENU_PRINCIPAL)) { ModelePanneau.getInstance().setChoix(MENU_PRINCIPAL); } if (evt.getSource() instanceof JButton) { JButton bouton = (JButton) evt.getSource() ; String texte = bouton.getText(); if (texte.equals("Valider"))...
0dd32a4e-1674-41e0-a64a-119269540cfb
7
@Override public int compareTo(OpenHouse o) { double dist = getSuccess() - o.getSuccess(); final SummoningTask summoningTask = script.summoningTask; if (summoningTask != null && summoningTask.branch()) { // Need to recharge pick house with obelisk if (hasObelisk) { if (!o.hasObelisk) { return 1; ...
6ac6a846-4ff3-4af1-83f1-5008f0a9ab52
0
public static void About() { GUI.log("\nCorlanthia is a text adventure game\n\n" + "v" + Game.version + "\n" + "Type 'exit' to go back to the main menu"); }
65f48975-6690-4671-8354-70d3988fc7cd
0
public asset(String id){ super(id); }
fa7d25b7-81ee-4837-a4bb-c0656dda11b1
9
private void pilotJListSelectionChanged(ListSelectionEvent listSelectionEvent) { if(pilotJList.getSelectedIndex() >= 0){ try{ Pilot thePilot = (Pilot)pilotJList.getSelectedValue(); currentData.setCurrentPilot(thePilot); firstNameField.setText((thePilot...
83c2c88d-7193-4851-b507-2f9fdb02e8aa
4
public void fill(int i, int x, int y) { int orig = texture.getRGB(x, y); if(x < texture.getWidth() && y < texture.getHeight() && x >= 0 && y >= 0) { this.spread(i, orig, x, y); } this.repaint(); }
29727cc4-ef91-4bd4-b506-6e085450161b
4
public static boolean isAlphaSpace(String str) { if (str == null) { return false; } int sz = str.length(); for (int i = 0; i < sz; i++) { if ((Character.isLetter(str.charAt(i)) == false) && (str.charAt(i) != ' ')) { ...
24a27805-dc82-4896-9bc5-08138c1dbe03
1
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { text.add("\n"); AnnotationVisitor tav = super.visitAnnotation(desc, visible); if (cv != null) { ((TraceAnnotationVisitor) tav).av = cv.visitAnnotation(desc, visible); } return tav; }
d34060bb-7f9a-49b7-9f89-5b509cb9c501
4
public static void main(String[] args) { MainController coordinator = new MainController(); //set default values for the application boolean testRun = false; int timeBetweenTraces = 3; //check for existing args for(String arg : args){ //run with testdata ? if(arg.equals("testrun")){ testRun = tru...
fb34adee-a18a-4918-a838-07cb9ead5312
6
public static <E> int treeHeight(BinaryTreeNode<E> node) { if(node == null) { return 0; } int leftHeight = treeHeight(node.left); if(leftHeight == -1) { return -1; } int rightHeight = treeHeight(node.right); if(rightHeight == -1) { return -1; } if(leftHeight-rightHeight>1 || leftHeight-rightH...
e327b2ad-808e-4339-9bb1-f6ba578c5b1a
1
@Override public String toString() { return String.format("%s[%s]", getClass().getSimpleName(), (getValue() == null) ? "null" : getValue().toString()); }
7349bfc3-9fef-4658-b59a-f505084de3d7
2
public void disableTicket(Ticket ticket) { if ( !existsTicket(ticket)) { throw new IllegalArgumentException("Ticket from another seance cannot be disabled"); } if (ticket.getStatus() != TicketStatus.ENABLE) { throw new IllegalArgumentException("Cannot disable ticket which is not ENABLED"); }...
00d0042e-83f1-49b1-93b2-22aa92ff63c5
6
public Boolean cadastarNovos(List<Material> materiais) { Boolean sucesso = false; Connection connection = conexao.getConnection(); try { String valorDoComandoUm = comandos.get("cadastarNovos" + 1); String valorDoComandoDois = comandos.get("cadastarNovos" + 2); ...
fd0db69a-42d5-4c4b-af40-754349f1869f
0
public CryptoModuleInfoType getCryptoModuleInfo() { return cryptoModuleInfo; }
1720a5a2-4ecc-4b44-998d-759f6182cb33
1
public Dodgeball(Plugin plug, Location minPoint, Location maxPoint, String name, DodgeballTeam team1, DodgeballTeam team2) { if(minPoint.equals(maxPoint)) { throw new IllegalArgumentException("Arena size is zero!"); } this.area = new CubeSerializable(minPoint, maxPoint); ...
bfcb10f1-72a5-4c6a-8c58-9b863a5cc1f4
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Email other = (Email) obj; if(!(this.getLocal().equals(other.getLocal()))) return false; else if(!this.getDomain().equals(other.getDomain())...
ad5948b5-ee44-4c13-9cbe-d45ae35f3b10
8
private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset, int options ) { // Lots of error checking and exception throwing if( source == null ){ throw new NullPointerException( "Source array was null." ); } // end if ...
b610a716-b07a-4871-946c-8c237a9f1e8d
6
public int[][] initializePathTable(Tile current, int area) { Random r = new Random(); r.nextInt(); Tile tile = uncharted.setCoordinates(current, -area, -area); Tile newTile; int[][] pathTable; int[][] unchartedTable = uncharted.getUncharted(); pathTable = new int[area * 2 + 1][area * 2 + 1]; for (int i ...
1dc0ae56-a5ab-4025-a441-bde30e2049ed
1
private void remSongPLButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_remSongPLButtonActionPerformed //Get selected songs from Current Playlist int[] songs = currentPLList.getSelectedIndices(); //Use indices array to remove from currentList for(int i : s...
149dc055-9d99-4654-82fc-04973f905507
9
public int maxOfMatrix(int row, int col, int N) { int case1=0, case2=0, case3=0, max; if(((col-1) >= 0)&&((row+1)<=N-1)) case1 = maxOfMatrix(row+1, col-1, N); if((row+1)<=N-1) case2 = maxOfMatrix(row+1, col, N); if(((col+1) <= N-1)&&((row+1)<=N-1)) case3 = maxOfMatrix(row+1, col+1, N)...
1a6fa75b-ec63-40fd-a21d-504a35cea274
2
public static List<List<Double>> readData(String option, BufferedReader reader) throws IOException { List<List<Double>> datas = new ArrayList<List<Double>>(); System.out.println(option); String str = ""; while (!(str = reader.readLine()).equals("")) { StringTokenizer token...
4c8b2555-90b1-4703-9dfe-499f23d50888
9
@Override public FactionChangeEvent[] findAbilityChangeEvents(Ability key) { if(key==null) return null; // Direct ability ID's if(abilChangeCache.containsKey(key.ID().toUpperCase())) return abilChangeCache.get(key.ID().toUpperCase()); if(changes.containsKey(key.ID().toUpperCase())) { abilChangeCach...
bf1c5caa-0854-44ba-a146-922b6065ab97
7
private boolean parseExits(Document doc) { NodeList nodes = doc.getElementsByTagName(XmlTag.EDGE_SECTION.toString()); NodeList exits = ((Element)nodes.item(0)).getElementsByTagName(XmlTag.EDGE.toString()); for(int exit_num = 0; exit_num < exits.getLength(); exit_num++) { Item key = null; int x1=-1, y1=-1...
354a4c92-5579-4a93-877b-c45ac8ee2bbd
7
public static Digraph rootedOutDAG(int V, int E) { if (E > (long) V * (V - 1) / 2) throw new IllegalArgumentException("Too many edges"); if (E < V - 1) throw new IllegalArgumentException("Too few edges"); Digraph G = new Digraph(V); SET<Edge> set = new SET<Edge>(); // fix a topological order int[] ve...
b00a0b22-ca79-40c5-971c-d98e26b665eb
3
private boolean IsSampleValid(double[] sample) { int paras = parameterNames.length; for (int i = 0; i < paras; i++) { if (sample[i] < lowBound[i] || sample[i] > upBound[i]) { return false; } } return true; }
df2f978f-5fee-455b-beaf-a6d9176818ce
2
public boolean insertaEquipo(int numeroInveInterInfo, int numInvUnam, String descrip, String modelo, String marca, String serie, String familia, String tipo, String prove, String clase, String uso, String nivel, String edoFisico, String area, String institu, String fecha, String responsable) { ...
3973a61c-e318-4b54-9e7b-4f98e524cca8
1
public void analyzeXPathExpressions(String xpathExpr1, String xpathExpr2){ XPathParser xpathParser = new XPathParser(); Expr transitionExpr1 = xpathParser.parseExpression(xpathExpr1); Expr transitionExpr2 = xpathParser.parseExpression(xpathExpr2); //zeigt an, dass hier kein BPEL-Prozess analysiert wird bpe...
0c48e782-1b98-4f6b-b115-c335ee9ba837
6
static public void main(String args[]) { double x, y; String prefix = null; OSGB osgb = new OSGB(); if (args.length < 2) { /* * Caister Water Tower */ x = 651409.903; y = 313177.271; } else { if (args.length == 2) { Double d; d = new Double(args[0]); x = d.doubleValue(); ...
d7ec0366-34c1-4622-9a7e-c1edc113d70d
4
public static String convertMoveToServerNotation(Board b, Move m) { String serverNotation = ""; try { // Get the piece's letter notation and add it to the return string serverNotation += convertIntToServerChar(b.board[m.start.rank][m.start.file]); // Get the file notation for the start row serverNotatio...
c56973e7-bc03-4f6c-be81-938ed3186d76
8
public void interceptPacket(Packet packet, Session session, boolean incoming, boolean processed) throws PacketRejectedException { if (!processed && packet != null && packet instanceof Message) { if (Configuration.switchPostmanMessage) { String target = packet.getTo().getNode(); if (!userManager...
6dd34585-06e6-475c-99bb-88fb463b6638
7
public Collection<CollectionAndArtist> extractNames(PageInfo info) { String pageHTML = info.getContent(); if (pageHTML == null) { System.out.println("## ERROR could not download '" + info.getURL() + "'"); return new LinkedList<CollectionAndArtist>(); } // Nur bei...
41868795-8f0e-4ecf-82dd-04e354669475
2
public boolean canPlayMonopoly(int playerIndex) { //Checks status, players turn, has player already played dev card, and if the player has a monopoly card if (generalDevCardPreconditions(playerIndex) && serverModel.getPlayers().get(playerIndex).getOldDevCards().getMonopoly() > 0) { return true; } else { ...
c0171802-5d27-4029-9a79-39a32e5a9de7
2
boolean SetDictionarySize(int dictionarySize) { if (dictionarySize < 0) return false; if (m_DictionarySize != dictionarySize) { m_DictionarySize = dictionarySize; m_DictionarySizeCheck = Math.max(m_DictionarySize, 1); m_OutWindow.Create(Math.max(m_DictionarySizeCheck, 4096)); }...
4f60c985-86c6-4a1b-a460-09321e37c3ab
3
public void run() { try { String link = "http://xkcd.com/" + Integer.toString(index); File file = new File("XKCD/" + Integer.toString(index) + ".html"); if(file.exists()) return; URL xkcd = new URL(link); BufferedReader reader = new BufferedReader(new InputStreamReader(xkcd.openStream()))...
6c5cb0a1-6c8b-4973-b0a4-5854f6beec51
9
public void run() { try { boolean running = true; while (running) { try { String line = null; while ((line = _breader.readLine()) != null) { try { _bot.handleLine(line); ...
c21ec351-b6b0-4ecc-b3c3-62105ea0ef4a
9
private JPopupMenu createToolMenu() { final JPopupMenu ret = new JPopupMenu(); ImageIcon publicImg = null, protectImg = null, privateImg = null, packageImg = null, upImg = null, downImg = null; ImageIcon addItemImg = null, delItemImg = null; try { addItemImg = new ImageIcon(ImageIO.read(this.getClass() ...
487945b3-550c-4df2-896c-63a31f76b6c9
3
@Override public void actionPerformed(ActionEvent e) { // Extracts the type of source by typecasting it to JMenuItem. JMenuItem source = (JMenuItem) (e.getSource()); // If menu is selected is the Clear Canvas, // this will clear the canvas and updates status bar. if (s...
1a1f6af8-05f9-4df8-b076-3fe64b4c2788
8
private void buy(String command) { currentCommand = "buy"; String[] commandComps = command.split("\\s+"); if (commandComps.length != 3) { sendToUser("Invalid command"); return; } if (commandComps[0].equalsIgnoreCase("BUY") && commandComps[1].startsWith("<") && commandComps[1].endsWith(">") &...
31b7a9aa-d9cf-4717-9f0e-ce5d63fc3156
6
public boolean setINodeParams(String resource_id, String inode_id, Map<String,String> paramMap) { boolean isUpdated = false; int count = 0; try { while((!isUpdated) && (count != retryCount)) { if(count > 0) { ...
2196de6f-7a77-4c13-a651-e773c3f8a9d9
1
@Override public void putCell(CellState state) { if (this.sealed) { throw new IllegalStateException("sealed memento cannot be altered"); } this.states.add(state); }
cceb68d5-a479-45f3-bcc0-c2754735e8a3
4
public void perform(HttpServletRequest request, HttpServletResponse response) throws ServletException { String jsp = null; UserVO user; String username = request.getParameter("username"); request.setAttribute("username", username); String password = request.getParameter("password");...
fd8eaa7f-73b1-4c44-9775-977322b4030c
2
@Override public List<Order> load(Criteria criteria, GenericLoadQuery loadGeneric, Connection conn) throws DaoQueryException { int pageSize = 50; List paramList = new ArrayList<>(); StringBuilder sb = new StringBuilder(WHERE); String queryStr = new QueryMapper() { @Overr...
1182bb3a-1045-469a-8cee-27eaf2a1396f
4
public void testDajSveZaposlenike(){ Zaposlenik zaposlenik = new Zaposlenik(); Osoba osoba = new Osoba(); osoba.setImePrezime("TestZaposl Test"); osoba.setAdresa("adr"); osoba.setDatumRodjenja(new Date()); zaposlenik.setOsoba(osoba); zaposlenik.setDrzavljanstvo("BiH"); zaposlenik.setEmail("z...
8ac52784-c19b-4407-9b0a-df647762deed
4
public static void circle( double x, double y, double r ) { if ( filling ) { pane.setColor( fillColor ); if ( ellipseMode == 0 ) pane.fillOval( (int) x, (int) y, (int) r, (int) r ); else pane.fillOval( (int) ( x - r / 2 ), (int) ( y - r / 2 ), (int) r, (int) r ); } if ( stroking ) { Graph...
5b02b36f-0e69-44d1-970f-a5ed16857981
1
protected void calcDIR_Attr() { byte[] bTemp = new byte[1]; for (int i = 11;i < 12; i++) { bTemp[i-11] = bytesOfFAT32Element[i]; } DIR_Attr = byteArrayToInt(bTemp); }
ab73efe2-5a25-4873-9a6f-37052fe406ec
4
private boolean selectInterface(){ for (BAPointsPluginInterface pi : pis){ if(pi!=null){ if(pi.getPointPlugin()!=null){ if(pi.getPointPlugin().getName().equalsIgnoreCase(pp)){ this.pi=pi; return true; } } } } return false; }
c3a83678-15fb-4a7c-b4be-79f28ebcaa58
8
void formatBuf( int formatPass, HBuffer fmtBuf) throws HdfException { setFormatEntry( formatPass, true, fmtBuf); // BaseBlk: set blkPos, buf pos // We need to use version 2 to support the // messages: link, link info, group info // Write it out if (formatPass == 1) { if (! isVariable) { hdrM...
587ff9f9-0833-4d17-a8f2-ebd6eb3bc8bf
6
@Override public void mouseReleased(MouseEvent e) { if(e.getSource()==recordBut){ recordBut.setIcon(recordOverIcon); }else if(e.getSource()==playBut){ playBut.setIcon(playOverIcon); }else if(e.getSource()==stopBut){ stopBut.setIcon(stopOverIcon); }else if(e.getSource()==saveBut){ saveBut.setIcon(sa...
3369816e-6918-4dfd-a78c-14a888bbe694
6
@Override public void deserialize(Buffer buf) { super.deserialize(buf); paddockId = buf.readInt(); worldX = buf.readShort(); if (worldX < -255 || worldX > 255) throw new RuntimeException("Forbidden value on worldX = " + worldX + ", it doesn't respect the following conditi...
d8372fb6-9b74-49f4-bd85-424417498664
4
private int assignValue(T item) { int value; switch((String)item) { case "+": value = 1; break; case "-": value = 1; break; case "/": value = 2; break; case "*": value = 2; break; default: value = 0; } return value; }
8c0f622a-ad63-4772-91e8-63bb06f6eba2
9
private static int generateWrapArg(ClassFileWriter cfw, int paramOffset, Class argType) { int size = 1; if (!argType.isPrimitive()) { cfw.add(ByteCode.ALOAD, paramOffset); } else if (argType == Boolean.TYPE) { // wrap boolean va...
7df2b602-4ae8-4ce8-a106-c0eac209bfd7
8
protected void getCounterEvidenceDetail(String title) { if (title != null) { selfCounterevidenceResultList = evidence.getSelfCounterevidence(fileName); for (int i = 0; i < selfCounterevidenceResultList.size(); i++) { if (selfCounterevidenceResultList.get(i).getTitle().equals(title)) { if (!(selfCounter...
39a384ca-c98f-46d3-bba6-fc75be8c852f
4
public double[] NewtonIterate(double i, double j, int mode) { int n = 0; Complex z = new Complex(i, j); Complex old = new Complex(i, j); z = Newt(z, i, j, mode); double hue = 0; double w = 0; while (n < depth && distance(old, z) > rootBoundry) { old = z; z = Newt(z, i, j, mode); if (mandelbro...
33f170d8-5135-4357-b025-92e189288582
2
public void setCurColor(CPColor color) { if (!curColor.isEqual(color)) { artwork.setForegroundColor(color.getRgb()); curColor.copyFrom(color); for (Object l : colorListeners) { ((ICPColorListener) l).newColor(color); } } }
2156e29c-415a-49e8-aca1-3907185be850
7
public final long getTime() { if(_onlineModus) { return System.currentTimeMillis(); } if(_time == -1) { long waitingTime = 0, startTime = System.currentTimeMillis(); long sleepTime = 10; while(waitingTime < CommunicationConstant.MAX_WAITING_TIME_FOR_SYNC_RESPONCE) { try { synchronized(_timeNo...
63e7c6e2-ee62-4d9e-812d-3d1e298dc94e
8
public boolean unpublishCoverage(String workspace, String storename, String layerName) { try { final String fqLayerName; // this null check is here only for backward compatibility. // workspace // shall be mandatory. if (workspace == null) { ...
67629581-8c6c-49a7-84e8-64ec396d4f79
1
@Override public Class<?> getColumnClass(int sarakeIndeksi) { return tyypit[sarakeIndeksi]; }
444e1569-9192-4e3f-af75-eb33171a070d
3
public static int generate(int[] result, int N) { int res = 0; if (result.length == N) { return 1; } else { for (int i=0; i<result.length; i++) { result[N] = i; if (isConsistent(result, N)) res += gener...
cb5b4142-a322-443c-b576-da7380c87d09
6
private boolean shouldIgnoreLine(String line) { if (fluxStack.empty()) return false; Matcher loopMatcher = loopIdentifier.matcher(line); Matcher ifMatcher = ifIdentifier.matcher(line); Matcher endFluxMatcher = (fluxStack.peek().getEndFluxPattern().matcher(line)); Matcher elseMatcher = elseIdentif...
32372979-b3b7-41a1-8d58-a0155ae648ac
9
private int[][] left() {//all numbers will go left and combine when possible int[][] egrid = clone2DArray(grid); for (int yIndex = 0; yIndex < 4; yIndex++) { for (int xIndex = 3; xIndex > 0; xIndex--) { if (egrid[yIndex][xIndex - 1] == 0) { for (int a = xI...
89a05606-7f78-45f3-82bf-c6c07decc72c
3
public void deleteElement(String value) { ListElement previous = head; ListElement current = head.next(); if (previous.getValue().equals(value)) { head = head.next(); count--; } else { while (current != tail.next()) { if (current.getVal...
6dff8aab-75e5-4d4f-ae1a-66981398968b
5
public static String getNextEmail(BufferedReader br) throws Exception { StringBuffer email = new StringBuffer(1024); String nextLine = br.readLine(); if(nextLine == null) { return nextLine; } if(nextLine != null && nextLine.contains("::new email::")) { ...
b226ddce-8e1e-43c8-b725-a464912d3df6
1
public void setWaiting(int c){ lblWaiting.setText(String.valueOf(c)); if(c>0){ lblWaiting.setForeground(Color.RED); }else{ lblWaiting.setForeground(Color.GREEN); } }
437f6024-228a-4a43-af04-7e1fd4d5978a
8
public void divyScore(ScoreTracker score) { if (score.isComplete || !gameOn) { boolean[] owners = new boolean[5]; int max = 1; for (int i = 0; i < score.followers.length; i++) { if (score.followers[i] == max) { owners[i] = true; } else if (score.followers[i] > max) { max = score.followers[i...
4619024d-5665-4536-9268-250fdfabec64
3
public void run() { T current; while (!isInterrupted()) { /* select next thread */ current = queue.getNext(); if ((current != null) && (current.isAlive())) { // moved this to after the priority changes to get complete and relevant readings: // /* Print Log */ // reportThreadSt...
7e688093-bc44-4d4e-89a3-1ebdbde6f379
8
public void propertyChange(PropertyChangeEvent evt) { if(evt.getSource().equals(giocatoriPanel)){ if(evt.getPropertyName().equals("SELEZIONATO")){ attivitaPanel.aggiorna(mioTurno(ultimoAggiornamento, TipoFaseGiocoFamily.F_S_ORARIA), mioTurno(ultimoAggiornamento,TipoFaseGiocoFamily.F_S_ALTERAZIONE_GARA), ...
c70812eb-f1e5-45fb-90b4-7e14c8ccb5c2
2
private void removeSoldOutProducts() { Iterator<Product> iterator = products.iterator(); while (iterator.hasNext()) { if (iterator.next().getStock() == 0) iterator.remove(); } }
ca383ad3-ef4e-4dbe-a3d0-1234b0c5d1a7
5
public void setArmor(String armor) { this.armor = armor; if (armor.compareTo("Light") == 0) CharInfo[3] = 0; else if (armor.compareTo("Medium") == 0) CharInfo[3] = 1; else if (armor.compareTo("Heavy") == 0) CharInfo[3] = 2; else if (armor.compareTo("Advanced") == 0) CharInfo[3] = 3; else if (tra...
d26e28f0-09ba-44e8-9d00-3625808c2a54
8
public void run() { int answer = 0; ArrayList<Integer> listOfAbundants= new ArrayList<Integer>(); ArrayList<Integer> listOfSumOfAllAbundants= new ArrayList<Integer>(); //make an arraylist of all abundant numbers between 1 and 28123 inclusive for (int i = 1; i < 28124; i++){ ...
3fc1aaa1-9c82-4bce-8569-ed6efe2a8fcd
7
public String toString() { String chaine = "this.ensemble_cartes.put(\""+Partie.NOM_CARTE+"\", new Carte(new Tile[][] {{"; int indexCase; Position position; for (int ligne = 0; ligne < this.obtenirHauteur(); ligne++) { for (int colonne = 0; colonne < this.obtenirLargeur(); colonne++) { position = n...
403fe1ce-848c-43c3-913d-d761a0510197
3
private void checkReminder(Calendar cal) { Reminder[] reminders = DBHandler.getAllRiminders(); for (Reminder reminder : reminders) { if (!reminder.isWas_handled()) { if (cal.getTime().after((reminder.getDue_date()))) { sendReminder(reminder); reminder.setWas_handled(true); DBHandler....
caf5534e-cdb9-4e6a-9963-d279aed22eef
2
private void fillFlag(Flag annotation, Parameter parameter) { String shortName = annotation.name(); String longName = annotation.longName(); if (shortName.isEmpty() && longName.isEmpty()) { LabelProvider labelProvider = parameter.getProperty(Properties.LABEL_PROVIDER); ...
a7689d35-63eb-4427-b628-8f8c7387b826
5
@Override public void run(){ ImageIcon iconLogo = new ImageIcon(IMG.getImage(this.mainImg)); this.refLabel.setIcon(iconLogo); while(!super.detener){ try{ if(!this.defensaColaAtaques.isEmpty()&&this.getOcupado()) recib...
9909fa31-e0a6-4439-9d19-7598b379ca18
2
public void visitNewMultiArrayExpr(final NewMultiArrayExpr expr) { for (int i = 0; i < expr.dimensions.length; i++) { if (expr.dimensions[i] == from) { expr.dimensions[i] = (Expr) to; ((Expr) to).setParent(expr); return; } } expr.visitChildren(this); }