method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b8f372dd-6fe1-45b6-874e-4c9fae859969
0
@Override public void onFinish() { }
fa99aaa5-d8e8-4184-9894-57f7aa42ab46
1
public void moveLeft() { if (ducked == false) { speedX = -MOVESPEED; } }
3fb8f4e4-bde6-432f-b6c7-69870876314a
9
@Override public boolean write(DummyObjectList dummyObjects, TileMap tileMap) { try { FileOutputStream f = new FileOutputStream(path); // byte 1: // number of objects f.write((byte)dummyObjects.size()); // byte 2 -> 2+(byte 1)*12 (12 bytes per object) // objects data // DummyObject p; for (int i = 0; i < dummyObjects.size(); i++) { p = (DummyObject)dummyObjects.elementAt(i); // byte 1,2 - code String id = new String(); if (p.name.length() == 1) id = p.name + " "; else id = p.name.substring(0,2); f.write( id.getBytes() ); // byte 3,4 - xpos f.write( (byte)( (int)p.x)); f.write( (byte)( (int)p.x>>8)); // byte 5,6 - ypos f.write( (byte)( (int)p.y)); f.write( (byte)( (int)p.y>>8)); // byte 7...12 (6 byte) f.write((byte)p.additionalData.charAt(0)); f.write((byte)p.additionalData.charAt(1)); f.write((byte)p.additionalData.charAt(2)); f.write((byte)p.additionalData.charAt(3)); f.write((byte)p.additionalData.charAt(4)); f.write((byte)p.additionalData.charAt(5)); } // map array // byte 1,2 w,h int w = tileMap.getWidth(); int h = tileMap.getHeight(); f.write(w); f.write(h); int maxtMsbTile = 0; // next w*h bytes data for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { char tileLsb = (char) tileMap.getTileVal(i, j, 0); char tileMsb = (char) (tileMap.getTileVal(i, j, 0) >> 8); if (tileLsb == 1) tileLsb = 0; //f.write(tile); f.write(tileMsb); f.write(tileLsb); System.out.println( "Original value: " + Integer.toString(tileMap.getTileVal(i, j, 0)) +" Wrote tile: " +" LSB: " + Integer.toString((int)tileLsb) + " MSB: " + Integer.toString((int)tileMsb)); } } // next w*h bytes data for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { char tileLsb = (char) tileMap.getTileVal(i, j, 1); char tileMsb = (char) (tileMap.getTileVal(i, j, 1) >> 8); if (tileLsb == 1) tileLsb = 0; f.write(tileMsb); f.write(tileLsb); } } f.close(); } catch (Exception e) { System.out.println(e.toString()); } return true; }
ce5cac69-f7f6-407d-b803-7d937c1d5d93
8
private static int getMax(String s, int start) { char color = 'x'; int cur; for (cur=start; cur<s.length(); cur++) { char bead = s.charAt(cur); if (bead != 'w') { if (color == 'x') color = s.charAt(cur); else if (bead != color) break; } } color = 'x'; for (; cur<s.length(); cur++) { char bead = s.charAt(cur); if (bead != 'w') { if (color == 'x') color = s.charAt(cur); else if (bead != color) break; } } int ans = cur - start; return Math.min(ans, s.length()/2); }
8c996bf1-a427-4afa-974f-cde006f2fdef
9
public int parseCryptInfo(RdpPacket_Localised data) throws RdesktopException { // logger.debug("Secure.parseCryptInfo"); int encryption_level = 0, random_length = 0, RSA_info_length = 0; int tag = 0, length = 0; int next_tag = 0, end = 0; int rc4_key_size = 0; rc4_key_size = data.getLittleEndian32(); // 1 = 40-Bit 2 = 128 Bit encryption_level = data.getLittleEndian32(); // 1 = low, 2 = medium, 3 = // high if (encryption_level == 0) { // no encryption return 0; } random_length = data.getLittleEndian32(); RSA_info_length = data.getLittleEndian32(); if (random_length != SEC_RANDOM_SIZE) { throw new RdesktopException("Wrong Size of Random! Got" + random_length + "expected" + SEC_RANDOM_SIZE); } this.server_random = new byte[random_length]; data.copyToByteArray(this.server_random, 0, data.getPosition(), random_length); data.incrementPosition(random_length); end = data.getPosition() + RSA_info_length; if (end > data.getEnd()) { // logger.debug("Reached end of crypt info prematurely "); return 0; } // data.incrementPosition(12); // unknown bytes int flags = data.getLittleEndian32(); // in_uint32_le(s, flags); // 1 = // RDP4-style, 0x80000002 = // X.509 // logger.debug("Flags = 0x" + Integer.toHexString(flags)); if ((flags & 1) != 0) { // logger.debug(("We're going for the RDP4-style encryption")); data.incrementPosition(8); // in_uint8s(s, 8); // unknown while (data.getPosition() < data.getEnd()) { tag = data.getLittleEndian16(); length = data.getLittleEndian16(); next_tag = data.getPosition() + length; switch (tag) { case (Secure.SEC_TAG_PUBKEY): if (!parsePublicKey(data)) { return 0; } break; case (Secure.SEC_TAG_KEYSIG): // Microsoft issued a key but we don't care break; default: throw new RdesktopException("Unimplemented decrypt tag " + tag); } data.setPosition(next_tag); } if (data.getPosition() == data.getEnd()) { return rc4_key_size; } else { // logger.warn("End not reached!"); return 0; } } else { // data.incrementPosition(4); // number of certificates int num_certs = data.getLittleEndian32(); int cacert_len = data.getLittleEndian32(); data.incrementPosition(cacert_len); int cert_len = data.getLittleEndian32(); data.incrementPosition(cert_len); readCert = true; return rc4_key_size; } }
1d7da2c6-14d6-4430-aef6-d47fb3b46873
7
public static double getSimilarity(String fileName1, String fileName2)throws IOException { double score=0; HashMap<String, Double> weightmap1 = new HashMap<String, Double>(); HashMap<String, Double> weightmap2 = new HashMap<String, Double>(); ArrayList<String> lines=new ArrayList(); try{ InputStream ips=new FileInputStream(fileName1); InputStreamReader ipsr=new InputStreamReader(ips); BufferedReader br=new BufferedReader(ipsr); String ligne; while ((ligne=br.readLine())!=null){ lines.add(ligne); } br.close(); } catch (Exception e){ System.out.println(e.toString()); } ArrayList<String> mots=new ArrayList(); Double wikc=0.0; for (String ligne:lines){ String mot=ligne.split("\t")[0]; mots.add(mot); Double wik=Double.parseDouble(ligne.split("\t")[1]); weightmap1.put(mot,wik); wikc+=Math.pow(wik,2); } Double r1=Math.sqrt(wikc); lines.clear(); try{ InputStream ips=new FileInputStream(fileName2); InputStreamReader ipsr=new InputStreamReader(ips); BufferedReader br=new BufferedReader(ipsr); String ligne; while ((ligne=br.readLine())!=null){ lines.add(ligne); } br.close(); } catch (Exception e){ System.out.println(e.toString()); } Double wjkc=0.0; Double sumwijk=0.0; for (String ligne:lines){ Double wjk=Double.parseDouble(ligne.split("\t")[1]); String mot=ligne.split("\t")[0]; wjkc+=Math.pow(wjk,2); weightmap2.put(mot,wjk); if(weightmap1.containsKey(mot)) sumwijk+=weightmap1.get(mot)*weightmap2.get(mot); } Double r2= Math.sqrt(wjkc); score=sumwijk/(r1*r2); return score; }
25c64624-192e-46e4-aced-465199ad301a
0
@Override public void deiconifyFrame(JInternalFrame f) { //System.out.println("deiconifyFrame"); super.deiconifyFrame(f); updateDesktopSize(false); }
78c62348-88d2-473a-b3ca-4ebb06fb0319
1
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Persistence.getInstance(); MainWindow frame = new MainWindow(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
8c41c709-9a1b-4d60-ae70-90864658ed50
8
protected List<Integer> getAllPrimes() { boolean[] sito = new boolean[N]; mapa = new int[N]; for (int i = 1; i < sito.length; i++) { sito[i] = true; mapa[i] = 1; } ArrayList<Integer> list = new ArrayList<Integer>(); for (int i = 0; i < sito.length; i++) { if (sito[i]) { int i1 = i + 1; list.add(i1); // mapa se ne dira jer je već označena s 1 int x = 2; int j = (i1 * x); while (j <= N) { sito[j - 1] = false; mapa[j - 1]--;// oduzmemo sve višekratnike x++; j = (i1 * x); } } else if (mapa[i] == -1) { mapa[i] = 2; // postavimo oznaku da se treba ukoniti int i1 = i + 1; // dodamo sve višekratnike for (int j = i1 * 2; j <= sito.length; j += i1) { mapa[j - 1] += 1; } } else if (mapa[i] == 1) { mapa[i] = 3; // postavimo oznaku da se treba dodati int i1 = i + 1; // oduzmemo sve višekratnike for (int j = i1 * 2; j <= sito.length; j += i1) { mapa[j - 1] -= 1; } } // printMap2(i, mapa); } return list; }
e6f6799f-94b2-4acb-bec6-7300edde517b
2
public RegExFind(String args[]) { // Get input from the console String startingPath = ConsoleTools.getNonEmptyInput("Enter starting path: "); String query = ConsoleTools.getNonEmptyInput("Enter Regular Expression: "); String[] fileExtensions = ConsoleTools.getSeriesOfInputs("Enter file extension to match: "); while (fileExtensions.length <= 0) { fileExtensions = ConsoleTools.getSeriesOfInputs("Enter file extension to match: "); } System.out.println(""); // Setup the Crawler DirectoryCrawler crawler = new DirectoryCrawler(); crawler.setFileHandler(new RegExFindFileContentsHandler(query,FileTools.LINE_ENDING_WIN)); crawler.setFileFilter(new FileExtensionFilter(fileExtensions)); crawler.setVerbose(false); // Do the Crawl System.out.println("STARTING..."); int status = crawler.crawl(startingPath); if (status == DirectoryCrawler.SUCCESS) { int totalMatches = ((RegExFindFileContentsHandler) crawler.getFileHandler()).getTotalNumberOfMatches(); System.out.println("Total Matches Found: " + totalMatches); } System.out.println("DONE"); // java -classpath com.organic.maynard.jar com.organic.maynard.RegExFind }
163c3e7f-5857-4c43-9193-4dd7d85a7e32
5
public void setOn(boolean paramBoolean) { if (this.OnImage != null) { if ((paramBoolean) && (!this.On)) { this.On = true; super.setImage(this.OnImage); return; } if ((!paramBoolean) && (this.On)) { this.On = false; super.setImage(this.NormalImage); return; } } else { System.out.println("ImageButton: Attempt to setOn without an onImage."); } }
9b67c31b-5875-4fd6-9588-317b5fe42bd3
1
public static ArrayList<Platform> getPlatformSector(Point p) { if(platformMap.containsKey(p)) { return platformMap.get(p); } else { return new ArrayList<Platform>(); } }
564c0f8d-6a4b-44b5-bc5b-f5b8b5ccb3ec
1
private boolean jj_2_2(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_2(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(1, xla); } }
e12cf1db-d06c-4dd5-a692-792caa8ffec0
3
@Override public String process(String content) throws ProcessorException { pipeline = new SimpleAuthenticationPipeline(); context = new UnAuthorizeContext(); pipeline.setBasic(new LogoutEntryValve()); pipeline.addValve(new DecoderValve()); pipeline.addValve(new ValidationValve()); pipeline.addValve(new UnAuthorizeValve()); pipeline.addValve(new EncodeValve()); pipeline.addValve(new FlushValve()); pipeline.setContext(context); try { pipeline.invoke(context.getRequest(), context.getResponse(), null); } catch (ValveException e) { User user = context.getRequest().getCurrentUser(); String response = ""; if (user == null || user.getUserName() == null) { response = ExceptionWrapper.toJSON(503, "Internal Error"); } else { response = ExceptionWrapper.toJSON(user, e.getCode(), e.getMessage()); } return response; } return context.getResponse().getResponse(); }
616c64a5-dafb-46ae-be4e-ef4bfcf23131
1
public Karel() { this.setTitle("Karel"); initComponents(); InitUI(); Timer Gemupdater = new Timer(49, new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { StepCount.setText("" + world.getStepCount()); GemCount.setText("" + world.getPlayerGem()); // Checking if the current logtext is not the same if (!logText.getText().matches(world.getStepThrough())) { logText.setText(world.getStepThrough()); } } }); Gemupdater.start(); programmerThread = new Thread(); }
12fe1208-b7fe-4e6a-8611-0c4ebf898496
7
public void update() { System.out.println("Updating resultpanel"); hashedFiles = controller.getFiles(); ArrayList<HashedFile> trackTemp = new ArrayList<>(); for(HashedFile hashedFile : hashedFiles){ if(hashedFile.amITracked() && myLocation == 1){ trackTemp.add(hashedFile); } } for(HashedFile hashedFile : hashedFiles){ if(!hashedFile.amITracked() && myLocation == 0){ trackTemp.add(hashedFile); } } String s = ""; for(HashedFile file : trackTemp) { s += file.getFileName() + "\n |\nmd5 --> " + file.getMd5Hash() + "\nsha1 --> " + file.getSha1Hash() + "\nsha256 -->" + file.getSha2Hash() + "\nsha512 --> " + file.getSha5Hash() + "\n\n"; } //resultaatVeld.setText(g); resultaatVeld.setText(s); }
b36e30e2-04ed-4a5f-b86b-53d7093a42f7
5
public ListItem binarySearchArray(String targetItem) { System.out.println("Binary Search for " + targetItem + "."); ListItem currentItem = null; boolean isFound = false; int counter = 0; int low = 0; int high = items.length - 1; while ((!isFound) && (low <= high)) { int mid = Math.round((high + low) / 2); currentItem = items[mid]; if (currentItem.getName().equalsIgnoreCase(targetItem)) { // We found it! isFound = true; return currentItem; } else { // Keep looking. counter++; if (currentItem.getName().compareToIgnoreCase(targetItem) > 0) { // target is higher in the list than the currentItem (at // mid) high = mid - 1; } else { // target is lower in the list than the currentItem (at mid) low = mid + 1; } } } if (isFound) { System.out.println("Found " + targetItem + " after " + counter + " comparisons."); } else { System.out.println("Could not find " + targetItem + " in " + counter + " comparisons."); } return null; }
0c873f49-95e4-4245-ad48-8dcc81cc7d5a
4
public Simulateable findCollidingElement(Simulateable me) { for (PhysicsElement e: elements) if ( e instanceof Simulateable) { Simulateable b = (Simulateable) e; if ((b!=me) && b.collide(me)) return b; } return null; }
0fa5a442-6c92-494a-9432-91f2895166d5
9
void createControlGroup () { /* * Create the "Control" group. This is the group on the * right half of each example tab. It consists of the * "Style" group, the "Other" group and the "Size" group. */ controlGroup = new Group (tabFolderPage, SWT.NONE); controlGroup.setLayout (new GridLayout (2, true)); controlGroup.setLayoutData (new GridData(SWT.FILL, SWT.FILL, false, false)); controlGroup.setText (ControlExample.getResourceString("Parameters")); /* Create individual groups inside the "Control" group */ createStyleGroup (); createOtherGroup (); createSetGetGroup(); createSizeGroup (); createColorAndFontGroup (); if (rtlSupport()) { createOrientationGroup (); } createBackgroundModeGroup (); /* * For each Button child in the style group, add a selection * listener that will recreate the example controls. If the * style group button is a RADIO button, ensure that the radio * button is selected before recreating the example controls. * When the user selects a RADIO button, the current RADIO * button in the group is deselected and the new RADIO button * is selected automatically. The listeners are notified for * both these operations but typically only do work when a RADIO * button is selected. */ SelectionListener selectionListener = new SelectionAdapter () { public void widgetSelected (SelectionEvent event) { if ((event.widget.getStyle () & SWT.RADIO) != 0) { if (!((Button) event.widget).getSelection ()) return; } recreateExampleWidgets (); } }; Control [] children = styleGroup.getChildren (); for (int i=0; i<children.length; i++) { if (children [i] instanceof Button) { Button button = (Button) children [i]; button.addSelectionListener (selectionListener); } else { if (children [i] instanceof Composite) { /* Look down one more level of children in the style group. */ Composite composite = (Composite) children [i]; Control [] grandchildren = composite.getChildren (); for (int j=0; j<grandchildren.length; j++) { if (grandchildren [j] instanceof Button) { Button button = (Button) grandchildren [j]; button.addSelectionListener (selectionListener); } } } } } if (rtlSupport()) { rtlButton.addSelectionListener (selectionListener); ltrButton.addSelectionListener (selectionListener); defaultOrietationButton.addSelectionListener (selectionListener); } }
90649369-c8b8-4a15-a5cf-965810b2dcfb
4
private void initialiseRandom() { int N = (int)(double)network.params.get("N"); double p = (double)network.params.get("p"); IndividualNetworkAgent[] vertices = new IndividualNetworkAgent[N]; for (int i = 0; i < N; i++) { IndividualNetworkAgent v = new IndividualNetworkAgent( network.getNewNodeId() ); vertices[i] = v; network.addVertex( v ); } for (int i = 0; i < (N-1); i++) { for (int j = (i+1); j < N; j++) { double x = ( IndividualBasedModel.getRandom() ).getDouble(); if (x < p) { Edge e = new Edge(vertices[i], vertices[j]); network.addEdge(e, vertices[i], vertices[j]); } } } }
19b443ea-c1bb-4ad5-947b-fb3bcb8b45f9
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Movie movie = (Movie) o; if (director != null ? !director.equals(movie.director) : movie.director != null) return false; if (name != null ? !name.equals(movie.name) : movie.name != null) return false; if (rating != null ? !rating.equals(movie.rating) : movie.rating != null) return false; return true; }
30713cc8-e75f-4f5a-b017-98e193060a99
3
public List<Horario> pesquisaHorariosProfessor(String matriculaProf) throws ProfessorInexistenteException { List<Horario> horarioDoProfessor = new ArrayList<Horario>(); boolean flag = false; for (Professor prof : this.professores) { if (prof.getMatricula().equals(matriculaProf)) { horarioDoProfessor = prof.getHorarios(); flag = true; break; } } if (flag == false) { throw new ProfessorInexistenteException("Professor Inexistente !!!"); } return horarioDoProfessor; }
ede5f4b4-9128-4665-8551-d759ca1219db
7
@Override public void actionPerformed(ActionEvent e) { //System.out.println("HomeAction"); OutlinerCellRendererImpl textArea = null; boolean isIconFocused = true; Component c = (Component) e.getSource(); if (c instanceof OutlineButton) { textArea = ((OutlineButton) c).renderer; } else if (c instanceof OutlineLineNumber) { textArea = ((OutlineLineNumber) c).renderer; } else if (c instanceof OutlineCommentIndicator) { textArea = ((OutlineCommentIndicator) c).renderer; } else if (c instanceof OutlinerCellRendererImpl) { textArea = (OutlinerCellRendererImpl) c; isIconFocused = false; } // Shorthand Node node = textArea.node; JoeTree tree = node.getTree(); OutlineLayoutManager layout = tree.getDocument().panel.layout; //System.out.println(e.getModifiers()); switch (e.getModifiers()) { case 0: if (isIconFocused) { if (tree.getSelectedNodes().size() > 1) { changeSelectionToNode(tree, layout); } else { changeFocusToTextArea(node, tree, layout); } } else { home(node, tree, layout); } break; } }
ca191921-23dc-4d04-812b-d49f705aa36a
0
public void setCap(String cap) { this.cap = cap; }
dd7b8882-606e-4c28-bb8f-a23fcb22f8a4
0
public Location randomAdjacentLocation(Location location) { List<Location> adjacent = adjacentLocations(location); return adjacent.get(0); }
ece10800-b6e9-4e20-ab85-c264fd4f8efd
3
private void free() { if (pane != null) { coords = block.getCoords(); for (Point p : coords) { if (pane.insertAt().x != -1) { pane.cell(maxFall.y + p.y, location.x + p.x).Clear(); } pane.cell(location.y + p.y, location.x + p.x).Clear(); } } }
d1c18b6f-8656-49d0-ad16-60e98190f094
3
public void addRoll(int pins) { rolls.add(newRoll(pins)); if(rolls.size() == 2){ if(isSpare() || isStrike()) this.MAX_ROLL++; } }
0868eee9-708b-4fa5-ab20-8444da4fc1c1
7
private void jButtonAddUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddUsuarioActionPerformed // TODO add your handling code here: if(jTextFieldCod.getText() == null || jTextFieldCod.getText().equals("")){ jLabelErro.setErrorText(WORDS.getString("ERRO-CODIGO")); }else if(jTextFieldNome.getText() == null || jTextFieldNome.getText().equals("")){ jLabelErro.setErrorText(WORDS.getString("ERRO-NOME")); }else if(jTextFieldCod.getText().contains("-")){ jLabelErro.setErrorText(WORDS.getString("ERRO-POSITIVO")); }else if(jTextFieldSenha.getPassword().length < 4){ jLabelErro.setErrorText(WORDS.getString("ERRO-SENHA")); }else{ try { banco.addUsuario(jTextFieldCod.getText(), jTextFieldNome.getText(), jTextFieldSenha.getPassword()); jLabelErro.setSuccessText(WORDS.getString("USUARIO")+jTextFieldNome.getText()+WORDS.getString("MSG-ADICIONADO")); } catch (SQLException ex) { jLabelErro.setErrorText(ex.getMessage()); } } }//GEN-LAST:event_jButtonAddUsuarioActionPerformed
57cf08fb-76f5-4b53-bace-cb6f4a9c036f
2
public void unloadHUD(String n) { HUD hud = null; //start from the top and work our way down to "layer" the huds for (int i = (huds.size() - 1); i >= 0; i--) { hud = huds.get(i); if (hud.getName().equals(n)) { hud.shouldRender = false; hud = null; huds.remove(i); } } }
ee5136f6-8c4e-40a2-9c3f-b99121173a86
0
public void setContract(String contract) { this.contract = contract; }
ed1ea137-73dc-4fdd-9717-1f3fb8f396fa
4
public static void main(String[] args) { HashMap<String, String> test_map = new HashMap<String, String>(); test_map.put("1", "test1"); test_map.put("2", "test2"); test_map.put("3", "test3"); test_map.put("4", "test4"); Set mapset = test_map.entrySet(); Iterator iterator = mapset.iterator(); while(iterator.hasNext()) { Map.Entry mapentry = (Map.Entry)iterator.next(); String key = mapentry.getKey().toString(); String value = mapentry.getValue().toString(); System.out.printf("key: %s value:%s\r\n", key, value); } System.out.printf("***************deleting************\r\n"); Iterator<Map.Entry<String, String>> it = test_map.entrySet().iterator(); while(it.hasNext()) { Map.Entry<String, String> entry= it.next(); String key= entry.getKey(); int k = Integer.parseInt(key); if(k%2==1) { System.out.printf("delete key:%s value:%s\r\n", key, entry.getValue()); it.remove(); //OK } } System.out.printf("***************result************\r\n"); iterator = mapset.iterator(); while(iterator.hasNext()) { Map.Entry mapentry = (Map.Entry)iterator.next(); String key = mapentry.getKey().toString(); String value = mapentry.getValue().toString(); System.out.printf("key: %s value:%s\r\n", key, value); } }
1e36775a-f744-408b-9833-f2c4fba218a9
2
public void testAddPeriodConverterSecurity() { if (OLD_JDK) { return; } try { Policy.setPolicy(RESTRICT); System.setSecurityManager(new SecurityManager()); ConverterManager.getInstance().addPeriodConverter(StringConverter.INSTANCE); fail(); } catch (SecurityException ex) { // ok } finally { System.setSecurityManager(null); Policy.setPolicy(ALLOW); } assertEquals(PERIOD_SIZE, ConverterManager.getInstance().getPeriodConverters().length); }
38a679f0-f0a5-4f63-ad94-06ada2fb17e0
2
public boolean isInfinite() { return Double.isInfinite(x) || Double.isInfinite(y) || Double.isInfinite(z); }
b7b1c6b0-c820-468e-8552-3ec7ab153158
9
@Override public int compare(String t1, String t2) { int result; switch (type) { case SERVER: Server s1 = Preferences.getInstance().getServer(t1); Server s2 = Preferences.getInstance().getServer(t2); // If both are enabled, sort by name if (s1.isEnabled() && s2.isEnabled() || (!s1.isEnabled() && !s2.isEnabled())) { result = t1.compareToIgnoreCase(t2); } else if (s1.isEnabled() && !s2.isEnabled()) { result = -1; } else // if(!s1.isEnabled() && s2.isEnabled()) { result = 1; } break; case LOG: result = t1.compareTo(t2); break; case FILTER: result = t1.compareTo(t2); break; default: result = 0; } return result; }
1f46726a-bdd9-4757-b810-0ff6ba783a70
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!(affected instanceof MOB)) return true; final MOB mob=(MOB)affected; // when this spell is on a MOBs Affected list, // it should consistantly prevent the mob // from trying to do ANYTHING except sleep if(msg.amISource(mob)) { switch(msg.sourceMinor()) { case CMMsg.TYP_ENTER: case CMMsg.TYP_ADVANCE: case CMMsg.TYP_LEAVE: case CMMsg.TYP_FLEE: if(mob.location().show(mob,null,CMMsg.MSG_OK_ACTION,L("<S-NAME> struggle(s) against the ensnarement."))) { amountRemaining-=mob.phyStats().level(); if(amountRemaining<0) unInvoke(); } return false; } } return super.okMessage(myHost,msg); }
c5f43cca-ad1b-4815-9b53-e2859df8b0b8
9
public long get(int desde, int hasta) { pasos++; if(flag) propagar(setValue); if(desde==cotaDesde&&hasta==cotaHasta) return value; if(izq!=null&&izq.cotaDesde<=desde&&izq.cotaHasta>=hasta) return izq.get(desde, hasta); else if(der!=null&&der.cotaDesde<=desde&&der.cotaHasta>=hasta) return der.get(desde, hasta); else { //CHANGE FUNCTION return izq.get(desde, izq.cotaHasta)+der.get(der.cotaDesde, hasta); } }
2e91bafc-8ef7-4161-8c9f-9824b80f6a1c
9
public Creep findCreep() { if (locked && lastCreep != null && tower.getContext().getCreeps().contains(lastCreep) && lastCreep.isValidTarget()) { float distanceMin = tower.getRange() * tower.getRange(); float dX = (lastCreep.getX() + Grid.SIZE / 2) - (tower.getGrid().getLocation()[0] + Grid.SIZE / 2); float dY = (lastCreep.getY() + Grid.SIZE / 2) - (tower.getGrid().getLocation()[1] + Grid.SIZE / 2); // squared distance float dist = dX * dX + dY * dY; if (dist < distanceMin) { return lastCreep; } } lastCreep = null; Creep found = null; int size = tower.getContext().getCreeps().size(); float distance = 99999f; float distanceMin = tower.getRange() * tower.getRange(); for (int i = 0; i < size; i++) { if (tower.getContext().getCreeps().get(i).isValidTarget()) { float dX = (tower.getContext().getCreeps().get(i).getX() + Grid.SIZE / 2) - (tower.getGrid().getLocation()[0] + Grid.SIZE / 2); float dY = (tower.getContext().getCreeps().get(i).getY() + Grid.SIZE / 2) - (tower.getGrid().getLocation()[1] + Grid.SIZE / 2); // squared distance float dist = dX * dX + dY * dY; if (dist < distanceMin && dist < distance) { distance = dist; found = tower.getContext().getCreeps().get(i); } } } lastCreep = found; return found; }
16b77025-c637-41e5-8360-cf2f13fc3237
6
public static void addByChance(LivingEntity entity, MobAbilityConfig ma) { if (ma == null || entity instanceof Creeper == false) return; if (ma.chargedRate <= 1.0 && ma.chargedRate != 0.0) { // If the random number is lower than the angry chance we make shit angry if (ma.chargedRate == 1.0F || RandomUtil.i.nextFloat() < ma.chargedRate) { ability.addAbility(entity); } } }
e83ab7b2-3876-4652-a83b-406b0f4510ba
5
public Matrix inverse() { if(!isInvertable()) throw new IllegalArgumentException("Cannot invert matrix"); Matrix inv = new Matrix(numRows, numColumns); if(numRows == 1) { inv.set(0, 0, 1 / elements[0][0]); return inv; } float det = getDeterminant(); for(int i = 0; i < numRows; i++) { for(int j = 0; j < numColumns; j++) { float sign = (i + j) % 2 == 0 ? 1 : -1; float minor = getExcludedMatrix(i, j).getDeterminant(); inv.elements[j][i] = sign * minor / det; } } return inv; }
b782cd36-7ca0-4caf-a828-afc8db6918cd
0
@XmlTransient public Collection<Paciente> getPacienteCollection() { return pacienteCollection; }
f701cf52-4fa4-4dcf-b396-52ea9ced9cd9
0
public void execute() { receiver.turnOff(); }
5c46b15f-640e-45dd-bb4d-e07135c12976
2
public ClassAnalyzer getInnerClassAnalyzer(String name) { /** require name != null; **/ int innerCount = inners.length; for (int i = 0; i < innerCount; i++) { if (inners[i].name.equals(name)) return inners[i]; } return null; }
aea8fd74-c730-4363-ac03-cb92afd8776a
3
@Override public void update(final Observable o, final Object arg) { if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { update(o, arg); } }); return; } if (o instanceof Modele) { this.getContentPane().remove(score); this.getContentPane().remove(grid); this.getContentPane().remove(pieces); Modele plateau = (Modele) o; updateGrid(plateau); score.setScore(plateau.getScore(),plateau.getNbLignes()); if (plateau.getFin()){ this.getContentPane().add(gameOver,BorderLayout.CENTER); this.getContentPane().add(score, BorderLayout.SOUTH); this.setVisible(true); this.getContentPane().repaint(); } else { this.getContentPane().add(score, BorderLayout.WEST); this.getContentPane().add(grid, BorderLayout.CENTER); this.getContentPane().add(pieces, BorderLayout.EAST); this.getContentPane().repaint(); } } }
dbf661e5-ebe8-4a54-8427-b5e9938e37e2
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Address other = (Address) obj; if (ipAddress == null) { if (other.ipAddress != null) return false; } else if (!ipAddress.equals(other.ipAddress)) return false; if (tcpPort != other.tcpPort) return false; return true; }
362d6bc1-4df4-42db-9aad-d4634ebb128b
6
@Override public boolean accept( File file ) { if ( file.exists() ) { if (file.isDirectory() ) return true; if ( !file.isFile() ) return false; } if ( exts == null ) return true; String filename = file.getName(); for (int i=0; i < exts.length; i++) { if ( filename.endsWith(exts[i]) ) return true; } return false; }
664f4a1f-b661-4cc6-85ba-6546bc522628
4
private LynkStaticIntelliHints(JTextField textField, List<?> items, int comboBoxNum) { super(textField, comboBoxNum); this.items = items; textField.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); if(SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) { model.removeAllElements(); for(Object item: LynkStaticIntelliHints.this.items) { model.addElement(item); } setPopupVisible(true); } } }); }
89391994-76ae-4419-8594-fd6caef491a2
4
@Override public byte[] getData() { if (ptr != 0) { return null; } else { if (isConstant()) { if (length > getMaxSizeOf32bitArray()) return null; byte[] out = new byte[(int) length]; for (int i = 0; i < length; i++) { out[i] = data[0]; } return out; } else { return data; } } }
bb12f526-c5a2-42d6-978f-bbcdf253d171
6
public static void main(String args[]) throws Exception{ /* 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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(PruebaPlato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(PruebaPlato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(PruebaPlato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(PruebaPlato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new PruebaPlato().setVisible(true); } }); }
62750026-55b2-4caa-b9ab-7a5075a6864e
4
@Override public void execute() { seq(new EflSelectPcMonOperationSegment(PC_MON_DEPOSIT)); seqSample(() -> { int numMons = curGb.readMemory(curGb.pokemon.numPartyMonAddress); for (int i = 0; i < numMons; i++) { int curMon = curGb.readMemory(curGb.pokemon.numPartyMonAddress + i + 1); if (curMon == mon) { monGoalPosition = i; break; } } if (monGoalPosition == -1) throw new IllegalStateException("Mon " + mon + " not found."); }); if (monGoalPosition <= 2) seqEflScrollFastAF(monGoalPosition); else seqEflScrollFastA(monGoalPosition); seqEflButton(A, PRESSED); // deposit seq(new EflSkipTextsSegment(1)); // stored in box }
0741a32f-b490-4282-bdef-d25a29c0725c
9
private String doExportString( String text ) { Matcher localMatcher = LOCALHOST_REGEX.matcher( text ); if ( localMatcher.matches() ) { return localMatcher.group( 1 ) + host_ + localMatcher.group( 3 ); } else if ( exportFiles_ && FILE_REGEX.matcher( text ).matches() ) { try { URL fileUrl = new URL( text ); String path = fileUrl.getPath(); if ( File.separatorChar != '/' ) { path = path.replace( '/', File.separatorChar ); } File file = new File( path ); if ( file.canRead() && ! file.isDirectory() ) { URL expUrl = UtilServer.getInstance() .getMapperHandler() .addLocalUrl( fileUrl ); if ( expUrl != null ) { return expUrl.toString(); } } } catch ( MalformedURLException e ) { // not a URL at all - don't attempt to export it } catch ( IOException e ) { // something else went wrong - leave alone } return text; } else { return text; } }
f672ec22-301f-4dca-a5e7-b2374325d6d1
9
public static Stack<MrUrl> buildJobs() { Stack<MrUrl> jobStack = new Stack<MrUrl>(); Logger log = null; try { Properties PropertyHandler = new Properties(); PropertyHandler.load(new FileInputStream(propertiesMain)); String logPath = PropertyHandler.getProperty("logPath"); PropertyConfigurator.configure(new FileInputStream(logPath)); log = Logger.getLogger(MrMestri.class.getName()); Connection postgresConn = MrPostgres.getPostGresConnection(); String dbTables = PropertyHandler.getProperty("dbTables"); Properties dbTablesPropertyHandler = new Properties(); dbTablesPropertyHandler.load(new FileInputStream(dbTables)); log.info("db tables property file loaded"); if (postgresConn == null) { log.error("Postgres connection object could not be instantiated"); } else { log.info("Connection object to postgres created successfully"); } /* * This is the logic that builds the jobs based on the number of * authorized apps */ int numberOfSearchQueries = Integer.parseInt(PropertyHandler .getProperty("numberOfAccounts")); int totalSearchQueries = numberOfSearchQueries * Integer.parseInt(PropertyHandler .getProperty("numberOfSearchQueries")); int perTrendCalls = (int) (totalSearchQueries / Integer .parseInt(PropertyHandler.getProperty("totalTrends"))); log.info("Building the stack of jobs"); for (int jobPerTrends = 0; jobPerTrends < perTrendCalls; jobPerTrends++) { String selectTrends = "SELECT id,trend,date from " + dbTablesPropertyHandler.getProperty("trends") + " where date = '" + Utilities.getCurrentDate() + "'"; PreparedStatement stmt = postgresConn .prepareStatement(selectTrends); ResultSet rs = stmt.executeQuery(); if (rs == null) { log.error("Was unable to fetch trends for the date" + Utilities.getCurrentDate() + " , something has gone wrong "); } else { while (rs.next()) { /* * type casting the object to UUID bad programming */ UUID id = (UUID) rs.getObject(1); String trend = rs.getString(2); String searchUrl = PropertyHandler .getProperty("searchUrl"); trend = URLEncoder.encode(trend, "ISO-8859-1"); searchUrl = searchUrl + trend + "&lang=en"; URL searchURL = new URL(searchUrl); MrUrl urlObj = new MrUrl(searchURL, id); jobStack.push(urlObj); } } } postgresConn.close(); } catch (FileNotFoundException e) { log.error("Properties file path error"); } catch (IOException e) { log.error(e.getMessage()); } catch (ParseException e) { log.error("Error while parsing the date"); } catch (SQLException e) { log.error(e.getMessage()); } catch (NumberFormatException e) { e.printStackTrace(); } return jobStack; }
99572607-374a-435b-ae35-9589a907e577
7
private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked if ( this.card != null && !this.card.isMatched() && this.card.isPlayable() ) { // Set the clicked card as selected. game.setSelected(game.selectCard(this.card)); // Check if there is already another card selected if ( game.getSelectedCard1() != null && game.getSelectedCard2() != null ) { // Check the selected cards create a match if ( game.checkMatch(game.getSelectedCard1(), game.getSelectedCard2()) ) { // Get the current instance of the GUI. GUI thisGui = (GUI) SwingUtilities.windowForComponent(this); // Update the GUI to remove matched cards. thisGui.drawCardGrid(); } // Clear the highlight on the card. if ( GUI.selected != null ) { GUI.selected.deselect(); } } else { // Sets this card as the selected one and sets higlighting on. GUI.selected = this; this.setHighlighted(); } } game.notifyObservers(); }//GEN-LAST:event_formMouseClicked
b6280d10-2f2c-4b84-9ca9-bfa701355658
7
public int Connect() { System.out.println(Adapter_to_config.getInstance().GetActiveConnect()); if(ourInstance.log_reader != null && ourInstance.log_reader.IsConnected() && !conected_to.equals(Adapter_to_config.getInstance().GetActiveConnect())) Disconnect(); if(ourInstance.log_reader == null || !ourInstance.log_reader.IsConnected()) log_reader = new Log_reader( Adapter_to_config.getInstance().GetActiveConnect().split("<div>")[1], Adapter_to_config.getInstance().GetActiveConnect().split("<div>")[2], Adapter_to_config.getInstance().GetActiveConnect().split("<div>")[3] ); if(ourInstance.log_reader != null && ourInstance.log_reader.IsConnected()) conected_to = Adapter_to_config.getInstance().GetActiveConnect(); else conected_to = ""; return 0; }
6e57a55b-e862-4bd2-9a64-36d59532331b
0
public String toString() { return " at " + this.index + " [character " + this.character + " line " + this.line + "]"; }
a06cb03a-23cc-40cc-84d2-f491f2bab6ff
3
private int pickFruit() { // generate a prefix sum int[] prefixsum = new int[FRUIT_NAMES.length]; prefixsum[0] = currentFruits[0]; for (int i = 1; i != FRUIT_NAMES.length; ++i) prefixsum[i] = prefixsum[i-1] + currentFruits[i]; int currentFruitCount = prefixsum[FRUIT_NAMES.length-1]; // roll a dice [0, currentFruitCount) int rnd = random.nextInt(currentFruitCount); for (int i = 0; i != FRUIT_NAMES.length; ++i) if (rnd < prefixsum[i]) return i; assert false; return -1; }
1ceaeb23-a767-4311-962f-42fc66582bc3
1
public void disconnect() { for (ConnectionProcessor pipe : pipes) { pipe.disconnect(); } }
62f194a0-7927-4d30-98a0-03d0f8f1faca
1
private void batch() { for (int r=0; r<RUNS; r++) { TIME = System.nanoTime(); createFht(); insert(); fht.prune(); System.out.println(fht.toString()); get(); System.gc(); TIME = mem(TIME); } }
1cc24584-5b23-4c12-912b-b6c599b364aa
8
@Override public void update(GameContainer gc, int DELTA) throws SlickException { Input input= gc.getInput(); level.Update(DELTA, x, y); if(input.isKeyDown(Input.KEY_LEFT) && x < 0) x+=4; if(input.isKeyDown(Input.KEY_RIGHT) && x > -768) x-=4; if(input.isKeyDown(Input.KEY_DOWN) && y > - 512) y-=4; if(input.isKeyDown(Input.KEY_UP) && y < 0) y+=4; System.out.println(x + " | " + y); }
8586f31b-07e8-4a8b-96ea-a4261ae54d47
1
public static void spawnZombieGiant (Location loc, int amount) { int i = 0; while (i < amount) { Giant giant = (Giant) loc.getWorld().spawnEntity(loc, EntityType.GIANT); giant.setHealth(100); giant.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 2147483647, 3)); i++; } }
e5e7d7f7-a267-492a-9de0-82cc4ac3a46d
6
@SuppressWarnings("unchecked") private Map<OrderPreviewField, String> getMarketPreviewOrderPaths(Document doc) throws UtilityException { Map<OrderPreviewField, String> toReturn = new HashMap<OrderPreviewField, String>(); for (OrderPreviewField f : OrderPreviewField.values()) { String path = f.getPath(); if (f.equals(OrderPreviewField.ERROR)) { if (path != null) { List<DefaultElement> list = doc.selectNodes(path); for (Iterator<DefaultElement> iter = list.iterator(); iter.hasNext();) { DefaultElement attribute = iter.next(); String url = attribute.getText(); throw new UtilityException(url); } } } if (path != null) { List<DefaultElement> list = doc.selectNodes(path); for (Iterator<DefaultElement> iter = list.iterator(); iter.hasNext();) { DefaultElement attribute = iter.next(); String url = attribute.getText(); toReturn.put(f, url); } } } return toReturn; }
bde5f2b4-5748-410b-813e-1085870bf01c
2
public void addLast(Item item) { if (item == null) throw new NullPointerException(); if (isEmpty()) addFirst(item); else { Node<Item> node = new Node<Item>(); node.item = item; node.prev = last; last.next = node; node.next = null; last = node; size++; } }
f4436fb8-c4aa-4988-acfd-a78bdb51aec2
9
private boolean checkTextFields() { if(firstnameField.getText().length() == 0 || lastnameField.getText().length() == 0 || emailField.getText().length() == 0 || addressField.getText().length() == 0 || cityField.getText().length() == 0 || stateField.getText().length() == 0 || zipField.getText().length() == 0 || homephoneField.getText().equals("( ) - ") || cellphoneField.getText().equals("( ) - ")) { JOptionPane.showMessageDialog(this, "Please fill out all boxes before submitting the data.", "Incomplete Form", JOptionPane.WARNING_MESSAGE); return false; } return true; }
ef92ff91-6e0b-4fe0-9c0d-fd34ae43185f
1
private static void initBilinear(Composite inComposite, int heightHint) { final Composite toolbar = new Composite(inComposite, SWT.BORDER); final Composite imageContainer = new Composite(inComposite, SWT.BORDER); GridData toolbarGridData = new GridData(GridData.FILL_HORIZONTAL); toolbarGridData.grabExcessHorizontalSpace = true; toolbar.setLayoutData(toolbarGridData); final Text txt = new Text(toolbar, SWT.BORDER); txt.setText("1.5"); toolbar.setLayout(new GridLayout(2, false)); Button button = new Button(toolbar, SWT.PUSH); button.setText("Scale (Bilinear)"); button.setBounds(0, 0, 100, 30); button.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1)); button.addListener(SWT.MouseDown, new Listener() { public void handleEvent(Event event) { float tx = 1.5f; try { tx = Float.parseFloat(txt.getText()); } catch (Exception e) { e.printStackTrace(); } bilinear(tx); ImageUtils.paintImage(new GC(imageContainer), bilinear, bilinearHisto); } }); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.grabExcessHorizontalSpace = true; gridData.heightHint = original.getImageData().height*3+20; imageContainer.setLayoutData(gridData); imageContainer.addListener(SWT.Paint, new Listener() { public void handleEvent(Event event) { ImageUtils.paintImage(event.gc, bilinear, bilinearHisto); } }); }
d6d7ee7b-7945-4ff4-9593-e17bde9daf62
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Room target=mob.location(); if(target==null) return false; if(target.fetchEffect(ID())!=null) { mob.tell(L("This place is already under a blessing of mercy.")); return false; } if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficiencyCheck(mob,0,auto); if(success) { final CMMsg msg=CMClass.getMsg(mob,target,this,verbalCastCode(mob,target,auto),auto?"":L("^S<S-NAME> @x1.^?",prayWord(mob))); if(mob.location().okMessage(mob,msg)) { mob.location().send(mob,msg); mob.location().show(mob,null,CMMsg.MSG_OK_VISUAL,L("The Blessing of mercy rises over <S-NAME>.")); if(CMLib.law().doesOwnThisLand(mob,target)) { target.addNonUninvokableEffect((Ability)this.copyOf()); CMLib.database().DBUpdateRoom(target); } else beneficialAffect(mob,target,asLevel,0); } } else return beneficialWordsFizzle(mob,target,L("<S-NAME> @x1 for the blessing of Mercy, but <S-HIS-HER> plea is not answered.",prayWord(mob))); // return whether it worked return success; }
6668c4ce-16c2-4615-b1ea-f1f4be858e7e
4
public void kornErntenUndVerteilen() { int anzahlFelder = zaehleGebaeude( 1 ); int anzahlKornkammern = zaehleGebaeude( 3 ); int maxLagerMengeInKornkammer = new Kornkammer().getMaxLagermenge(); int ernteMitDuenger = 0; int benoetigteKornkammern = 0; int ernte = anzahlFelder * new Feld().getKornProRunde(); if ( this.getDuenger() >= ernte ) { ernteMitDuenger = ernte * 2; } else if ( this.getDuenger() < ernte ) { ernteMitDuenger = ernte + this.getDuenger(); } this.korn = this.korn + ernteMitDuenger; if ( this.duenger - ernte < 0 ) { this.duenger = 0; } else { this.duenger = this.duenger - ernte; } benoetigteKornkammern = (int) ( this.korn / maxLagerMengeInKornkammer ); if ( anzahlKornkammern < benoetigteKornkammern ) { int kornInnerhalbDerKornkammern = anzahlKornkammern * maxLagerMengeInKornkammer; int kornAusserhalbDerKornkammern = this.korn - kornInnerhalbDerKornkammern; this.korn = this.korn - ( kornAusserhalbDerKornkammern / 2 ); } }
f5a412fc-1a81-47b1-b8ea-7eaba702cd7a
1
public void fixContainer(Role container){ if(this.container == null){ this.container = container; } else { System.out.println("erreur de logique 1"); } }
cbb3c28d-bd08-487f-80a2-52c0ee88d188
6
public List<List<SetCard>> findMatches() { //don't even bother if there aren't enough cards if (cards.size() < 3) { return null; } /* * iterate through all of the cards, getting all possible permutations * of SetCards... */ for (int i = 0; i < cards.size(); i++) { SetCard card1 = cards.get(i); for (int j = 1; j < cards.size(); j++) { SetCard card2 = cards.get(j); for (int k = 2; k < cards.size(); k++) { SetCard card3 = cards.get(k); //...and adding them to a temporary HashSet. LinkedHashSet<SetCard> tempCardSet = new LinkedHashSet<SetCard>(); tempCardSet.add(card1); tempCardSet.add(card2); tempCardSet.add(card3); //check that there aren't any duplicates if (tempCardSet.size() == 3) { //convert back to List if check passes List<SetCard> tempList = new LinkedList<SetCard>(tempCardSet); /* * if the cards are a set, add them to results * and remove them from the master list of cards, * so that they're not used again */ if (isSet(tempList)) { matches.add(tempList); cards.removeAll(tempList); } } } } } return matches; }
ad410311-a06c-4349-9797-fd33049dfeb0
1
public void save() { input = "@Input:"; if(chckbxIntegersOnly.isSelected()) input += "true"; else input += "false"; }
006a8b23-2a91-41a5-8f60-3b048cfc42da
7
public static boolean loadMapsFromConfig(){ maps.clear(); String mapNames = PKSQLd.getUnparsedData(";ALLMAPNAMES;"); if(mapNames == null || mapNames.length() == 0) return false; String[] split = mapNames.split(";"); if(split.length == 0) return false; for(String s : split){ if(!s.equals("")){ String retrieved = PKSQLd.getUnparsedData("map|" + s); Map newMap = getMapFromString(retrieved); if(newMap == null){ System.out.println("A MAP HAS NOT BEEN CREATED BECAUSE IT WAS INCORRECTLY BUILT. PROBLEMS AAARE HAPPENING!!"); }else maps.add(newMap); } }if(maps.size() > 0) return true; else return false; }
2cc55577-2829-4b6a-bab7-61f8e93e72af
4
private static boolean rightOrder(String one, String two) { for(int i = 0; i < Math.min(one.length(), two.length()); i++) { char onechar = one.charAt(i); char twochar = two.charAt(i); if(onechar > twochar) return false; else if(twochar > onechar) return true; } return (one.length() > two.length()) ? false : true; }
6c507ef8-f59f-4555-a54f-1ac9d76fb1c6
5
public static ArrayList<BookCopy> searchBookByAuthor(String author){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList<BookCopy> books = new ArrayList<BookCopy>(); try { PreparedStatement stmnt = conn.prepareStatement("SELECT * FROM Books a, BookCopies b WHERE a.book_id = b.book_id AND author LIKE ? OR author LIKE ? AND a.book_id = b.book_id"); stmnt.setString(1, author + "%"); stmnt.setString(2, "% " + author + "%"); ResultSet res; res = stmnt.executeQuery(); while(res.next()){ //Date yearEdition, String publicationPlace, String title String genre, String author, String iSBN, String publisher,int bookID bookCopy = new BookCopy(res.getDate("year"),res.getString("place_of_publication"),res.getString("title"),res.getString("genre"),res.getString("author"),res.getString("iSBN"),res.getString("publisher"),res.getInt("book_id"),res.getInt("copy_id"),res.getInt("edition"),res.getBoolean("lendable")); books.add(bookCopy); } } catch(SQLException e){ e.printStackTrace(); } return books; }
16ef6dd8-648c-4cdd-baa6-e7f9a84d0475
8
public int readBits(int numBits) { if (numBits < 1 || numBits > 32) { throw new IllegalArgumentException(); } int result = 0; // First, read remainder from current byte if (bitOffset > 0) { int bitsLeft = 8 - bitOffset; int toRead = numBits < bitsLeft ? numBits : bitsLeft; int bitsToNotRead = bitsLeft - toRead; int mask = (0xFF >> (8 - toRead)) << bitsToNotRead; result = (bytes[byteOffset] & mask) >> bitsToNotRead; numBits -= toRead; bitOffset += toRead; if (bitOffset == 8) { bitOffset = 0; byteOffset++; } } // Next read whole bytes if (numBits > 0) { while (numBits >= 8) { result = (result << 8) | (bytes[byteOffset] & 0xFF); byteOffset++; numBits -= 8; } // Finally read a partial byte if (numBits > 0) { int bitsToNotRead = 8 - numBits; int mask = (0xFF >> bitsToNotRead) << bitsToNotRead; result = (result << numBits) | ((bytes[byteOffset] & mask) >> bitsToNotRead); bitOffset += numBits; } } return result; }
b4e28358-0af4-41ca-ba8e-4d9b5b8620c3
6
private boolean hasSufficientSimilarity(float coverage, PDFEntryHolder entryHolder, boolean isMalformed) { float minCoverage = 0.99f; // text does have difference min coverage depending on their length if(entryHolder instanceof PDFTextHolder) { // SIMPLE mode if(isSimpleComparison) { // broken text element get 10% extra float reduceCoverage = (isMalformed) ? 0.1f : 0.0f; minCoverage = 0.65f - reduceCoverage; } else { // STRUCTURAL mode String text = ((PDFTextHolder)entryHolder).getText(); // for each char less 5 the coverage gets reduced by 2% // e.g. 1 letter text = 10% reduction // 4 letter ext = 2 % float reduceCoverage = (float)(10 - text.length() * 2) / 100; // broken text element get 10% extra if(isMalformed) reduceCoverage += 0.1f; if(reduceCoverage < 0) reduceCoverage = 0; minCoverage = 0.85f - reduceCoverage; } } return (coverage > minCoverage) ? true : false; }
8f6e63c6-5da3-4fe6-bde1-38d4beedf9a2
2
private int[][] initSubMatrix(final int[][] origin, int iStart, int iEnd, int jStart, int jEnd) { int[][] subMatrix = new int[iEnd - iStart][jEnd - jStart]; for (int i = iStart; i < iEnd; ++i) for (int j = jStart; j < jEnd; ++j) subMatrix[i-iStart][j-jStart] = origin[i][j]; return subMatrix; }
6e358c7d-83f3-4bcb-8054-f237b026f473
7
private void attackUpdate(Vector3f orientation, float distance){ double time = ((double)Time.getTime())/((double)Time.SECOND); double timeDecimals = time - (double)((int)time); if(timeDecimals < 0.25) { canAttack = true; material.setTexture(animations.get(4)); } else if(timeDecimals < 0.5) material.setTexture(animations.get(5)); else if(timeDecimals < 0.75){ material.setTexture(animations.get(4)); if (canAttack) { Vector2f lineStart = new Vector2f(transform.getTranslation().getX(), transform.getTranslation().getZ()); Vector2f castDirection = new Vector2f(orientation.getX(), orientation.getZ()).rotate((rand.nextFloat() - 0.5f) * SHOT_ANGLE); Vector2f lineEnd = lineStart.add(castDirection.mul(SHOOT_DISTANCE)); Vector2f collisionVector = Game.getLevel().checkIntersection(lineStart, lineEnd, false); Vector2f playerIntersect = Game.getLevel().lineIntersectRect(lineStart, lineEnd, new Vector2f(Transform.getCamera().getPos().getX(), Transform.getCamera().getPos().getZ()), new Vector2f(Player.PLAYER_SIZE, Player.PLAYER_SIZE)); if (playerIntersect != null && (collisionVector == null || playerIntersect.sub(lineStart).length() < collisionVector.sub(lineStart).length())) { Game.getLevel().damagePlayer(rand.nextInt(DAMAGE_MAX - DAMAGE_MIN)); } canAttack = false; state = CHASE; } } }
99c78887-4d06-4592-8d8a-303560c8e260
9
@Override protected void processElement(final XMLStreamReader reader, final Stat item) throws XMLStreamException { switch (reader.getNamespaceURI()) { case NAMESPACE: switch (reader.getLocalName()) { case "Geometrie": Utils.processGeometrie( reader, getConnection(), item, NAMESPACE); break; case "GlobalniIdNavrhuZmeny": item.setNzIdGlobalni( Long.parseLong(reader.getElementText())); break; case "IdTransakce": item.setIdTransRuian( Long.parseLong(reader.getElementText())); break; case "Kod": item.setKod(Integer.parseInt(reader.getElementText())); break; case "Nazev": item.setNazev(reader.getElementText()); break; case "Nespravny": item.setNespravny( Boolean.valueOf(reader.getElementText())); break; case "NutsLau": item.setNutsLau(reader.getElementText()); break; case "PlatiOd": item.setPlatiOd( Utils.parseTimestamp(reader.getElementText())); break; default: XMLUtils.processUnsupported(reader); } break; default: XMLUtils.processUnsupported(reader); } }
0fea992a-5315-4c50-8b28-fe4b66627817
8
public int assignExistingCardToNewPerson(CsvBean bean) { if (isEmpty(bean.dateStart) || isEmpty(bean.cardNr)) return 0; if (isEmpty(bean.dateEnd)) bean.dateEnd = "21001231"; try { cn.setAutoCommit(false); String sql; if (checkPersonExist(bean.personNr)) { sql = "Delete from hPerson WHERE PersonalNr='" + bean.personNr + "'"; st.execute(sql); } String persKF = insertPersonalAndRef(bean); if (isEmpty(persKF)) { return 0; } // insert card sql = "update bidcard set persfk = '" + persKF + "', ObsolFlag='1' where cardNr='" + bean.cardNr + "'"; st.execute(sql); cn.commit(); cn.setAutoCommit(true); return 1; } catch (Exception e) { try { cn.rollback(); } catch (SQLException e1) { e1.printStackTrace(); } e.printStackTrace(); logger.error("Error while updating the card " + bean.cardNr, e); } finally { try { cn.setAutoCommit(true); } catch (SQLException e) { e.printStackTrace(); } } return 0; }
ad3a72e5-2519-451a-9fc6-6caaadcc4111
1
private void compute_pcm_samples3(Obuffer buffer) { final float[] vp = actual_v; //int inc = v_inc; final float[] tmpOut = _tmpOut; int dvp =0; // fat chance of having this loop unroll for( int i=0; i<32; i++) { final float[] dp = d16[i]; float pcm_sample; pcm_sample = (float)(((vp[3 + dvp] * dp[0]) + (vp[2 + dvp] * dp[1]) + (vp[1 + dvp] * dp[2]) + (vp[0 + dvp] * dp[3]) + (vp[15 + dvp] * dp[4]) + (vp[14 + dvp] * dp[5]) + (vp[13 + dvp] * dp[6]) + (vp[12 + dvp] * dp[7]) + (vp[11 + dvp] * dp[8]) + (vp[10 + dvp] * dp[9]) + (vp[9 + dvp] * dp[10]) + (vp[8 + dvp] * dp[11]) + (vp[7 + dvp] * dp[12]) + (vp[6 + dvp] * dp[13]) + (vp[5 + dvp] * dp[14]) + (vp[4 + dvp] * dp[15]) ) * scalefactor); tmpOut[i] = pcm_sample; dvp += 16; } // for }
d969ee76-00c6-4048-972e-1115203acae7
7
private boolean doAction(final String action, final SceneObject obj) { if(Players.getLocal().getAnimation() == -1 && !Players.getLocal().isMoving()) { if(obj.getLocation().distanceTo() > 5) { Walking.walk(obj.getLocation()); } else { if(!obj.isOnScreen()) { Camera.turnTo(obj); } else { if(obj.interact(action, obj.getDefinition().getName())) { final Timer timeout = new Timer(3000); while(Players.getLocal().getAnimation() == -1 && timeout.isRunning()) { Task.sleep(50); } return true; } } } } return false; }
8240ee5f-c44d-424a-ab1d-e242181e84e2
5
private void manageStringMessage(int senderID, StringMessage msg) throws NetworkMessageException { msg.setSender(senderID); //Message for everybody if (msg.getAcceptor() == 0) { for (int i = 0; i < clients.size(); i++) { if (clients.get(i).getID() == msg.getSender()) { continue; } clients.get(i).sendMessage(msg); } //Display message on server console console.displayMessage(getClientNameByID(msg.getSender()) + ": " + msg.getStr()); //Private message } else { for (int i = 0; i < clients.size(); i++) { if (clients.get(i).getID() == msg.getAcceptor()) { clients.get(i).sendMessage(msg); break; } } //Display message on server console console.displayMessage(getClientNameByID(msg.getSender()) + " to " + getClientNameByID(msg.getAcceptor()) + ": " + msg.getStr()); } }
836a55db-6b08-4559-97ad-4582081f74f1
1
public void keyTyped(KeyEvent e) { if (e.getKeyChar() == 'f') { showFps = !showFps; } else { stageManager.keyTyped(e); } }
06d2bfa7-4b2a-4b76-8d44-299617159318
8
public static final boolean serviceAvalible() throws RestartLater, FatalError { if (Config.getDebug()) { Output.println("Teste Außendienst möglich", 2); } String page; do { try { page = Utils.getString("quests/start", "quests/wait"); break; } catch (LocationChangedException e) { Control.current.waitForStatus(); } } while (true); int pos = page.indexOf("class=\"questanzahl\""); if (badPosition(pos)) return false; page = page.substring(pos); pos = page.indexOf("</div>"); if (badPosition(pos)) return false; page = page.substring(0, pos); pos = page.indexOf("<br />"); if (badPosition(pos)) return false; page = page.substring(pos + 6); pos = page.indexOf("<"); if (badPosition(pos)) return false; page = page.substring(0, pos); page = page.replaceAll("[^0-9/]+", ""); pos = page.indexOf('/'); if (badPosition(pos)) return false; int available = Integer.parseInt(page.substring(0, pos)); int maximum = Integer.parseInt(page.substring(pos + 1)); return (available < maximum + Control.current.additionalService); }
63a8755d-fd03-47bf-bfd5-68b0048e1077
0
public int getPhysicalWidthDpi() { return physicalWidthDpi; }
a5b440b6-98c5-4560-933d-f48946786138
9
public void spawnMonster(List<Monster> monster){ int numberMonster = 0; for(int i = 0; i < monster.size(); i++){ if(monster.get(i).getSpawner() == true){ numberMonster++; } } if(numberMonster < 5){ cdTick(5); } else{ setCooldown(0); } if(getCooldown() == 40 && numberMonster < 5){ int random = new Random().nextInt(4); Monster m = null; switch(random){ case 0: m = new Melee(2, this.xPos, this.yPos, 1, Direction.BAS, "res/Monster/MeleeRun"); break; case 1: m = new Ranged(1, this.xPos, this.yPos, 1, Direction.BAS, "res/Monster/RangedRun"); break; case 3: m = new Bomber(2, this.xPos, this.yPos, 1, Direction.BAS, "res/Monster/BomberRun"); break; } if(m != null) { m.setSpawner(true); monster.add(m); } setCooldown(0); } }
0fa0e4fe-23a9-4c25-9d08-4e427d5542a3
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; StringNode other = (StringNode) obj; if (strVal == null) { if (other.strVal != null) return false; } else if (!strVal.equals(other.strVal)) return false; return true; }
c55ddc96-a6ee-4c35-8efb-c00340fbd34c
1
public static void close() { flush(); try { out.close(); } catch (IOException e) { e.printStackTrace(); } }
e59c93e5-3b63-4171-a296-0679b91a37a6
1
@Override public void keyTyped(KeyEvent e) { if (e.getKeyChar() == '\n') { LoginFrame.this.btnLogin.doClick(); } }
41064ccf-0cdb-47e2-a4c2-45005bfd01b9
0
public TimeCal(long interval) { this.interval = interval; }
00ce7d33-769d-4d3a-8241-4c03cf8196be
5
@Override public void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis, int rendererIndex, PlotRenderingInfo info) { PlotOrientation orientation = plot.getOrientation(); RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(plot.getDomainAxisLocation(), orientation); RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(plot.getRangeAxisLocation(), orientation); float anchorX = (float) domainAxis.valueToJava2D(this.getX(), dataArea, domainEdge); float anchorY = (float) rangeAxis.valueToJava2D(this.getY(), dataArea, rangeEdge); if (orientation == PlotOrientation.HORIZONTAL) { float tempAnchor = anchorX; anchorX = anchorY; anchorY = tempAnchor; } g2.setFont(getFont()); Shape hotspot = TextUtilities.calculateRotatedStringBounds(getText(), g2, anchorX, anchorY, getTextAnchor(), getRotationAngle(), getRotationAnchor()); if (this.getBackgroundPaint() != null) { g2.setPaint(this.getBackgroundPaint()); g2.fill(hotspot); } g2.setPaint(getPaint()); TextUtilities.drawRotatedString(getText(), g2, anchorX + (3.6f * DOT_SIZE), anchorY + (0.2f * DOT_SIZE), getTextAnchor(), getRotationAngle(), getRotationAnchor()); if (this.isOutlineVisible()) { g2.setStroke(this.getOutlineStroke()); g2.setPaint(this.getOutlinePaint()); g2.draw(hotspot); } // cross drawing // g2.setPaint(getPaint()); // g2.setStroke(new BasicStroke(1.0f)); // g2.drawLine((int) anchorX - CROSS_SIZE / 2, (int) anchorY, (int) anchorX + CROSS_SIZE / 2, (int) anchorY); // g2.drawLine((int) anchorX, (int) anchorY - CROSS_SIZE / 2, (int) anchorX, (int) anchorY + CROSS_SIZE / 2); // dot drawing g2.setPaint(getPaint()); g2.setStroke(new BasicStroke(1.0f)); Ellipse2D e = new Ellipse2D.Double(anchorX - DOT_SIZE/2, anchorY - DOT_SIZE/2, DOT_SIZE, DOT_SIZE); g2.fill(e); String toolTip = getToolTipText(); String url = getURL(); if (toolTip != null || url != null) { addEntity(info, hotspot, rendererIndex, toolTip, url); } }
745d15a2-172f-4ed9-b12a-ecb6caabb8a1
7
public void func_73075_a() { field_73100_i++; if (field_73097_j) { int i = field_73100_i - field_73093_n; int k = field_73092_a.getBlockId(field_73098_k, field_73095_l, field_73096_m); if (k == 0) { field_73097_j = false; } else { Block block1 = Block.blocksList[k]; float f = block1.func_71908_a(field_73090_b, field_73090_b.worldObj, field_73098_k, field_73095_l, field_73096_m) * (float)(i + 1); int i1 = (int)(f * 10F); if (i1 != field_73094_o) { field_73092_a.func_72888_f(field_73090_b.entityId, field_73098_k, field_73095_l, field_73096_m, i1); field_73094_o = i1; } if (f >= 1.0F) { field_73097_j = false; func_73084_b(field_73098_k, field_73095_l, field_73096_m); } } } else if (field_73088_d) { int j = field_73092_a.getBlockId(field_73086_f, field_73087_g, field_73099_h); Block block = Block.blocksList[j]; if (block == null) { field_73092_a.func_72888_f(field_73090_b.entityId, field_73086_f, field_73087_g, field_73099_h, -1); field_73094_o = -1; field_73088_d = false; } else { int l = field_73100_i - field_73089_e; float f1 = block.func_71908_a(field_73090_b, field_73090_b.worldObj, field_73086_f, field_73087_g, field_73099_h) * (float)(l + 1); int j1 = (int)(f1 * 10F); if (j1 != field_73094_o) { field_73092_a.func_72888_f(field_73090_b.entityId, field_73086_f, field_73087_g, field_73099_h, j1); field_73094_o = j1; } } } }
53c193bf-2747-4418-ad2d-b152a0329146
1
void checkMatches(MTest[] tests, boolean oneWord) { for (int i = 0; i < tests.length; i++) { checkMatch(tests[i], oneWord); } }
3e61e901-2ba0-4a55-9113-e694f920f24c
9
public Annotation(Library l, Hashtable h) { super(l, h); // type of Annotation subtype = (Name) getObject(SUBTYPE_KEY); // no borders for the followING types, not really in the // spec for some reason, Acrobat doesn't render them. canDrawBorder = !(SUBTYPE_LINE.equals(subtype) || SUBTYPE_CIRCLE.equals(subtype) || SUBTYPE_SQUARE.equals(subtype) || SUBTYPE_POLYGON.equals(subtype) || SUBTYPE_POLYLINE.equals(subtype)); // parse out border style if available Hashtable BS = (Hashtable) getObject(BORDER_STYLE_KEY); if (BS != null) { borderStyle = new BorderStyle(library, BS); } // get old school border Object borderObject = getObject(BORDER_KEY); if (borderObject != null && borderObject instanceof Vector) { border = (Vector<Number>) borderObject; } // parse out border colour, specific to link annotations. color = Color.black; // we default to black but probably should be null Vector C = (Vector) getObject(COLOR_KEY); // parse thought rgb colour. if (C != null && C.size() >= 3) { float red = ((Number) C.get(0)).floatValue(); float green = ((Number) C.get(1)).floatValue(); float blue = ((Number) C.get(2)).floatValue(); red = Math.max(0.0f, Math.min(1.0f, red)); green = Math.max(0.0f, Math.min(1.0f, green)); blue = Math.max(0.0f, Math.min(1.0f, blue)); color = new Color(red, green, blue); } }
14500184-1674-4cd4-a501-4675a2bf492f
9
public short[] lock() { short[] newBoard = board.clone(); byte[][] curData = getData(); for (int y = 0; y < HEIGHT; y++) { for (int x = 0; x < WIDTH; x++) { if (curData[y][x] == 1) { int boardX = x + offsetX; int boardY = y + offsetY; if (boardY < 0 && boardX < 5) return null; if (boardX < 0 || boardX >= Board.WIDTH || boardY >= board.length || boardY < 0) continue; newBoard[boardY] |= (1 << boardX); } } } return newBoard; }
7f8aee84-9f79-4fb6-87a8-a5f366f590c3
7
private static <T extends JComponent> T getComponentFromList(Class<T> clazz, List<T> list, String property, Object value) throws IllegalArgumentException { T retVal = null; Method method = null; try { method = clazz.getMethod("get" + property); } catch (NoSuchMethodException ex) { try { method = clazz.getMethod("is" + property); } catch (NoSuchMethodException ex1) { throw new IllegalArgumentException("Property " + property + " not found in class " + clazz.getName()); } } try { for (T t : list) { Object testVal = method.invoke(t); if (equals(value, testVal)) { return t; } } } catch (InvocationTargetException ex) { throw new IllegalArgumentException( "Error accessing property " + property + " in class " + clazz.getName()); } catch (IllegalAccessException ex) { throw new IllegalArgumentException( "Property " + property + " cannot be accessed in class " + clazz.getName()); } catch (SecurityException ex) { throw new IllegalArgumentException( "Property " + property + " cannot be accessed in class " + clazz.getName()); } return retVal; }
ba2e4118-758f-4010-b177-9d7c7936610a
1
public double angle(Coordinate that) { double res = Math.acos(this.dot(that)/this.magnitude()/that.magnitude()); return this.cross(that) < 0? res: -res; }
54ad1c98-e383-4b33-ad78-217070897135
7
public void drawScaledString(Bitmap image, int xPos, int yPos, int xo, int yo, int w, int h, int col, double scale) { w *= scale; h *= scale; for(int y = 0; y < h; y++){ int yPix = y+yPos; if(yPix < 0 || yPix >= height)continue; for(int x = 0; x < w; x++){ int xPix = x+xPos; if(xPix < 0 || xPix >= width)continue; int xDraw = (int) (x/scale+xo); int yDraw = (int) (y/scale+yo); int src = image.pixels[(int) (xDraw + yDraw * image.width)]; if(src != 0xffffffff)pixels[xPix + yPix * width] = col; } } }
c048d376-b5f7-4f28-8ed3-3d7994120123
0
public String getPhoneNumbers() { return phoneNumberText.getText(); }
16a9e52a-b558-49b4-9083-3380077eb432
6
private boolean equipUnitIfPossible(UnitLabel unitLabel, AbstractGoods goods) { Unit unit = unitLabel.getUnit(); if (unit.hasAbility(Ability.CAN_BE_EQUIPPED)) { for (EquipmentType equipment : freeColClient.getGame().getSpecification() .getEquipmentTypeList()) { if (unit.canBeEquippedWith(equipment) && equipment.getGoodsRequired().size() == 1) { AbstractGoods requiredGoods = equipment.getGoodsRequired().get(0); if (requiredGoods.getType().equals(goods.getType()) && requiredGoods.getAmount() <= goods.getAmount()) { int amount = Math.min(goods.getAmount() / requiredGoods.getAmount(), equipment.getMaximumCount()); freeColClient.getInGameController() .equipUnit(unit, equipment, amount); unitLabel.updateIcon(); return true; } } } } return false; }
eb0a144b-06c5-41fc-89b3-6503be7e0bf6
6
public void manualPositionUpdate(int row, int column, Grid grid){ // Every cell between the previous cell and the new one is presumed to be searched. if (cell.getRow() < row) for (int i = cell.getRow(); i<row; i++) grid.getCellAt(i, cell.getColumn()).setSearched(); else for (int i = cell.getRow(); i>row; i--) grid.getCellAt(i, cell.getColumn()).setSearched(); if (cell.getColumn() < column) for (int i = cell.getColumn(); i < column; i++) grid.getCellAt(row, i).setSearched(); else for (int i = cell.getColumn(); i > column; i--) grid.getCellAt(row, i).setSearched(); updatePosition(row,column,grid); }
325ab049-1313-4763-b121-fd39433626a6
0
public void tankDrive(double leftValue, double rightValue){ _drive.tankDrive(-leftValue, -rightValue); }