method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0d28a11f-5a72-41b9-bcb8-58aa7103fa53
2
public List<Connection> collectConnectionsOriginatingFrom(String startNode) { List<Connection> collectedConnections = new ArrayList<Connection>(); for(Connection currentConnection : connections) { if (currentConnection.startsAt(startNode)) { collectedConnections.add(currentConnection); } } retur...
dffb73af-6634-40f2-b43d-e2abc0ecb0b5
3
private static BasicDBObject docForQuery(Person person){ BasicDBObject docQuery = new BasicDBObject(); if( !person.getFirstName().equals("")){ docQuery.append("firstName", person.getFirstName()); } if(!person.getLastName().equals("")){ docQuery.append("lastName", person.getLastName()); } if(pers...
db6ba254-527e-4682-939e-e1c27d9f7c4e
4
private Object getDefault(String name, Method method) throws ClassNotFoundException, RuntimeException { String classname = annotation.getTypeName(); if (pool != null) { try { CtClass cc = pool.get(classname); ClassFile cf = cc.getClassFile2(); ...
f3b8beb8-685d-4da0-b546-0789bbf6868b
2
@Override public void epoch(Player p){ //Reinforcement learning stopping criteria if (!done_learning){ done_learning = RI_stop.epoch(p); if (done_learning) System.out.println("PlayerKyle: Done learning!"); } }
3abf6e85-ed9e-4481-8011-e7821811f00c
5
private boolean Escape_0() { begin(""); if (!next("\\u")) return rejectInner(); if (!HexDigit()) return rejectInner(); if (!HexDigit()) return rejectInner(); if (!HexDigit()) return rejectInner(); if (!HexDigit()) return rejectInner(); return acceptInner(); }
27530cb9-4f9b-49fe-b964-9826e23958dc
0
private void putCallObj(Long key, IRemoteCallObject object) { sync.put(key, object); }
7c7ab716-91cb-456c-b4e6-9a8bfc42ab78
9
public Item next() { int nodeNr; if (position <= 0) { if (position < 0) { // already at end return null; } // first time call nodeNr = startNode.nodeNr; // skip the descendant nodes if any if (includ...
987c621a-3617-46ea-a54b-35bd34d14ee4
2
public static void main(String args[]) { System.out.println("Main thread starting."); MyThread mt = new MyThread(); Thread newThrd = new Thread(mt); newThrd.start(); do { System.out.println("In main thread."); try { Thread.sleep(250); } catch (InterruptedException exc) { System.out.println("...
34e57b2e-ee91-49c9-bd8b-ae181fdb7fd0
8
public void keyReleased(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_W: case KeyEvent.VK_UP: up = false; break; case KeyEvent.VK_A: case KeyEvent.VK_LEFT: left = false; break; case KeyEvent.VK_S: case KeyEvent.VK_DOWN: down = false; break; case KeyEvent.VK_D: case KeyEven...
a396037a-4e9c-42a1-8665-6eff998df27a
0
public List<CsvValue> getValues() { return this.lines; }
3af74779-20b9-4c67-8b29-72cfeeee2ee7
5
public static void deleteCourses(long[] courseids) throws MoodleRestCourseException, UnsupportedEncodingException, MoodleRestException { String functionCall=MoodleCallRestWebService.isLegacy()?MoodleServices.MOODLE_COURSE_DELETE_COURSES:MoodleServices.CORE_COURSE_DELETE_COURSES; try { String...
0c8bec5f-d4e5-4eed-8f08-0b01bbb1ed0c
6
private void jbuttonMostrarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbuttonMostrarClienteActionPerformed String str = String.valueOf(this.autoComboBoxClientes.getSelectedItem()); if (str == null || str.isEmpty() || str.equals("") || str.equals("null")) { JOpt...
2a8bbe74-ed8c-4ca3-9695-e2b9beaee681
9
@EventHandler public void onSignChange(SignChangeEvent evt){ if(evt.getLine(0).equals("[Farm]")){ if(evt.getPlayer().hasPermission("autofarm.create")){ if(evt.getLine(1).equals("")){ evt.setLine(0, ChatColor.RED+"[Farm]"); evt.setLine(1, ChatColor.RED+"<Farm Name>"); evt.getPlayer().sendMessage...
257828c4-9b7d-4fed-850b-ed58bd9592ea
1
private boolean jj_3_68() { if (jj_scan_token(GREATEREQUAL)) return true; return false; }
ae88f79d-2b46-403d-8030-a75a6ddb9893
4
public void saveTeleporters() { YamlConfiguration config = new YamlConfiguration(); for (Teleporter teleporter : this.getTeleporters()) { ConfigurationSection section = config.createSection(teleporter.getName()); for (int i = 0; i < teleporter.getBlocks().size(); i++) { Block block = teleporter.getBlocks(...
07650117-7241-4dc0-926f-39b992e48f1a
5
public boolean isInside(Vec3 v) { Vec3 position = getAbsolutePosition(); return ((position.x <= v.x) && (v.x <= (position.x + size.x))) && ((position.y <= v.y) && (v.y <= (position.y + size.y))) && ((position.z <= v.z) && (v.z <= (position.z + size.z))); }
0164bde4-1a71-4972-b54e-042285e40ba3
7
private void locationSetup(Room room, Point previous) { Map<ExitDirection, Room> exits = room.getExitMap(); for (ExitDirection key : exits.keySet()) { if (!this.roomLocations.containsKey(exits.get(key))) { // skip over rooms already in the set Point loc = new Point(previous); switch (key) { //adjust the ...
f949f67f-ef37-4bc8-97d5-2b7480a211ea
5
public String getCommonAncestor(final String child1, final String child2) { Set<String> ancestors1 = new HashSet<String>(getAncestors(child1)); if (ancestors1.contains(child2)) { return child2; } Set<Node> ancestors2 = new HashSet<Node>(); ancestors2.add(nodes.get(c...
a04259ce-f421-403e-85d0-e0d8efff2c7a
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...
7b76e895-319e-44ab-8ab4-b4a0b8b2dd76
1
private String formatH2(String content) { String buf = ""; int idx = 0; int aStart = 0; int aEnd = -5; while (content.indexOf("<h2>", idx) != -1) { aStart = content.indexOf("<h2>", idx); buf += content.substring(aEnd+5, aStart); aEnd = content.indexOf("</h2>", aStart); buf += "\n$size[13]...
233934cf-fdc2-4357-88a7-965c07ec4242
9
@SuppressWarnings("unchecked") private void getSubClaimList() { titleDLM.removeAllElements(); subclaimResultList = claim.getClaims(fileName, SUBCLAIM, teamType); claimAndSubclaimResultList = claim.getClaims(fileName, CLAIMSUBCLAIM, teamType); if (subclaimResultList.size() != 0) { for (int i = 0; i < subclai...
c5a42b1d-b05e-45c5-aafe-703f24a13903
9
public boolean similar(Object other) { try { if (!(other instanceof JSONObject)) { return false; } Set<String> set = this.keySet(); if (!set.equals(((JSONObject)other).keySet())) { return false; } Iterator<St...
1a80f085-5680-40bf-bee2-ca5a1e0311de
7
@Test public void addmemtest() throws ClassNotFoundException, IOException{ Member newmem2 = new Member("1234123","1234123","Ұ","ǻͰа"); membercollectm.addmem(newmem2); int endnum =0; try{ @SuppressWarnings("resource") ObjectInputStream osin = new ObjectInputStream(new FileInputStream("membercollection.tx...
6886098b-84a5-4e79-b655-1349a6f6f650
7
private double getBestAngleOffset(final GunWave wave) { if (state.robotGunHeat / State.coolingRate > 4) return 0; double perfect = GunPerfectTargeting.getPerfectAim(wave, state); if(!Double.isNaN(perfect)) { bot.out.println("Perfect Aim: " + perfect); return perfect; } int size = (int) Tools.limi...
27e8c22d-3403-4636-bc15-5e6667a50081
4
public void generateDotFile(String filename) { try { PrintWriter out = new PrintWriter(filename); out.println("digraph Heap {\n\tnode [shape=record]\n"); for(int i = 0; i < currentSize; i++) { out.println("\tnode" + i + " [label = \"<f0> |<f1> " + array[i] + "|<f2> \"]"); if(((i*2) + 1) < curre...
efb3a02b-bfe6-4e61-9fcf-c4af9582f1f3
4
public void update() throws ESellException { if (id == null) // User wurde noch nicht mit der DB abgeglichen. { throw new ESellException(ESellException.ErrorCode.NO_ENTRY_ERR); } makeConnection(); PreparedStatement preparedStatement = null; if(conn != null) { try { ...
ece04095-d0d7-4d24-8fac-59995b6095f2
1
public void testSetMinuteOfHour_int2() { MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8); try { test.setMinuteOfHour(60); fail(); } catch (IllegalArgumentException ex) {} assertEquals("2002-06-09T05:06:07.008+01:00", test.toString()); }
ecb3b8cd-f42e-4c15-b981-05cdf83826ab
9
private boolean fetchGarbage(Point garbage) { pathPlanner.goToPenultimate(garbage); if (tryLeftRight() == true) return true; while(!pos2d.isDataReady()) {}; pos2d.setSpeed(0.8, 0); try { Thread.sleep (250); } catch (Exception e) { } ...
235c0876-8e62-47a0-9362-610b93c4414d
5
public Tile(int x, int y, int typeInt) { tileX = x * 40; tileY = y * 40; type = typeInt; tileBoundary = new Rectangle(0, 0, 0, 0); if (type == DIRT) { tileImage = ((AssetImage) Assets.instance() .get(AssetType.TILE_DIRT)).getImage(); } else if (type == GROUND) { tileImage = ((AssetImage) Asset...
ddadb620-a271-4003-96bf-d912f05c50e6
3
private void reportTransparency(String fnm, int transparency) { System.out.print(fnm + " transparency: "); switch (transparency) { case Transparency.OPAQUE: System.out.println("opaque"); break; case Transparency.BITMASK: System.out.println("bitmask"); break; case Transparency.TRANSLUCENT: Syste...
f8b0e911-91b1-4632-8dbb-b78304d1be6e
0
public SingletonTest() { }
728d4530-1724-40c2-8e3a-3fdfe6300e80
7
public static HashSet<String> rules(ResultSet rs) throws SQLException{ HashSet<String> cate_Set=new HashSet<>(); String tech=rs.getString("tech"); String type=rs.getString("type"); String note=rs.getString("note"); String journal=rs.getString("journal"); String institutio...
6ce52112-2f47-43d2-8b6e-f48e278f1a16
9
@Override protected boolean doShield(MOB mob, CMMsg msg, double successFactor) { if(msg.value()<=0) return true; if((successFactor>=1.0)||((successFactor>0.0)&&(msg.value()==1))) { mob.location().show(mob,msg.source(),null,CMMsg.MSG_OK_VISUAL,L("The sparkling field around <S-NAME> completely absorbs the @...
a02ad623-034e-44bd-8545-1dd6244fde9d
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Function other = (Function) obj; if (funcName == null) { if (other.funcName != null) return false; } else if (!funcName.equals(other.fun...
6f7a6653-9b4c-44d1-b452-d4c7fc6de693
2
public Rates getRates() { String url = BASE_URL + "rates"; HttpGet get = new HttpGet(url); get.addHeader("Authorization", "Basic " + this.auth); try { HttpResponse response = client.execute(get); return new Rates(response, this); } catch (ClientProtocolException e) { e.printStackT...
a09bee42-a902-4e0a-9a6c-30c43078b267
6
boolean makeCombat(Monster enemy) { // Sanity check if(roll(Token.Horror, Monster.get(enemy, Token.Horror))==0) apply(Token.Sanity, -Monster.get(enemy, Token.Sanity)); if(get(Token.Sanity)<=0) return false; int toughness = Monster.get(enemy, Token.Toughness); // Stamina fight while(get(Token.Stamina)>...
fd05791b-8202-4d5f-a199-47629319eeda
1
@Override public void setEnabled( boolean enabled ) { if( !enabled ){ cancelConnecting(); } }
e54e15ee-81c7-4731-b1b0-06c600192a38
2
public State tryDoubleMove(Move m,Move m2){ State newstate = new State(this); if (newstate.applyMove(m)) if(newstate.applyMove(m2)) return newstate; // apparently, move was not succesful return null; }
f8a44949-9939-4417-ab7a-fb6f85ce3aec
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 fe...
8965778f-906f-4f90-ac2f-a77a5b1c8589
5
public static Boolean DBIntegrityCheck(String[] tCodes){ Boolean destroyed=false; Connection con = DBase.dbConnection(); PreparedStatement pst; iCheck: for (String cc : tCodes){ String query = "Select Count(CountryCode) FROM " + cc; ResultSet frs; ...
1dcc6571-168c-48bc-9fe2-43b5bc8d3642
7
public static void OnWidgetRecieve(Widget wdg, int id, String type) { if (wdg instanceof IMeter) { // Stamina / SHP / HHP / Hungry currentMeters.add((IMeter) wdg); } if (wdg instanceof Img) { // Hourgalss on if (((Img) wdg).textureName.contains("gfx/hud/prog/")) ...
c5288f52-a7a8-4ed8-8aaf-62de6748c20f
1
@Test public void hahmoEiPaaseOikeallaPuolellaOlevastaEsteestaLapi() { laitetaasPariEstetta(); pe.siirra(-60, 0); for (int i = 0; i < 100; i++) { pe.liikuOikealle(); } assertTrue("Hahmo pääsi seinästä läpi oikealle paahtaessaan. x = " + pe.getX(),...
1801c5d5-a874-4918-899f-8cb784ab912a
9
public static String buildSearchAnimeByName(String approximateName, SearchFilter filter) { resetClause(); select.append("A.*"); from.append("\"Anime_\" A"); if (filter.hasSeason()) { from.append("\"Season\" S") .append("\"AnimeSeason\" AS_"); ...
006724d7-62b2-4f62-b70d-656a92be4e43
8
private void loadMesh(String fileName){ String[] splitArray = fileName.split("\\."); String ext = splitArray[splitArray.length - 1]; if (!ext.equals("obj")){ System.err.println("Error: file format not supported for mesh data: " + fileName); new Exception().printStackTrac...
57a29940-7fca-4ee5-828e-7827151ba591
3
public void setJobCounts(int howOftenID) { if(howOftenID == 0) { daily = true; } else if (howOftenID == 1) { weekly = true; } else if (howOftenID == 2) { monthly = true; } }
7fcf4bea-6ed9-492e-8abb-e8afa064578f
3
public static void main(String[] args) { List<String> listeMot = MorphingTools.parseTexteVersMot("test/exercice2/fichierTestParse"); Integer[][] edges = new Integer[listeMot.size()][listeMot.size()]; String[] vertex = new String[listeMot.size()]; for (int i = 0; i < listeMot.size(); i++...
bc34c5eb-b580-4b7f-a570-edcb04977985
7
@Override public String makeMobName(char gender, int age) { switch(age) { case Race.AGE_INFANT: case Race.AGE_TODDLER: return name().toLowerCase()+" puppy"; case Race.AGE_CHILD: switch(gender) { case 'M': case 'm': return "boy " + name().toLowerCase() + " puppy"; case 'F': ...
9a9ca168-3240-4d15-b9e5-c1f4e5f719cc
7
private String lsaSummary() { StringBuffer result = new StringBuffer(); // print number of latent variables used result.append("Number of latent variables utilized: " + m_actualRank); // print singular values result.append("\n\nSingularValue\tLatentVariable#\n"); // create single array...
7da99403-91ce-4adf-86d3-59f28bbbf095
1
public void testMillisProvider_null() { try { DateTimeUtils.setCurrentMillisProvider(null); } catch (IllegalArgumentException ex) { // expected } }
ff93dc3a-f12d-4ff3-939f-791b7571d5cc
4
public final String toString() { StringBuffer sb = new StringBuffer(); sb.append('('); for (int i = 0; i < 4; i++) { if (i != 0) sb.append("; "); for (int j = 0; j < 4; j++) { if (j != 0) sb.append(','); sb.append(' '); sb.append(entry[i][j]); } } sb.append(" )"); return sb.to...
78190d6c-07f1-411f-b4af-79e73d874e27
7
public KarmaPlayer[] getTopKDR(int amount){ KarmaPlayer[] top = new KarmaPlayer[amount]; for(KarmaPlayer p : this.karmaPlayers.values()){ for(int i = top.length - 1; i >= -1; i--){ if(i == -1 || (top[i] != null && top[i].getKDR(3) > p.getKDR(3))){ if(i == top.length - 1){ //Poorer than the poorest...
26360ca5-15bc-4344-a2bd-4b68f0a420a8
0
public Hashtable GetConfigHashtable() { return configSections; }
939c9f9a-c91a-4c05-88a3-deccb66512e6
3
public boolean isAccessible(Byte source) { if (this.oneToOne.containsKey(source) == false) return false; if (this.oneToOne.get(source).getValue() == (byte)0) return false; if (this.oneToOne.get(source).getKey() == (byte) 0) return false; return true; }
e9ec6e6a-be52-42d1-9eb5-bb028565a302
3
public boolean setStartEndTime(Calendar start, Calendar end) { if(endTime == null || start.compareTo(endTime) < 0) startTime= start; else return false; if(end.compareTo(startTime) > 0) endTime = end; else return false; return true; }
1c33d2ec-ebde-4792-8c71-94cbaf968d0f
0
public float getMaxSpeed() { return 0.2f; }
9cbc5bf4-5efa-4111-99f8-320c6099f69f
1
public void placeEntity(int x, int y, int id) { if (state != null) { throw new IllegalStateException("game currently ticking"); } log(Level.INFO, "Placing %d at (%d, %d)", id, x, y); Entity entity = getEntityType(id).spawn(); entity.setLocation(x, y); thisTick...
24994f38-681b-4ebe-8a1b-61d4d3b068af
7
public static final void nbest(final float[] in, final int offset, final float[] codebook, final int len, final int entries, final float[] E, ...
ff26f925-c41f-45dc-9d9b-80a22362c7d5
5
private static void addGettersClass(Class cls) { Map<String, FastMethod> methods = new HashMap<String, FastMethod>(); classToGerrets.put(cls, methods); FastClass fastClass = FastClass.create(cls); while (cls != null) { for (Method method : cls.getDeclaredMethods()) { ...
5e9f7294-e4f7-42ed-8099-a9de6abca6d6
4
@Override public final void run() { while (true) { synchronized (lock) { if (!running) { break; } } ChannelRequest<T> request; try { request = nextRequest(); } catch (InterruptedException e) { continue; } Channel channel = request.getChannel(); try { servi...
7b2d8e0d-9d99-44b4-a616-c7c9c869a9a9
4
private void addChangeColors() { Container container = new Container(); GridLayout layout = new GridLayout(4, 3); container.setLayout(layout); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 2; constraints.gridheight = 1; JLabel colorLabel = ne...
0b32446e-3c43-493f-9d01-388c168e1501
0
public static String uuidBaseTime() { com.eaio.uuid.UUID uuid = new com.eaio.uuid.UUID(); return uuid.toString(); }
a059ac0a-4728-4c03-9205-f374a99aeb58
5
public void done() { int statesRemaining = answer.getStates().length - dfa.getStates().length, transitionsRemaining = answer .getTransitions().length - dfa.getTransitions().length; if (statesRemaining + transitionsRemaining != 0) { String states = statesRemaining == 0 ? "All the states are there.\n" ...
c473db66-6b03-4da3-9c94-2e764e62d689
7
public void loadFolder(final File folder) { final Thread t = Thread.currentThread(); if(t != iniLoader || t.isInterrupted()) return; synchronized(chunks) { chunks.clear(); } MapReader.clearCache(); final File[] files = folder.listFiles(new FileFilter() { @Override public boole...
e259019f-b736-4dfb-b6e8-253f969c1af7
5
@Override public List<Article> findAll() { List<Article> listJ = new ArrayList<Article>(); Statement st = null; ResultSet rs = null; try { st = this.connect().createStatement(); rs = st.executeQuery("select * from Article"); System.out.println("rec...
7673ca4a-0744-4367-8ec6-12e56f897e66
2
public ComplexMatrix subarray_as_Complex_columnMatrix(int start, int end){ if(end>=this.length)throw new IllegalArgumentException("end, " + end + ", is greater than the highest index, " + (this.length-1)); Complex[] cc = this.getArray_as_Complex(); Complex[] retArray = new Complex[end-start+1]; ...
b0eceb32-89ba-413a-875b-273060f1361e
4
@Override public void deserialize(Buffer buf) { nbcollectorMax = buf.readByte(); if (nbcollectorMax < 0) throw new RuntimeException("Forbidden value on nbcollectorMax = " + nbcollectorMax + ", it doesn't respect the following condition : nbcollectorMax < 0"); taxCollectorHireCost...
4a054f42-c1c4-4419-a732-fa7740f0f980
8
private void loadDbTableDataFromFile(DbSchema schema) throws WaarpDatabaseSqlException, IOException { int read = 0; VitamReader reader = getReader(); switch (type) { case CSVTYPE: { String[] values = null; int warning = 0; DbTable table = schema.getTables().get(0); while ((values = reader.readO...
32f67400-c0f6-4549-be46-445cfbd14396
0
public static void main(String[] arguments) throws IOException { Game.game(); }
7857b90c-6b01-48d0-b78e-c910ab7a58bf
1
public Page(int x, Dimension size) { this.size = size; bi = new java.awt.image.BufferedImage(size.width, size.height, java.awt.image.BufferedImage.TYPE_INT_RGB); n = x; pf = pg.getPageFormat(n); Graphics g = bi.getGraphics(); Color c = g.getColor(); g.setColor(Color.white); g.fillRect(0, 0, (int...
d74e48e1-81c3-40c6-a288-8df3f6b966f1
0
public void scale(int times) { base = DimensionalTrasform.scale(side, base); setColoredExes(); }
67ae952a-6cb4-411c-9cea-6d18302976b7
0
private static Set getNewUsefulVariableSet() { return new HashSet(); }
fddd07d8-6a21-474f-98e4-1bfaa1270cb5
4
public boolean contains( AnyType x ) { AANode<AnyType> current = root; nullNode.element = x; for( ; ; ) { int compareResult = x.compareTo( current.element ); if( compareResult < 0 ) current = current.left; else if( compare...
e726c432-03f5-4636-9350-b599b792d9aa
4
public void update() { Vector<String> labels = new Vector<String>(); for(int i=0; i<LangDirectory.getInstance().directoryFilesHashMap.size(); i++) { final Iterator<Entry<String, String>> it = LangDirectory.getInstance().directoryFilesHashMap.get(i).entrySet().iterator(); while (it.hasNext()) { final...
8f478a58-99aa-43a5-9004-3d8f5f5064b6
5
@Override public Class<?> loadClass(String name) throws ClassNotFoundException { /* Loading doesn't happen very often, so list checking here is perfectly okay. :) */ /* * Do not even try negotiating list conflicts. Full on being somebody * else's problem at this point. */ if(useWhiteList && !white.ma...
9248ed73-e5de-4f9e-a9bf-40cf44eed395
4
protected Integer doInBackground() throws Exception { // Do a time-consuming task. try { jProgressBar1.setMaximum(4); jTextField1.setEnabled(false); jPasswordField1.setEnabled(false); jProgressBar1.setValue(1); Use...
f5f52327-889e-4d78-90aa-6b5c0d306339
2
private List<Wall> getAllWallsOnGrid() { List<Wall> walls = new ArrayList<Wall>(); for (Element e : grid.getElementsOnGrid()) { if (e instanceof Wall) walls.add((Wall) e); } return Collections.unmodifiableList(walls); }
4f667be8-0e9e-4cc4-b66c-510a8bded9ed
7
private void updateLists() { if (simplificationList.size() > 2) { simplificationList.get(simplificationList.size()-3).setSimplifyType(sType); if (sType == ArrowType.ACTIVATE) { String arrowImageString = simplificationList.get(simplificationList.size()-3).getArrowColor() + "Arrow"; simplificationList.get...
6ffe7fad-0f3b-42c4-ac08-87eea2e6577f
1
public long[] nextLongs(int n) throws IOException { long[] res = new long[n]; for (int i = 0; i < n; ++i) { res[i] = nextLong(); } return res; }
a5f756bc-1606-49cd-be1b-b5618d702ef4
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (getClass() != obj.getClass()) return false; final AbstractBoard other = (AbstractBoard) obj; if (gameOver != other.gameOver) return false; if (currentPlayer == null) { if (other.currentPlayer != null) return false; } else if...
3c68bd33-3b58-493e-b0e2-697dfece6ca3
4
public boolean checkOrder() { DefaultTableModel tmodel = viewCustomer.getTmodel(); if (tmodel.getRowCount() >= 1) { for (int i = 0; i < tmodel.getRowCount(); i++) { Object t = tmodel.getValueAt(i, 4); if (t == null) continue; int s = Integer.parseInt(t.toString()); if (s > 0) { return t...
0fb26428-c74c-4d96-8d4c-c8e1a7035d5b
1
private TextLayout tl() { if(tl == null) tl = tm().getLayout(start, end); return(tl); }
659467f3-a3b0-44d4-8145-bc65e8f345b5
1
public IntBuffer playMusic(String scene, boolean loop) { if(currentMusic != null) { AL10.alSourceStop(currentMusic.get(0)); } IntBuffer music = playSound(getMusic(scene), 0, 0, musicVolume, loop); currentMusic = music; return music; }
6c49d44d-407d-4960-8cc0-781e7722a42a
4
private static void benchmark(KeyValueLookup keyValueLookup, ExecutorService executor) throws InterruptedException, ExecutionException { int numObjects = 100000; System.out.println("Running benchmark for '" + numObjects + "' objects of type 'String' with implementation '" ...
3257702d-67f1-4d05-9453-2fa8d85f3cc0
8
@Override public void update(float pDeltaTime) { mGame.getInput().getMouseEvents(); mGame.getInput().getKeyEvents(); int len = mBalls.size(); for (int i=0; i<len; i++) { Ball firstBall = mBalls.get(i); for (int j=0; j<len; j++) { Ball secondBall = mBalls.get(i); if (secondBall == firstBall...
b2abef7f-38e9-4122-85b4-8181816f2c5a
6
public static void main(String[] args) throws FileNotFoundException, IOException { long startTime = System.nanoTime(); BufferedReader br = new BufferedReader(new FileReader("prim_greedy.txt")); String[] splitLine = br.readLine().trim().split("(\\s)+"); int numV = Integer.parseInt(splitLine[0]); int numE = ...
cb4449a5-489c-4ee5-aff1-ff93f5355e18
2
public void accessPastMeeting() { System.out .println("You have selected access past meeting, now please either the ID of the meeting you would like to view, or alternatively enter a contact name to view all associated meetings: "); String str = getInput(); try { if (Character.isDigit(str.charAt(0))) { ...
af66c7de-ae21-403f-9456-1958d2552846
0
public synchronized int next() { ++currentEvenValue; Thread.yield(); ++currentEvenValue; return currentEvenValue; }
8f81faee-9f4e-45d7-b025-5841326c42ad
5
public static void main(String[] args) throws IOException { //leitura do arquivo FileReader arq = new FileReader(PWD + File.separator + "arquivo.txt"); BufferedReader lerArq = new BufferedReader(arq); Arvore arv = new Arvore(); String linha = lerArq.readLine(); Scanner...
c06fff7d-6e18-4ff8-8a1e-550df336b68d
0
public FrozenHeadArmor() { this.name = Constants.FROZEN_HEAD_ARMOR; this.defenseScore = 11; this.money = 350; }
bf3fa4d2-331d-4f77-9088-de308ccc5de1
0
public MenuDespesas(){ System.out.println("Insira o valor da Despesa:\n"); valor = in.nextFloat(); System.out.println("Insira a Descrição"); descricao = in.next(); }
61445605-e36b-4192-ac11-973d3ff410a3
2
@Override public Component getTreeCellRendererComponent ( JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus ) { JLabel label = (JLabel) super.getTreeCellRendererComponent( tree, value, sel, expanded, leaf, row, hasFocus ); TreeModel model = tree.getModel(); if...
ff497a3f-f1e7-4c12-bc7c-1f31f6e92942
3
private void displayProtonPatternAnalysis(){ System.out.println("PROTON PATTERN MATCHING ANALYSIS WITH TOLERANCE LEVEL OF "+get_tolerance()); ProtonPatternDetector protonPattern; List<ProtonPatternDetector> foundProtonPatterns = new LinkedList<ProtonPatternDetector>();; int startIndex ; ...
75869b6f-7650-4fdb-847c-19549f7a7605
4
public static String getRepository() { String repository = ""; // Don't forget ending ' ' String searchedLine = "[DEBUG] Using local repository at"; try { // Launch maven in debug mode ProcessBuilder pb = new ProcessBuilder("cmd.exe", "/k", "mvn -X"); pb.redirectErrorStream(true); Process child = ...
b8d940fd-4fe3-4e5f-9d73-ca0d2e0cc4bc
6
public Map<String, Boolean> getPermissions() { Map<String, Boolean> perms = new HashMap<>(); if (DatabaseManager.getInstance().getSelfPermissions(this.name) != null) { for (String permission : DatabaseManager.getInstance().getSelfPermissions(this.name)) { perms.put(permissio...
ed0f449c-4cce-4399-8ed4-5ff9686b8792
7
static <A, B, C, X> Fst<C> compose(Fst<A> left, Fst<B> right, F1<A, X> leftSel, F1<B, X> rightSel, F2<A, B, C> compo) { Fst<C> intersection = new Fst<>(); LinkedList<StatePair> stack = new LinkedList<>(); Map<StatePair, State> chart = new HashMap<>(); for (State l : left.initialStates) { for (State r :...
c09f20b4-849b-42e1-a635-32535c343b24
3
private int handleH(String value, DoubleMetaphoneResult result, int index) { //-- only keep if first & before vowel or between 2 vowels --// if ((index == 0 || isVowel(charAt(value, index - 1))) && isVowel(charAt(value, index + 1))) { ...
d1bf5583-143d-48a5-a07b-d77c52da10ef
1
public void restoreOps(Object s) { Stack state = (Stack) s; while (!state.isEmpty()) { int penalty = ((Integer) state.pop()).intValue(); startOp(DONT_BREAK, penalty); } }
5c398176-de20-4633-9d3a-321f527a30a3
7
public void unseat(int type) { boolean unseatInParent = true; int[] tsa = tableMap.get(type); double random = RNG.nextDouble(); int tc = 0; int ind = -1; double cuSum = 0.0D; for (int tableSize : tsa) { tc += tableSize; } for (int i =...
8b90ce7b-bb0f-4ea5-b162-d190b8ced019
2
public void addLconst(long n) { if (n == 0 || n == 1) addOpcode(9 + (int)n); // lconst_<n> else addLdc2w(n); }
a070b6ae-7f26-41e9-8dcb-c47b2649f327
7
public JGImage getImage(String imgname) { if (!existsImage(imgname)) throw new JGameError( "Image '"+imgname+"' not defined.",true ); JGImage img = (JGImage)images.get(imgname); if (img==null) { img = (JGImage)images_orig.get(imgname); if (img==null) return null; // convert indexed to display-compati...