method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
04d3049a-5fb1-4c13-9965-550f79920c24
6
public void drawCardGrid() { int rows = 7; int columns = 13; // Clear the parent panel, then create a new Gridlayout to add panels to. boardPanel.removeAll(); boardPanel.setLayout(new GridLayout(rows, columns)); cardGridPanelArray = new CardGridPanel[rows][columns]; ...
67b5d0d0-27db-41ea-84e4-71d5444d1127
4
public int getOpcode(final int opcode) { if (opcode == Opcodes.IALOAD || opcode == Opcodes.IASTORE) { // the offset for IALOAD or IASTORE is in byte 1 of 'off' for // primitive types (buf == null) return opcode + (buf == null ? (off & 0xFF00) >> 8 : 4); } else { ...
88a196f0-17e4-4737-b75c-9fa2ca7e2406
4
protected void balancing() { if (this.getLeft() != null && this.getLeft().getData() == null) this.setLeft(null); if (this.getRight() != null && this.getRight().getData() == null) this.setRight(null); }
164545a5-5983-426a-90fb-b17bd3f00700
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...
6a8b7466-febb-4bf2-9c70-30eadd57cc0c
7
@Test public void WhenDeserializingValidRoutingTable_ExpectResults() throws UnknownHostException { int levels = 2; int levelSize = 2; StringBuilder builder = new StringBuilder(); for (int i = 0; i < levels; i++) { builder.append("0"); } String expectedLo...
bd449651-8a0a-4c4d-b6ec-e6c2479394ad
0
public Post(String username){ super(username); likes = 0; comments = new ArrayList<>(); }
49750bc5-6f99-402c-be88-6d982afe62c9
7
public Arduino_LED_ControllerView(SingleFrameApplication app) { super(app); initComponents(); // Disallow resizing of the main frame this.getFrame().setResizable(false); // status bar initialization - message timeout, idle icon and busy animation, etc R...
26897a3d-4aa0-4728-b24e-906d44d19402
3
public static void main(final String[] args) throws IOException { File f = new File(args[0]); InputStream is = new GZIPInputStream(new FileInputStream(f)); BufferedReader lnr = new LineNumberReader(new InputStreamReader(is)); while (true) { String line = lnr.readLine(); if (line != null) { if (line.st...
3e2780ea-17f7-4f0a-8cf5-ee26ca377359
3
void refreshScoreSum(Frame frame, Integer frameIdx) throws UnexpectedTypeException { if(frame.getScoreStatus() != ScoreStatus.FINAL) { return; } Integer previousScore = 0; if(frameIdx > 0) { previousScore = scoreSum[frameIdx - 1]; } scoreSum[frameIdx] = previousScore + frame.getScore(ScoreType.TOTAL...
4b6c254e-bdd7-4a69-9260-8554fb84e590
4
public static boolean isTrappedSoulItem (Player player) { ItemStack itemInHand = player.getItemInHand(); try { if (itemInHand.getType().equals(Material.SOUL_SAND)) { if (itemInHand.getItemMeta().getDisplayName().equals(ChatColor.RED + "Trapped Souls")) { i...
e52a90a6-f989-4099-883e-efde22d982e9
7
public /*static*/ int endPointMovingFrom( int startPoint, int steps, int playerColor/*, Board board*/) /*throws BadBoardException*/ { // if (board == null) { /* hmmm, non static call, okay with "this"? */ // throw new NullPointerException("board can't be null"); // ...
c22d5fa7-b3c4-440d-903b-9f101af74386
1
private synchronized void createElement(long userId) { // do another test just in case another thread beat us to the lock UidBaseElement uide = allElements.get(userId); if (uide == null) { uide = new UidBaseElement(userId); allElements.put(userId, uide); } ...
00a99342-3e3b-42b6-a57d-046ce42eea5a
8
private void printTable() { MessageFormat headerFmt; MessageFormat footerFmt; JTable.PrintMode printMode = fitWidth.isSelected() ? JTable.PrintMode.FIT_WIDTH : JTable.PrintMode.NORMAL; String text; text = ...
5fd7336f-0daf-47e4-a7e1-bd2fd233c0e2
5
public static ArrayList<BookCopy> searchBookByGenre(String genre){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList<BookCopy> books =...
a3b2d073-7416-4910-ae54-739417f6719e
6
public static String shortDocumentation(String documentation) { { int lineend = Stella.NULL_INTEGER; int sentenceend = Stella.NULL_INTEGER; if (documentation == null) { documentation = "Not documented."; } lineend = Native.string_position(documentation, '\r', 0); if (lineend =...
6d1b1db7-32a9-4bba-9418-8a04e7ab76f7
2
public String toString() { try { java.io.StringWriter strw = new java.io.StringWriter(); TabbedPrintWriter writer = new TabbedPrintWriter(strw); dumpExpression(writer); return strw.toString(); } catch (java.io.IOException ex) { return "/*IOException*/" + super.toString(); } catch (RuntimeException ...
fdb76db0-0d9c-47ec-a9ea-e6adc5b3ba8f
4
public void thievingComplex(int screen) { if (screen == 1) { clearMenu(); menuLine("1", "Man", 3241, 0); menuLine("10", "Farmer", 3243, 1); menuLine("15", "Female H.A.M. Follower", 4295, 2); menuLine("20", "Male H.A.M. Follower", 4297, 3); menuLine("25", "Warrior", 3245, 4); menuLine("32", "Rogue...
fb3d29ab-4246-451a-a80c-6c03df45a0e7
8
static void getWall (Position2DInterface posi, RangerInterface rngi) { // get all SONAR values and perform the necessary adjustments getSonars (rngi); // if the robot is in open space, go ahead until it "sees" the wall while ((leftSide > MAX_WALL_THRESHOLD) && (...
db1a5f05-9cb9-4477-b91d-9358978995ff
4
@Override public T setValue( T newValue ) { T previousValue = value; value = newValue; if (previousValue == null && value != null) { addSize( 1 ); } else if (previousValue != null && value == null) { addSize( -1 ); } return previousValue; ...
22d7feb8-661a-45a9-b253-e6b9a1570062
1
public int getPosition() { int pos = 0; if (playingSource != null) { pos = (int) (playingSource.getMicrosecondPosition() / 1000); } return pos; }
8a1bf598-2111-46c4-a148-96f5d251906b
9
private synchronized AffineTransform bufferTransform(){ AffineTransform r=new AffineTransform(); for(int i=0;i<a1.size();i++){ int s1=a1.get(i);Object s2=a2.get(i);Object s3[]=null; if(s2 instanceof Object[])s3=(Object[])s2; if(s1==setTransform){r=makeTransform(s2); } if(s1==shear)r...
9c6afbd9-a885-4346-ba5d-3e2de841fd74
4
public static void main(String[] args) throws IOException { String fileName="d:/a.log"; File file=new File(fileName); BufferedReader bufferedReader=new BufferedReader(new FileReader(file)); String str; String[] strArray; int value; HashMap<String,Integer> hashMap=new HashMap<String,Integer>(); while ((...
e30e6445-6315-4d40-ac30-83c03d6b895e
9
private void call(Entity entity) { if (entity == null) { trace("No entity to call"); return; } if (entity instanceof LabelEntity || entity instanceof VerbEntity || entity instanceof PlaceEntity || entity instanceof ObjectEntity) { trace("Calling " + entity); } else { // Ignore calls to BADWORD ...
c20bc420-d530-4000-bb87-f31b966ad5ef
6
public static char jauD2tf(final int ndp, final double days, int ihmsf[]) { int nrs, n; double rs, rm, rh, a, w, ah, am, as, af; /* Handle sign. */ char sign = (char) ( ( days >= 0.0 ) ? '+' : '-' ); /* Interval in seconds. */ a = DAYSEC * abs(days); /* Pre-round if resolu...
e7658095-ba2f-4d71-8d53-0f52e9c4b347
3
public Boolean fight(Cat anotherCat) { if (this.age > anotherCat.age) return true; else if (this.weight > anotherCat.weight && this.strength > anotherCat.strength) return true; else return false; }
f4951d68-96b7-43d5-a361-112e587ebfd5
2
public String getMethodrefType(int index) { MethodrefInfo minfo = (MethodrefInfo)getItem(index); if (minfo == null) return null; else { NameAndTypeInfo n = (NameAndTypeInfo)getItem(minfo.nameAndTypeIndex); if(n == null) return n...
b4ce570a-b981-4d5d-9b61-db8f0977baaf
1
@Override public void createTheme(Theme theme) { if (theme != null) { Session currentSession = getCurrentSession(); currentSession.saveOrUpdate(theme); } }
39f6b965-7470-4990-b84f-a689a8f2cd5e
7
public boolean valid() { boolean validEnding = declaration.charAt(declaration.length() - 1) == ';'; for (int i = declaration.indexOf(")") + 1; i >= 0 && i < declaration.length() - 1 && validEnding; i++) { validEnding = declaration.charAt(i) == ' '; } return valid && validReturnType(returnType) && ...
b26f3676-f0df-44d6-84ff-0ea52d8d0d1c
5
public static Fine getFine(int fineId){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { Statement stmnt = conn.createStatement(); S...
21197ac9-b917-4ec4-a22a-16b72fa48337
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ContentNode other = (ContentNode) obj; if (subject == null) { if (other.subject != null) return false; } else if (!subject.equals(other....
de6c6bcd-ed86-4ad8-b662-c6417b819c79
2
public void loadTileImages() { // keep looking for tile A,B,C, etc. this makes it // easy to drop new tiles in the images/ directory tiles = new ArrayList(); char ch = 'A'; while (true) { String name = "tile_" + ch + ".png"; //URL urlImg = ResourceManager....
749d91f8-87e4-496b-a828-ff5af4104ca5
7
public String execute(String input) { String[] cut = input.split(" "); String res = "ERROR Der angegeben Befehl ist nicht bekannt"; if (!cut[0].isEmpty()) { switch (cut[0]) { case "NEW": if (cut.length == 2) { res = chatServ...
54ad3161-5700-4aac-9878-ea741a533c17
9
public String encode(String plain) { Morse_code m=new Morse_code(); String plain_u=plain.toUpperCase(); StringBuilder sb=new StringBuilder(); for(int i=0;i<plain_u.length();i++) { if(plain_u.charAt(i)==' ') { sb.append('x'); } else { sb.append(m.get_morse_code(plain_u.charAt(i))); ...
54115d3d-47aa-44a7-9658-4d61a360fca2
1
public static void main(String[] args) { int[] scores = {1, 5, 3, 4, 2, 6, 9, 8, 6, 6, 3, 5, 9, 7}; Entry[] elist = mergeSortAndPopulate(scores); JFrame frame = new JFrame("Leaderboard"); JPanel panel = new JPanel(new GridLayout(0, 2)); JScrollPane scrollPane = new JScrollPane(); frame.add(scrollPane, Bo...
595bb0ba-ba6d-4958-ae12-b43619b4b9ce
1
static void testApproaches(PairManager pman1, PairManager pman2) { ExecutorService exec = Executors.newCachedThreadPool(); PairManipulator pm1 = new PairManipulator(pman1), pm2 = new PairManipulator( pman2); PairChecker pcheck1 = new PairChecker(pman1), pcheck2 = new PairChecker( pman2); exec.execute(pm...
e7a7b29c-93bb-4120-a5c6-2b75ed30089a
0
public boolean getCheckWWW() { _read.lock(); try { return _checkWWW; } finally { _read.unlock(); } }
33b09642-3bab-4f87-94da-3c7e1e59fffb
4
public boolean recruitAllFromTier(Player player, int tier) { int amount = -1; boolean found = false; UnitType unit = UnitType.getTier(tier, type); for (core.GroupOfUnits u: garisson.getUnits()) { System.out.println(u.type); if (u.type == unit) { amount = recruitPay(player, unit); u.setNumber(u.ge...
4c83aa8e-9431-4ca1-99d2-d0c054045507
9
@Override public void run() { RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(10 * 1000).build(); HttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(requestConfig).build(); //HttpClient client = new DefaultHttpClient(); HttpGet request = n...
b257ece9-69c2-43d5-b128-3d36fcb81127
6
public OrocosDataPort getPort(String portName) { OrocosDataPort port; if(inputPortsNames.contains(portName)){ for (Iterator<OrocosDataPort> iterator = inputPorts.iterator(); iterator.hasNext();) { port = iterator.next(); if(port.getName().equals(portName)){ return port; } } } if(outputPor...
0be65f09-0b80-482c-963c-c8906db72f2d
2
@Test public void testProtectionEntryMaintenanceOnMoveField() throws Exception { PersistenceManager pm = new PersistenceManager(driver, database, login, password); // drop all tables pm.dropTable(Object.class); // create some test data BeforeBottom bb = new BeforeBottom(); bb.setFoo(new OriginalObject())...
b6cb199f-b2ea-40a8-93d8-82a0b7c113ef
1
@Override public boolean shouldReact(Message message) { return LONG_URL.matcher(message.text).find() || SHORT_URL.matcher(message.text).find(); }
ee913a3a-8eb7-4f7c-be40-66e17e7825d3
7
private void render(){ BufferStrategy bs = this.getBufferStrategy(); if(bs == null){ createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics(); g.drawImage(background, 0, 0, null); Point mCoordinates = MouseInfo.getPointerInfo().getLocation(); Point wCoordinates = th...
d05ba9a0-49da-407e-9703-4a2eb3364f3b
9
public static boolean check_id(final String id) throws IOException { for(int i = 0; i < 4; i++) { if((id.charAt(i) < ' ') || (id.charAt(i) > '~')) { throw new IOException("Illegal chunk id"); } } for(int i = 0; i < szComposite.length; i++) { if(id.equals(szCompo...
f5d38793-08f6-4cf9-bc10-60f21c984616
8
private void runCrawler() { PrintStream outStream = new PrintStream(outFile); /* The safe state is after completely checking a single url */ while (linksToCheck.isEmpty() == false && suspending == false) { URL curURL = linksToCheck.dequeue(); // Don't check this url if it's already been seen. if (seenLin...
f072ae68-78d2-4bb3-ad20-1522025bf9c4
0
@Override public int hashCode() { return this.map.hashCode(); }
3965528b-c205-442a-a999-18e2b8d1e6ed
3
@Override public void addPlayer(User user) { Position position; if(numPlayers() == 0) position = Position.North; else position = Position.South; players.add(new GuessTheNumberPlayer(position,user)); if(!isGameFull()) { currentMessage ="**Welcome to Guess the number**, " + user.getUser_name() + " jus...
0aadb1ea-5bc2-4647-aa7f-1b17ea8baf48
7
private void refreshFrictionVector(final DefaultUnit unit) { double value; final Ball ball = unit.getBall(); final Vector powerOfFriction = unit.getFrictionPower(); final Vector userPower = getUserPower(unit.getID()); if (userPower == null || powerOfFriction == null || ball == null) { // processing of Ex...
f4582309-054b-4b2b-b4af-e993afc117ea
6
public void setHeight() { int temp; if(children[0] == null) temp = -1; else temp = children[0].getHeight(); if(children[1]!=null) if(children[1].getHeight()>temp) temp = children[1].getHeight(); if(height == temp +1 && height != 0) return; height = temp+1; if(parent!=null...
57d3ff0a-a91b-45a7-bd55-6821136c849e
0
public void setHidden(boolean hidden) { this.hidden = hidden; }
6b64df90-18db-4956-be80-4c918c848039
2
public void updateGroup_schedule(Group_schedule gschedule) { PreparedStatement ps; try { if(gschedule.getId() > 0) { ps = con.prepareStatement("UPDATE group_schedule SET" + " group_id=?, schedule_id=?, teacher_id=? WHERE id=?"); ps.setInt(4, gschedule.getId()); } else { ps = con.pr...
cae24827-2a7d-43ca-bf3e-4ec14feb7688
9
private static char[] add(char[] number1, char[] number2) { int sumLen = (number1.length>number2.length)?number1.length+1:number2.length+1; char[] sum = new char[sumLen]; char[] reversedNumber1 = reverse(number1); char[] reversedNumber2 = reverse(number2); int carry = 0; int i = 0; for(;i<reversedNu...
479eddd9-eb3a-4867-bb0f-49703ad9d11f
6
public boolean isWon() { int sum = 0; for(int i=1; i<7; i++) { sum += board[i].getPebbles(); } if(sum == 0) { for(int i=8; i<14; i++) { sum += board[i].getPebbles(); board[i].setPebbles(0); } board[0].setPebbles( board[0].getPebbles() + sum); return true; } sum = 0; for(...
89b07a3f-727a-46fa-8c5f-a87ec9b9651f
0
@Override public String toString() { // toStringHelper //toStringBuilderでいいんじゃね? return Objects.toStringHelper(this).add("m1", m1).toString(); }
f1a956d3-42eb-4a67-afc3-83f783a8586c
9
public int iLD(String sRow, String sCol) throws Exception { int RowLen = sRow.length(); // length of sRow int ColLen = sCol.length(); // length of sCol int RowIdx; // iterates through sRow int ColIdx; // iterates through sCol char Row_i; ...
2952b34f-2de3-4c42-afc9-be485a62fa7b
1
private void notifyOfLockedStateDidChange() { for (OutlineModelListener listener : getCurrentListeners()) { listener.lockedStateDidChange(this); } }
8d61ab55-1e9d-4728-8071-c7d21b46b22d
0
@Test public void shouldReverseStringWithSingleChar () { assertEquals("e", Reverser.reverse("e")); }
45766ed3-59d7-458d-9a35-addfe4c83eaf
6
* @return boolean */ public boolean memberP(Stella_Object renamed_Object) { { Cons self = this; if ((renamed_Object == null) || renamed_Object.standardObjectP()) { { Stella_Object i = null; Cons iter000 = self; for (;!(iter000 == Stella.NIL); iter000 = iter000.rest...
cdfbb0cd-6017-4f04-b539-d1222118ac0b
8
private String get(String d) { if (d.equals(MovieColumn.LANGUAGE)) { return language; } else if (d.equals(MovieColumn.MOVIE_ID)) { return movie_id; } else if (d.equals(MovieColumn.MOVIE_NAME)) { return movie_name; } else if (d.e...
a667b5f9-76df-4adc-974f-88202834f8ca
9
void createCodonTables(String genomeVersion, Properties properties) { //--- // Read codon tables //--- for (Object key : properties.keySet()) { if (key.toString().startsWith(KEY_CODON)) { String name = key.toString().substring(KEY_CODON.length()); String table = properties.getProperty(key.toString())...
4dbb0654-c54c-4790-bd4f-716dd23f0acc
5
private void ensureTilesSize(int x, int y){ Tile[][] oldTiles = this.tiles; int maxX = x > oldTiles.length ? x : oldTiles.length; int maxY = oldTiles.length == 0 || y > oldTiles[0].length ? y : oldTiles[0].length; this.tiles = new Tile[maxX+1][maxY+1]; for (int lx = 0; lx < oldTiles.length; lx++){ for (int...
2ea3b2f2-6b22-42dc-ae68-548df25a40f5
1
public void visit_dup2_x2(final Instruction inst) { stackHeight -= 4; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 6; }
30e20a18-e9ee-4b73-93b6-90349706f32c
5
public boolean checkPlayerCollision(PlayerPawn other) { if (this.x == other.getX() && this.y == other.getY() && this.id != other.id && !this.isDead() && !other.isDead()) { return true; } return false; }
96188cae-c8a7-404d-9c29-86383c5122b0
3
private void writeGraphicControlExtension(OutputStream os, boolean epluribus, int itransparent) throws IOException { int transflag = itransparent == -1 ? 0 : 1; if (transflag == 1 || epluribus) // using transparency or animating ? { os.write((int) '!'); ...
29a3b6e2-6915-40bd-98c3-a1e2b5de0a82
0
public Keyboard(Game game) { this.game = game; }
d801f545-4d59-4a0c-b86c-7fa866fd76b6
6
public String getVersesSql(int book, int chapter) throws ParseException, IOException { String html = getBookSource1to66(book, chapter); StringBuilder result = new StringBuilder(); String insert = "\n--\n-- Book#" + book + " " + TITLE_TW_1TO66[book] + " chapter "+chapter+"\n--\n" ...
c3039411-f16b-4502-837d-9c378f375367
8
public String saveNonEmbededResponse(String downloadDirectory, String localFileName, boolean decomposed) throws IOException,SOAPException,RemoteException { String downloadName = null; BufferedOutputStream outStream = null; String localFilePath = downloadDirectory + "/" + localFileName; try { if( ! decom...
988aae8d-87e0-4292-94e1-b75aaa8ed503
2
private static void updateTables(){ for(int k= 0;k < Students.size(); k++){ Student stu = (Student) Students.get(k); //since 30 is the unassigned table values are not changed until student has been assigned if(stu.getTableNum() != 30){ stu.setLastTableThree(stu.getLastTableTwo()); stu.setLastTab...
0b34742f-43a3-4807-a7d8-99eed29961b8
0
private void jButton1ActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: loginthread logthread = new loginthread(); logthread.IP = getIP(); logthread.scan = true; logthread....
0d5726c9-f53e-4cce-81af-786af02d71ed
1
public static <E> Set<E> list2set(List<E> list) { HashSet<E> set = new HashSet<E>(); for (E e : list) { set.add(e); } return set; }
dae68841-2935-479a-99b3-a8be4539b224
6
private String generateKey() { Random r = new Random(); long maxNumber = 4294967295L; long spaces = r.nextInt(12) + 1; int max = new Long(maxNumber / spaces).intValue(); max = Math.abs(max); int number = r.nextInt(max) + 1; if (this.number1 == 0) { this.number1 = number; } else { this.number2 = ...
df49c3ee-c38f-4220-9b89-8acb5ac426c7
7
private static void setArgument(int loopcount) { if(DataInfo.totalFeatures == 200) { if ( loopcount > 6 ) { DataInfo.epsilonw *= 0.90; DataInfo.epsilonvb *= 0.90; DataInfo.epsilonhb *= 0.90; } else if ( loopcount > 5 ) { // With 200 hidden variables, you need to slow things down a little more...
fa90149c-921d-4e5b-8ce5-5034fd7a8ffc
9
public ArrayList<DragonPlugin> loadAddons(){ ArrayList<DragonPlugin> plugins = new ArrayList<>(); File pluginDir = new File(DragonCore.getInstance().getDataFolder() + "/addons"); if(pluginDir.exists() == false) pluginDir.mkdirs(); File[] jars = pluginDir.listFiles(new FileFilter() { public boolean acce...
903853bc-1ba2-4daa-8ce6-51255291168c
9
private boolean r_postlude() { int among_var; int v_1; // repeat, line 75 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 75 ...
238f8b08-5c60-4f3a-9ca3-30f909b5fba8
1
public boolean isSelected() { if (jt_language.getSelectedRow() == -1) { return false; } else { return this.getKeyText() != null; } }
2a5816ad-53a6-49ae-937b-38330f579c79
3
public boolean setHighScore(int newScore, String newName) { String path = urlName + "?mode=set&user=" + newName + "&score=" + newScore; System.out.println(path); InputStream in = null; try { in = new URL(path).openStream(); } catch (Exception e) { return false; } finally { try { if( i...
18b96cbb-9e48-4304-bbb6-2160d2d8f535
1
public Grass(boolean randomAge, Field field, Location location) { super(field, location); setAge(0); if(randomAge) { setAge(getRandom().nextInt(max_age)); } }
a8daf7e6-40d0-4e9c-bd1b-f776dee39b35
9
public boolean set(List<String> l, boolean append) { try { Object v = interpretValue(getGenericType(), l, fullName()); if(v == errorValue) return false; //System.out.println(name + " " + stringRepn + " " + v); if(!append) { // Treat boolean case specially because -flag means true, an...
873e8164-0d8b-454c-ba3a-d980c8e00f37
4
public static ArrayList<Integer> primeNumbers(int n) { if (n < 2) return new ArrayList<Integer>(); isPrime = new boolean[n]; char[] is_composite = new char[(n - 2 >> 5) + 1]; final int limit_i = n - 2 >> 1, limit_j = 2 * limit_i + 3; ArrayList<Integer> results = new ArrayList<Integer>( (int) Math.ceil(...
81c0b9bf-2bed-46be-90ec-a4d6865f84c3
8
@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { String parm = (commands.size() > 1) ? CMParms.combine(commands,1) : ""; if((!mob.isAttributeSet(MOB.Attrib.AUTOIMPROVE) && (parm.length()==0))||(parm.equalsIgnoreCase("ON"))) { mob.setAttribute(MOB...
ad24d3da-70dc-4bfe-92db-54f131bde587
1
public synchronized void adicionar() { try { new InstituicaoCooperadoraView(this); } catch (Exception e) { } }
7c9a0076-bae7-4600-aba4-704f9bdd557d
6
private void fill(String key, String value) { String methodName = voReadMethodInvocationMapping.get(key); try { Method method = cachedConfiguration.getClass().getDeclaredMethod(methodName, String.class); method.invoke(cachedConfiguration, value); } catch (SecurityException e) { // TRASH! If this problem...
ffb6fe78-0d60-4f43-920f-8b9d47f46010
7
private void checkClientStatuses() { long dif; ServerSideJob j; JobRecord jr; Calendar lastOnline; Communicator comm; final Collection<JobRecord> remove = new LinkedList<JobRecord>(); synchronized (activeJobs) { Iterator<JobRecord> it = activeJobs.iter...
523120db-79a2-40fe-8c03-f6809fa099ad
4
private void handleWaitingList() { boolean haveEnd = false; Queue<Request> tempQ = this.waitingList; this.waitingList = new LinkedList<Request>(); Request request; while ((request = tempQ.poll()) != null) { System.out.println(">>trying rquest : [" + request + "]"); ...
cf3b0ee5-5134-476c-a107-5e227b62bdf3
2
public void alimentaTabelaCliente(String SQL){ ArrayList dados = new ArrayList(); String [] Colunas = new String[]{"Código","Nome","CPF","Habilitacão"}; conecta.executaSQL(SQL); try { conecta.rs.first(); do{ da...
25eabd22-48ae-4e2b-9765-3984f78139c2
9
String findNearest(String previous, int index, int maxShapes) { if (previous == null || previous.length() <= index) { // Select or create new // Checks all exists Character c = this.findEmpty(maxShapes); //if no if (c != null) {...
023647e4-355d-49bd-b47e-0dab942c1bdb
6
public static void main(String[] args) { Scanner in = new Scanner(System.in); int k = in.nextInt(); int n = in.nextInt(); int m = in.nextInt(); List<Point> points = new ArrayList<Point>(); int i = 0; while (in.hasNext() && i++ < n) { String name = in...
dc88b3eb-0dff-442c-9b83-364222ca3d5a
0
public VoiceThread( ServerSocket serversocket ) { this.serversocket = serversocket; }
3584aed2-27c3-4d1e-8070-dc6ca18ce610
7
public int minDepth(TreeNode root) { if(root == null) return 0; if(root.left == null && root.right == null) return 1; if(root.left == null && root.right != null) return minDepth(root.right) +1; if(root.left != null && root.right == null) return minDepth(root.left) +1; return ...
26584ce5-cb33-4cb0-869e-525057ca2ae6
9
public void render(Graphics g) { int times = (int)(Math.log10(maximumx) - Math.log10(minimumx)); double blockofpixel = getBounds().getWidth()/times; double difference = Math.abs(maximumy-minimumy); double sizeofoney = getBounds().getHeight()/difference; int middle = ...
8edbeb95-383c-4ed0-b3a6-89c870d79617
9
@SuppressWarnings( "ParameterNameDiffersFromOverriddenParameter" ) @Override public <E extends ISteamflakeModelElement<IJavaRootPackage, IJavaPackage>> void consume( E element, CodeWriter writer ) { IJavaClass klass = (IJavaClass) element; // Package declaration writer.newL...
80ff5e9a-88c0-44c9-9c7a-8a738addf900
6
public double runNet (double expectedOutput) { double inputDelta = 2.0; //NeuralNets.generator.nextInt(100); //Start at a random int, so the net doesn't evolve to just spit out the "right" answer for a given seed, rather than actually thinking it through. double workingInput = expectedOutput; f...
85463a5b-8c5c-4bc1-aed1-fb9310f6fb42
8
public static void main( String[] args ) throws Exception { debug = true; BufferedReader reader = new BufferedReader( new InputStreamReader( System.in ) ); String stdin; while( true ) { stdin = reader.readLine(); if( stdin == null ) { return; } final byte[] buf = new byte[ 1024 * 20 ]; //20KB String fileCont...
b8d54b36-e076-4e70-bfb7-4cb4cca9886b
1
@Override public void updateView() { listModel.removeAllElements(); for (String s : controller.getModel().getSearchKeywords()) { listModel.addElement(s); } DirectoryList.setModel(listModel); }
750b5a35-d032-4c0a-804f-522460d12b41
2
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (rotation % 2 == 1) { g.drawLine(0, 100, 95, 100); g.drawLine(105, 100, 200, 100); g.drawLine(95, 75, 95, 125); g.drawLine(105, 75, 105, 125); } if (rotat...
9025fee4-6b52-4cbe-b22b-666b1b88d9e0
3
SimpleChat(String nickname) { // Singleton: sc = this; this.senderNickname = nickname; // Get all the Gateways. try { GatewayDiscover gatewayDiscover = new GatewayDiscover(); Map<InetAddress, GatewayDevice> gateways = gatewayDiscover.discover(); if (gateways.isEmpty()) { System.err.println...
90296129-6043-43fd-9cd4-5a1ded4dcc80
4
public void validate(Object param, Object value) { if (param instanceof String) { isGreaterThanEqualsToString((String) param, value); } else if (param instanceof Integer) { isGreaterThanEqualsToInteger((Integer) param, value); } else if (param instanceof Boolean) { throw new IllegalArgumentException(); ...
08189142-4bab-49e1-bb89-2c117b57846c
6
public static <T> Collection<T> removed( Collection<T> left, Collection<T> right ) { if ( left == null || left.isEmpty() ) { return java.util.Collections.emptyList(); } if ( right == null || right.isEmpty() ) { return new ArrayList<T>( left ); } Collec...
8da84135-0976-4331-a803-05634ea30854
6
public static String unescape(String s) { int len = s.length(); StringBuffer b = new StringBuffer(); for (int i = 0; i < len; ++i) { char c = s.charAt(i); if (c == '+') { c = ' '; } else if (c == '%' && i + 2 < len) { int d = JS...
dea18577-92b2-4ed6-aac6-984eaaabfedc
1
@Override public void actionPerformed(ActionEvent event) { Undoable undoable = getTarget(Undoable.class); if (undoable != null) { undoable.getUndoManager().redo(); } }
6abe6682-0da3-4323-b19a-528a7ba76066
1
public void printAnalysisResultsSummaryW() { String string = ""; for (int i = 0; i < consumptionWatt.length; i++) string += "\t\tFR" + (i + 1) + ": " + consumptionWatt[i] + "KW\n"; string += "\n\t\tTOTAL : " + systemConsumptionW + "W"; System.out.println(string); }