method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
49bf65fb-9240-482d-9b95-c283c8616764
8
public static void moveRoi(ImagePlus image, Roi roi, int dx, int dy, int slice, int speed, int mode) { if(roi == null) { IJ.error("Roi required"); return; } ImageStack stack = image.getStack(); Rectangle r = roi.getBounds(); int dt = Math.abs(dx) > Math.abs(dy) ? Math.abs(dx) : Math.abs(dy); Image...
9a1b161d-25be-4a7f-aba4-f9d73f6550f9
1
public ElementInfo getFirstItemOnPosition(Position pos) { if (grid.getItemsOnPosition(pos).size() > 0) return (ElementInfo) grid.getItemsOnPosition(pos).get(0); return null; }
ff2f2b6f-db16-4703-9b94-bb6365171c63
8
public void generateAmpString () { ampString = "(" + performative; if (!sender.equals("")) ampString = ampString + "\n :SENDER " + sender; if (!receiver.equals("")) ampString = ampString + "\n :RECEIVER " + receiver; if (!replyWith.equals("")) ampStr...
6c688dd0-892c-4973-a055-4fedd2770788
7
@Override public boolean modificarTurno(Turno turno) { boolean correcto = true; EntityManager em = null; EntityManagerFactory ef =null; try { ef= Persistence.createEntityManagerFactory("MerkaSoftPU"); em = ef.createEntityMana...
f77fa0db-7237-47cd-8f1e-a3bb420d638a
0
public Bullet(Animation anim, double angle, float x, float y){ super(anim, x, y); r=6; rad = Math.toRadians(angle); speed = 4; ddx = Math.cos(rad) * speed; ddy = Math.sin(rad) * speed; color1 = Color.BLUE; live=false; ...
aef5e79a-3ae2-45e0-bd0f-60cd4600bba3
4
protected boolean out_grouping(char [] s, int min, int max) { if (cursor >= limit) return false; char ch = current.charAt(cursor); if (ch > max || ch < min) { cursor++; return true; } ch -= min; if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) { cursor ++; return true; } return false; }
baeb8ac7-08ba-4d55-9787-3dda243c0e3d
1
public void setRootMethods(final Set roots) { if (this.callGraph != null) { // Can't set the call graph roots after its been created throw new IllegalStateException("Cannot set roots after " + "call graph has been created"); } this.roots = roots; }
fc92fd41-4660-43a4-8f15-cf6f5414bdbd
5
final void O(int i, int i_162_, int i_163_) { anInt5618++; for (int i_164_ = 0; anInt5557 > i_164_; i_164_++) { if ((i ^ 0xffffffff) != -129) anIntArray5543[i_164_] = i * anIntArray5543[i_164_] >> 216727719; if ((i_162_ ^ 0xffffffff) != -129) anIntArray5593[i_164_] = anIntArray5593[i_164_] *...
b2bf4ec5-f676-472b-aaff-14f5a2f8bf5e
3
public boolean autenticarLogin(String login, String senha) { boolean valida = false; Connection con = null; PreparedStatement pstm = null; ResultSet rs = null; try { con = ConnectionFactory.getConnection(); pstm = con.prepareStatement(VALIDALOGIN); ...
2a1ef935-29dd-4711-b05f-91546d2ca3da
0
public int getMoney() { return money; }
f82b8b25-8f5d-47d5-a2c0-2b64da0fe8d1
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CoordinatesEntity that = (CoordinatesEntity) o; if (coordinateId != that.coordinateId) return false; if (latitude != null ? !latitude.equals(th...
f239613c-e3bf-4581-81a4-e2e5308af8b0
9
public void onUpdate(EntityPlayer par1EntityPlayer) { if(par1EntityPlayer.playerTemperature.getIsHot()) { baseWaterExhaustionValue = baseWaterExhaustionValueWhenIsHot; } else { baseWaterExhaustionValue = baseWaterExhaustionValueNormal; } int i = par1EntityPlayer.worldObj.difficultySettin...
e76676c6-c75e-4686-ae89-9762b354ab8f
7
private void cullEntries(List<ProtectionEntry> entries, ConnectionWrapper cw) throws SQLException { ProtectionEntry toDelete = null; do { toDelete = null; outerLoop: for (ProtectionEntry entry : entries) { List<ProtectionEntry> referencers = this.listAllDependingEntries(entry, cw); for (Protecti...
12c6afe7-ad25-4caa-ac68-0e59c3448097
8
private void checkKeys(){ if(Keyboard.typed(KeyEvent.VK_LEFT)){ moveTiles(Direction.LEFT); if(!hasStarted) hasStarted = true; } if(Keyboard.typed(KeyEvent.VK_RIGHT)){ moveTiles(Direction.RIGHT); if(!hasStarted) hasStarted = true; } if(Keyboard.typed(KeyEvent.VK_UP)){ moveTiles(Direction.UP); ...
0ec7c547-c65e-4363-ae76-5a2249a28ebc
4
@Override public Property deriveRequirements(Property property) throws PropertyException { if(property instanceof DatarateProperty) { // do NoS restricts data rate? if(getMax() != UNDEFINED) { int minDR = ((DatarateProperty) property).getMin(); if(minDR != UNDEFINED) { // max data rate intro...
801dc32f-1a7c-40a1-959c-f17f1a8f2fb2
9
public Image getSystemImage(int id) { checkDevice(); switch (id) { case SWT.ICON_ERROR: if (errorImage == null) { errorImage = createImage("gtk-dialog-error"); //$NON-NLS-1$ } return errorImage; case SWT.ICON_INFORMATION: case SWT.ICON_WORKING: if (infoImage == null) { infoImage = createIm...
f4fb62c9-0bab-4d93-9514-1f814109adaa
2
public final void addHit(int type, int damage, int cycle) { for (int i1 = 0; i1 < 4; i1++) { if (hitCycles[i1] <= cycle) { hitValues[i1] = damage; hitMarkTypes[i1] = type; hitCycles[i1] = cycle + 70; return; } } }
c3969db5-a031-4b0c-9df7-73332543ec4f
7
@Override public boolean remove(T el) { if(head == null) return false; Element<T> current = head; while(current != null) { if(current.value.equals(el)) { Element<T> prev = current.prev; Element<T> next = current.next; if(prev != null) { prev.next = next; } if(next != ...
bdeea090-2cdf-4cfd-b40b-6d0214b15a3c
3
public String toRomanNumeral() { if (this.romanString == null) { this.romanString = ""; int remainder = this.value; for (int i = 0; i < BASIC_VALUES.length; i++) { while (remainder >= BASIC_VALUES[i]) { this.romanString += BASIC_ROMAN_NUMERALS[i]; remainder -= BASIC_VALUES[i]; } } } ...
cf71062e-0535-4e04-aaad-82d9ad073d44
0
public static void main(String[] args) { //test1();test2();test3(); startGame(); }
0898733c-f048-47d0-aaa4-f5979ed60324
1
private static void deepLearn(){ DL_layers++; //Add another layer if (DL_layers < DL_maxlayers){ int dl = net_layers[1] - DL_layers*DL_delta; //if (Game.verbose) System.out.println("PlayerTD: Adding DEEP LEARNING layer #"+DL_layers+" ("+dl+" nodes)"); net.addHiddenLayer(dl); net.freeze(DL_layers);...
6f2c77ed-97fe-4690-9b56-ddabdb6283a8
4
public static void findPartition(String s, int begin, ArrayList<String> pt, ArrayList<ArrayList<String>> result) { if (begin >= s.length()) { ArrayList<String> copy = new ArrayList<String>(); for (int i = 0; i < pt.size(); i++) { copy.add(pt.get(i)); } result.add(copy); } for (int i = begin; i...
9658125c-3a30-4c1a-8dd3-73eb52f57914
8
public String map(String name) { if (classes.containsKey(name)) { return classes.get(name); } else if (default_package != null && !name.contains("/")) { return default_package + "/" + name; } else { String best_match = ""; for (String pkg : packag...
579a2ab6-fb12-42d0-875c-ad3b6981a1fe
6
public void listenerInterrompreSession() { vuePartie.getPanelEnCoursVueBas().getX_black().addMouseListener(new MouseListener(){ @Override public void mouseClicked(MouseEvent arg0) {} @Override public void mouseEntered(MouseEvent arg0) {} @Override public void mouseExited(MouseEvent arg0) {} @Ov...
4357ead0-fa56-4055-8acb-a2ab6bac76f4
3
boolean addToTree(CoreInterface ci){ if(ci.getClass() == Dvd.class){ dvdTree.add(ci); return true; }else if(ci.getClass() == Location.class){ locationTree.add(ci); return true; }else if(ci.getClass() == Genre.class){ genreTree.add(ci); return true; } return false; }
a94aa89f-b9fa-4bd2-95a9-c5b017eef4e7
7
public int lengthOfLongestSubstring1(String s) { if(s.length()<=1) return s.length(); int i=0, max=1; int[] map=new int[256]; for(int k=0; k<256; k++) map[k] = -1; while(i<s.length()-1) { map[s.charAt(i)] = i; int j=i+1; for(;j<s.length() && ...
7e7a5680-57a4-4afb-abea-36fb8d232328
9
public static void main(String[] args){ ArrayList<String> valArr = new ArrayList<String>(); ArrayList<node> nodeList = new ArrayList<node>(); try{ String input; System.out.println("----------HUFFMAN CODING----------"); System.out.println("Please enter the file name t...
4de67378-a88e-486b-b1b5-f46e0cdecec9
8
public static Stella_Object accessSessionSlotValue(Session self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Http.SYM_STELLA_NAME) { if (setvalueP) { self.name = ((StringWrapper)(value)).wrapperValue; } else { value = StringWrapper.wrapString(self.nam...
1783c6cc-4ae2-4ff2-9f46-079ca0504c7d
0
@Override public void stop() throws Exception { logger.info(getName() + " stop execute."); remoteServerCall.stop(); logger.info(getName() + " stop success."); }
e1189772-edd5-4ed3-9d9c-c2ebd64013ef
6
private void getRequestClient(String request) throws JDOMException, IOException, TagFormatException { Document mDocument = builder.build(new StringReader(request)); Element rootNode = mDocument.getRootElement(); String protType = rootNode.getName(); if (protType.equals(Tags.SESSION)) { name = rootNode.get...
2bb79482-19b4-4781-ae28-0f7b0a858bad
8
private void paint3D(int n1, int w2) { int[] xPol = new int[3]; int[] yPol = new int[3]; Graphics2D g = image.createGraphics(); int ib = 0, ie = n1, sti = 1, jb = 0, je = n1, stj = 1; if(m20 < 0) { ib = n1; ie = -1; sti = -1; } ...
4aee5914-cf3f-41fb-8606-b7b5f53feaae
8
@Test public void testWriteWriteDeadlock() throws Exception { System.out.println("testWriteWriteDeadlock constructing deadlock:"); SimpleAction p1_write = new SimpleAction(p1, Permissions.READ_WRITE); SimpleAction p0_write = new SimpleAction(p0, Permissions.READ_WRITE); // LockGrabber lg1Wri...
50ff085e-fe61-45ee-a23b-d45b71701d37
5
public static long exponentiationRapide(long a, long b, long m) { if (a < 1 || b < 1 || m <= 1) throw new IllegalArgumentException(); long produit = 1, puissance = a, quotient = b; do { if (quotient % 2 != 0) { produit = produit * puissance; pr...
c1f416a7-b708-45de-8ac5-eb514baf3ae9
9
public static ImageTyp getImageTyp(ArrayList<Byte> data) { if (0 == data.size()) { return new NoFileTyp(); } if (0xFF == (data.get(0) & 0xFF) && 0xD8 == (data.get(1) & 0xFF) && 0xFF == (data.get(2) & 0xFF) && 0xE0 == (data.get(3) & 0xFF...
f46f658a-f87d-4c07-8844-9592e8a57611
4
void convertClassifiers() { String class1; String class2; // Get the first class of the data set. class1 = data.classes[0]; // Find the second distinct class of the data set. for (int i = 1; i < data.classes.length; i++) { if (class1.compareTo(data.classes[i]) != 0) { class2 = dat...
5636d710-2670-40f7-9121-de7f7cdddbe8
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
b1644a36-0561-4335-a7c2-1f6390c0bc6a
1
public void testIsAfter_MD() { MonthDay test1 = new MonthDay(6, 6); MonthDay test1a = new MonthDay(6, 6); assertEquals(false, test1.isAfter(test1a)); assertEquals(false, test1a.isAfter(test1)); assertEquals(false, test1.isAfter(test1)); assertEquals(false, test1a.isAfter(...
60b37bb8-a1c4-482e-8104-63d666424486
8
public void putAll( Map<? extends Float, ? extends Double> map ) { Iterator<? extends Entry<? extends Float,? extends Double>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Float,? extends Double> e = it.next(); this.put( e.get...
e3f48375-a77e-420e-8788-b2304c788a5f
2
public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); switch(key) { case KeyEvent.VK_L: if (!_draw_new_path) { _wps.getSmoothPath().clear(); _wps.getPath().clear(); _draw_new_path = true; update(); repaint(); } ...
3249301b-aa6f-4d13-b6a7-772c28f5544d
1
public Board(final int numberOfPawns, final int sizeX, final int sizeY, final int xBonus, final int yBonus) { final Random random = new Random(); this.xSize = sizeX; this.ySize = sizeY; this.xBonusSquare = xBonus; this.yBonusSquare = yBonus; this.pawns = new ArrayList<Paw...
3547fb73-0eac-4e2c-a705-f80cd931c2da
4
public static void setUIFont() { UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource.EmptyBorderUIResource(1, 1, 1, 1)); Font createFont; try { createFont = Font.createFont(Font.TRUETYPE_FONT, new File("resources/OpenSans-Semibold.ttf")); } catch (IOException | FontFormatEx...
82fb895d-9af0-4a97-9c9a-d6ad27ca6d96
0
@Test public void test_isDead(){ assertNotNull(pawn); assertEquals(isDead, pawn.isDead()); }
baf85481-b8a7-4b81-8662-44f5b1906f23
9
protected static void processCertA( CertPath certPath, ExtendedPKIXParameters paramsPKIX, int index, PublicKey workingPublicKey, boolean verificationAlreadyPerformed, X500Principal workingIssuerName, X509Certificate sign) throws ExtCertPathValidatorExcepti...
afcf62d9-4807-44d6-a65a-1f7050f31beb
0
@Basic @Column(name = "LOG_FECHA") public int getFecha() { return fecha; }
11723b54-70b6-4702-8c71-2d7661181f44
8
private void appendSource(int position) { final int limit = 4; int start; final int skip = position - limit + 1; if (skip <= 0) { start = 0; } else { if (skip == 1) { htmlStrings.add("... (skipping 1 line) ..."); plainStrings.add("... (skipping 1 line) ..."); } else { htmlStrings.add("......
3e787666-8d7f-430d-8df2-8d677913fa86
7
public int divide(int dividend, int divisor) { int res = 0; boolean isNeg = false; if((dividend < 0 && divisor > 0) || (dividend > 0 && divisor < 0)) isNeg = true; long dividend1 = Math.abs((long)dividend); long divisor1 = Math.abs((long)divisor); while(dividend1 >= divisor1){ long d = divisor1...
51d392c1-832e-46cd-af89-ad70767870af
3
public void update() throws ModelException { TradeKingForeman foreman = new TradeKingForeman(); if (id == null) { try { response = foreman.makeAPICall(AccountsBuilder.getAccounts(ResponseFormat.XML)); } catch (ForemanException e) { throw new ModelException("Make API Call", e); } } e...
c91bd544-0ae7-43cf-a9b3-04bc3f4c3b03
1
private boolean isAlertPresent() { try { driver.switchTo().alert(); return true; } catch (NoAlertPresentException e) { return false; } }
e3521b3d-2080-49d3-9b03-0a0d090b41c5
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final SessionKey other = (SessionKey) obj; if (peerAddress == null) { if ...
cb183972-e692-45e1-ba09-f307ba70e965
0
public ConnectionBundle getCB() { return cb; }
eb1d109b-ea5a-45b6-8c6c-8c1dd344fa0c
4
public void addTracks(int addPoint, int noToAdd) { // Work through the tracks Iterator<Track> tIt = tracks.iterator(); Collection<LineUp> groops = new Vector<LineUp>(); Collection<Artist> pers = new Vector<Artist>(); while (tIt.hasNext()) { // Get the current track ...
a2534afc-491f-4e53-8a48-825fad2225de
0
public DataPoint(float lat, float lng, float amount) { this.lat = lat; this.lng = lng; this.amount = amount; }
757e6a2f-523c-4133-950c-b20be5255a94
6
public double[] generateNewCompanyValues(Player[] players) { //ermitteln der Daten double[] researchData = new double[players.length]; double[] marketingData = new double[players.length]; double researchOverall = 0; double marketingOverall = 0; int playerCtr = 0; for (Player player : players) { Vector<...
f6ca99e1-c175-426f-a429-5da16cd5378a
1
public Topological(Digraph G) { DirectedCycle cycleFinder = new DirectedCycle(G); if (!cycleFinder.hasCycle()) order = (new OrderDirectedDFS(G)).reversePostOrder(); }
cf95bc95-718e-4f70-a865-03bdbf4f5a68
0
public static void stop() { server.stopServer(); server = null; }
4074d271-cc13-4da8-bc2d-be48a8d8acd2
3
public boolean tryMove(Board board, Direction direction) { if (canMove(board, direction)) { this.base = base.getNeighbour(direction); if (direction == Direction.DOWN && board.getTetromino() == this) { board.resetTicksSinceMove(); } return true; } return false; }
22d1fd1e-c14c-404e-8c4b-9b91fcc23fab
4
public void connectGraph(){ int n = _graph.getVertexCount(); System.out.println("n = " + n ); System.out.println("Calculating Euclidean Distance"); Collection<BCNode> nodes = _graph.getVertices(); Iterator<BCNode> iti = nodes.iterator(); ...
dd22edd3-8027-42b6-bd6e-3325d19acbd4
8
public void delete(int v) { // ʾ p = root; if (p == null) { Message.AtLeastOneElement(); return; } state = State.delete; data = v; // δҵԪ if (!shortSearch(v)) { Message.NoSuchElement(v); } else { // ֻһ㣬ֱɾ if (root.isLeaf) root.remove(v); else if (root.numOfElements == 1) { ...
ee2cda43-d172-4163-99e8-7e114e57f2af
0
public Brian() { super("Brian", 8000, 200, 170, 80, as); as.setSkill(0, "Skip", 0, 10, "Brian skips class altogether."); as.setSkill(1, "Smash", 400, 50, "Brian smashes his enemy."); as.setSkill(2, "Strangle", 1000, 100, "Brian strangles his enemy."); as.setSkill(3, "Obliterate", 7000, 250, "Brian obliterate...
2285ef1b-b055-4ee2-b49c-d4bae8b61e7c
6
public boolean removeNode(String region, String agent, String plugin) { boolean nodeRemoved = false; int count = 0; try { while((!nodeRemoved) && (count != retryCount)) { if(count > 0) { //System.out.println...
4f79ae25-6507-4cec-a696-edc5975bc283
7
@Override public void run() { guiBuild = new GUIBuild(building,animationBoost); guiBuild.setPreferredSize(new Dimension(imgWidth,imgHeight * (storiesNumber))); Thread thread = new Thread(guiBuild); baseFrame = new JFrame("Elevator"); BorderLayout layout = new BorderLayout(); baseFrame.setLayout(...
a1471d71-c3a1-4ee6-bf27-c96032d8ac89
1
public void testSubstituteNonDestructive() { System.out.println("\n*** testSubstituteNonDestructive ***"); try { CycFormulaSentence sentence = getCyc().makeCycSentence("(#$likesAsFriend ?X ?Y)"); CycFormula newSentence = sentence.substituteNonDestructive(CycObjectFactory.makeCycVariabl...
10646a43-81e2-43e0-8718-3e8f8005413c
4
public float priorityFor(Actor actor) { if (expired()) return 0 ; float impetus = CASUAL ; // // Vary readiness based on possession of relevant skills- final Skill needed[] = PERFORM_SKILLS[type] ; if (needed.length > 0) { float avgChance = 0 ; for (Skill s : needed) { final...
7f847c76-cd36-4753-8493-2a7467a5ef73
3
public void run() { // CsvFilesDTO csvDto = new CsvFilesDTO(); csvListWithTime = new HashMap<String, FileTime>(); while (true) { try { /* * Search the Directory after a duration of 1 minute for the * updated or newly added files */ searchCSVinDirectory(); Thread.sleep(60 * 1000); ...
7587ffdc-282e-41e1-a560-8157d16d0e9a
6
private void renderDragCards(Graphics2D g, List<List<Card>> gameBoard) { if (activeMove != null && activeX != -1 && activeY != -1) { if (activeMove.getMoveType() == CardMove.MOVE_TYPE.FROM_DECK) { renderCard(game.getDeck().peek(), g, activeX - (CARD_WIDTH / 2), activeY); ...
7895b946-4843-4c0a-bb6f-212889249061
5
@Override public void mousePressed(MouseEvent me) { if (me.getSource() == dInput || me.getSource() == input) { if (me.getSource() == input) conditionalClearInput(); if (me.getSource() == dInput) dInput.selectAll(); if (selectShowing) { ...
aad7a062-75a9-4c88-b92f-d4b5a2176132
1
@Override public void hierarchyChanged(HierarchyEvent event) { if (!mCaptureComponent.isDisplayable()) { stop(mCaptureComponent); } }
85e8d5ba-53de-44cc-88ef-6bdbdbfeb6f0
4
public static Complex[] convolve(Complex[] x, Complex[] y) { Complex ZERO = new Complex(0, 0); Complex[] a = new Complex[2 * x.length]; for (int i = 0; i < x.length; i++) a[i] = x[i]; for (int i = x.length; i < 2 * x.length; i++) a[i] = ZERO; Complex[] b = new Complex[2 * y.length]; for (int i = 0; ...
232bfa9b-f66f-4562-bcdd-c417cc1ab50a
4
public void ensureCapacity(long size) { long blocks = (size + allocationSize - 1) / allocationSize; while (blocks > allocations.size()) { MappedFileChannel mfc = null; if (baseDirectory != null) { final String name = baseDirectory + "/alloc-" + allocations.size(); RandomAccessFile ra...
34683c26-8c9f-4dec-815c-080bcecd1bd0
0
public String getvalue() { return value; }
20bd72e8-8f17-495b-a9a3-b9b11431cc53
5
public VitipiMenuDiscretProfil(ProfilesSystemModel profilesModel, InformationSystemModel informationSystemModel, String currentProfil) { super(DEFAULT_MENU_PROFIL_TITLE + VitipiTools.normalizeName(currentProfil), new ImageIcon( VitipiMenuConstantes.ICON_PROFIL_PATH), DEFAULT_PROFILE_COLOR, MNEMONIC_VAL...
4e67db04-9e36-4019-9018-d1c4c1826ee9
7
public static double parseDouble(String value) throws NumberFormatException { // LOG.debug("value = " + value); if(value == null) throw new IllegalArgumentException("value is null"); if(value.length() == 0) throw new IllegalArgumentException("value is empty"); if(value.substring(0, 1).equa...
28d18e60-bad6-4dc9-9646-61e43fd14bd8
9
@SuppressWarnings("unchecked") public void write(JSONObject obj) { if (this.cullFacing != null) { obj.put("cullFacing", this.cullFacing.id); } if (this.shade != null) { obj.put("shade", this.shade); } if (this.tint != null) { obj.put("tint", this.tint); } if (this.textureFacing != null) ...
8b746806-478b-41f5-ac91-86ee7253ea5b
5
public boolean compCraft(ItemStack item, Player play, String sAction, ArrayList<PaymentCache> aPayer) { HashMap<String, ArrayList<Material>> hJobs = _jobsdata.getMatHash(); if(hJobs.isEmpty()) return false; for(Map.Entry<String, ArrayList<Material>> e : hJobs.entrySet()) { ...
4cfa17aa-a9e5-43c5-8294-9ddf9c1147a7
3
private void CalculeFitnessNovamenteParaTodos(ArrayList<Caminho> array) { cadeiaDeCaminhos = new int[tamanhoTotalDoCaminho]; Caminho caminho; for (int i = 0; i < array.size(); i++) { caminho = array.get(i); array.remove(i); fo...
3ab92597-7812-49af-a281-0845eacd1d3c
5
@Override public void paint(Graphics g) { super.paint(g); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setColor(lineColor); g2.setStroke(solidStroke); int wDisplay = getWidth() - borderLef...
5994c5d0-e5b9-4e7e-b802-8f2255914725
0
public void setBias(double bias) { setWeight(this, bias/_bias); }
5ce3ef77-5a12-4356-9fa9-a535cb8ca522
9
public static void main(String[] args) throws Exception{ Scanner In = new Scanner(new File("d:\\programDATA\\Watersheds\\B-small-practice.in")); System.setOut(new PrintStream(new File("d:\\programDATA\\Watersheds\\small-output1.out"))); int numCases = In.nextInt(); for(int currCase = 1;currCase <= numC...
6be8b13d-f7be-40a7-86f3-f3fe4908d92f
7
protected static Element getModelElement(Document doc, ModelType modelType) throws Exception { NodeList temp = null; Element model = null; switch (modelType) { case REGRESSION_MODEL: temp = doc.getElementsByTagName("RegressionModel"); break; case GENERAL_REGRESSION_MODEL: temp...
0bf0a6b7-21ee-4277-a646-abde27a81fc6
2
@Override public int getRowCount() { if (MainWindow.rosterDB == null) return 0; if (MainWindow.rosterDB.getRosters() != null) return MainWindow.rosterDB.getRosters().size(); return 0; }
aed81745-def1-4c81-812b-41746dca682f
1
private String JsonUsername(String username) { JsonObject jasonObject1 = Json.createObjectBuilder().add("username", username).build(); StringWriter stringwriter = new StringWriter(); try (JsonWriter jsonwriter = Json.createWriter(stringwriter)) { jsonwriter.write(jasonObject1); ...
5c68e92d-a7c5-404c-869f-f6b9e75446d4
3
public static void TestMethod2() { TestMethod(); for(int i = 0; i < 50; i++) { if(student.addStudent(new Student("Student_" + i, i))) { for(int j = 0; j < 30; j++) { student.getStudent(i).addCourse(new Course(j, ("course_" + j), j, "A")); } } else { System.out.println("Error t...
43cc3da8-79a3-473f-bc60-cffb420b8b54
4
public boolean hitMine(){ Rectangle o = owl.getBounds(); for (Mine mine : getLevel().getMines()){ Rectangle m = mine.getBounds(); if (mine.getActive() == true){ if (o.contains(m) || o.intersects(m)){ mine.setInActive(); //dr...
5d9cdfdc-7bf9-4724-af62-551149857aff
1
public void setInterface(final boolean flag) { int modifiers = classInfo.modifiers(); if (flag) { modifiers |= Modifiers.INTERFACE; } else { modifiers &= ~Modifiers.INTERFACE; } classInfo.setModifiers(modifiers); this.setDirty(true); }
70d10255-8a1d-4122-84eb-482b7a37cecc
8
private void LoopInstructionList(LinkedHashMap<String,LinkedHashMap<String,List<String>>> item){ for (Map.Entry<String, LinkedHashMap<String,List<String>>> entry : item.entrySet()) { String key = entry.getKey(); LinkedHashMap<String, List<String>> value = entry.getValue(); if(key.equals("sort")){ ...
7470e601-e25f-46b7-bd6d-2ef2fb582882
8
static final boolean method1813(int i, int i_38_) { anInt6069++; if (i != 8806) method1813(-86, 33); if (i_38_ == 3 || i_38_ == 4 || (i_38_ ^ 0xffffffff) == -10 || (i_38_ ^ 0xffffffff) == -60 || i_38_ == 1007) return true; if (i_38_ == 2 || (i_38_ ^ 0xffffffff) == -1002) return true; return fal...
db32c196-9765-440f-9576-dd021dc7cf74
6
@Override public boolean mutate(Mutation.Type type) { switch (type) { case SWAP: case CREATE_PARENT: case REPLICATE: return false; case REMOVE: return Mutation.removeMust(this); case COPY_TREE: return Mutation.copyMustTree(this); case COPY: return unaryCopy(); default: throw new Assertio...
ef8306af-a8c4-407a-8597-37741f2f261e
0
public void setup() { }
c9bb2c21-0629-4bf1-aa09-3e8f7d8275bc
6
static public void SetString(String s) { str = s; if (str.length() >= 15 && str.subSequence(0, 8).equals("(outcome") && str.charAt(str.length() - 1) == ')') { if (str.charAt(8) == '>' || str.charAt(8) == '=' || str.charAt(8) == '<') { ...
ee512ab0-1433-488c-94d0-cf7c2fb2fa4a
5
public void validTeleporterGridFactoryTest(Grid grid) { TeleporterGridFactory teleporterGridFactory = new TeleporterGridFactory( grid, new BasicStaticTestGridFactory()); teleporterGridFactory.generate(); int n = 0; for (Element element : grid.getElementsOnGrid()) { if (element instanceof Teleporter) { ...
7f967234-1f0a-4cd4-ba7a-290bc61dc20f
6
private boolean setCmd(CommandSender sender, String[] args) { if(Validate.isPlayer(sender)) { UPlayer player = plugin.getPlayerManager().getUPlayer(sender.getName()); if(player == null) return true; if(!StaffRank.isEqualOrGreater(player, StaffRank.ADMIN)) { player.sendMessage("§4You can't use this comman...
a4aeb09e-7316-4715-9677-611f54aa1e7f
2
private static void MiscOperators() { System.out.println("Start of MiscOperators"); // Conditional Operator // Syntax of conditional operator. Simplifies a boolean if/else assignment. // variable x = (expression) ? value if true : value if false int a, b; a = 10; b = (a == 1) ? 20 : 30; System.out.pr...
fd625414-2d0d-4f5c-9414-8d0b675aee1e
6
public Class<?> getColumnClass(int col) { Class<?> c = null; String name = getColumnName(col); if (name.indexOf("OrderID") >= 0) { c = String.class; } else if (name.indexOf("Price") >= 0) { c = Float.class; } else if (n...
1896181b-d7bd-4afc-9ce8-560105c78a6e
6
public static List getBasketList(String serverID, String nymID) { List basketList = new ArrayList(); /* TODO: This loop will be replaced by server call which returns only those assets registered at the server */ if (Utility.VerifyStringVal(nymID)) { nymID = new NYM().regis...
028769d1-5485-4728-b9b8-6ad64a195adf
1
private void updateAllObjects() { allPlaceables = new ArrayList<Placeable>(); // GC is going to have a fun time because of this... :( allPlaceables.addAll(board.getAllObjects()); for (Enemy currentEnemy : board.getAllEnemiesInCurrentWave()) { allPlaceables.add(currentEnemy); ...
82d4aced-16d8-4614-bf69-d3ae55185bdc
4
public static void touch( File... paths ) throws IOException { IOException exception = null; for ( File eachPath : paths ) { if ( eachPath.isFile() ) { try { IO.closeSilently( new FileOutputStream( eachPath ) ); } catch ( IO...
5468db11-cc48-4ef2-8e56-52bfd2e18efc
6
@Override public Explanation explain(IndexReader reader, int doc) throws IOException { ComplexExplanation result = new ComplexExplanation(); result.setDescription("weight("+getQuery()+" in "+doc+"), product of:"); Explanation expl = new Explanation(idf, idfExp.explain()); // explain...
34f8f4b2-b783-4f9a-b289-6b0f22aad4b8
8
private void initialize() { setTitle("AGREGAR USUARIO"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setResizable(false); setBounds(100, 100, 410, 240); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); J...
aafcece0-c88c-4558-acee-0ab7f1d33b7b
6
public String longestCommonPrefix(String[] strs) { if (strs == null || strs.length == 0) { return ""; } for (int i = 0; i < strs[0].length(); i++) { for (int j = 1; j < strs.length; j++) { if (strs[j].length() <= i || strs[j].charAt(i) != strs[0].charAt(i...
35c67b7d-9cec-4e7e-819e-2c88f5610c65
4
public void meta(MetaMessage event) { if (event.getType() == END_OF_TRACK_MESSAGE) { if (sequencer != null && sequencer.isOpen() && loop) { System.out.println("MIDI restart: Garbage collecting."); System.gc(); sequencer.setTickPosition(0); sequencer.start(); ...