method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3be25816-f578-49db-b058-c5ce9c326a07
4
protected static String offsetString(double offset){ String stroffset = String.valueOf(offset); String substr1="", substr2="", substr3=""; String zero ="0"; int posdot = stroffset.indexOf('.'); int posexp = stroffset.indexOf('E'); if(posexp==-1){ return ...
1108fd73-0102-481d-afad-fa4484c09aff
3
@SuppressWarnings(value="unchecked") public static Object wrap(Object item) { if (item == null) return null; Class<?> classT = item.getClass(); if (classT.isArray()) { return new Wrapper(item); } else return item; }
ab7721cf-f420-4c2c-aea2-4c84714842bd
0
@Override public void setParam(double a, double[] s, SimpleVector[] v, SimpleVector loc) { /** * Sets the basic parameters for the simulator * @param a mass of the PhysObject3D to be calculated * @param s mass of other PhysObject3D * @param v location of other PhysObject3D ...
56a4f6a9-2d5d-4508-8c9b-28806322f331
8
public void updateBPM(int frameNo, int bpm) { switch (frameNo) { case 1: //String message = constructAMessage(bpmValue1, minValue1, maxValue1, jScrollPane1); bpmValue1.setText("" + bpm); lastUpdateValue1.setText(captureTime()); ...
30aa9463-ea15-48bb-9dcf-7c417583dc18
6
private String renderFormattedWordString() { String str = ""; if (displayedLetters != null) { if (difficulty == Difficulty.easy) guessLetterAndReveal( "" + word.charAt( word.length()-1 ) ); if (difficulty == Difficulty.easy || difficulty == Difficulty.medium) guessLetterAndReveal( "" + word.cha...
08845a56-52da-4c7a-8ed4-8d9ecdd818a1
4
private void sort(int[] array){ for(int i = 0; i<array.length-1; i++){ if(array[i] > array[i+1]) swap(array, i, i+1); int j = i; while((j>0)&&(array[j-1]>array[j])){ swap(array, j-1, j); j--; } } }
520c2c05-1a34-4cea-a630-2d8ea3fb4e59
7
public String strStr(String haystack, String needle) { int len1 = haystack.length(); int len2 = needle.length(); if (len2 == 0){ return haystack; } if (len1<len2){ return null; } int i1 = 0; for (;i1<=len1-len2;i1++) { i...
7cbd7f87-0ac2-490a-9028-9cb2b9a943df
7
@Override public void run() { if (threadPool.isShutdown() || threadPool.isTerminated()) { return; } // Create random mail document final int senderID = Config.MIN_USER + generator.nextInt(Config.MAX_USER); final int receiverID = Config.MIN_USER + generator.nextInt(Config.MAX_USER); final MailType ma...
a561a2f2-a8a5-4787-93ff-8bf37b20fa4d
4
private void checkColors() { for (int i = 1; i < 7; i++) { switch (labels[i].getText()) { case "2771": labels[i].setBackground(Color.DARK_GRAY); break; case "": labels[i].setBackground(Color.BLACK); ...
759e34e4-ec0c-411f-a88a-20bbaeb417b3
8
@Override @SuppressWarnings("unchecked") public String getHolidayName(int index) { final Object resp=getHolidayFile(); if(resp instanceof String) { return ""; } List<String> steps=null; if(resp instanceof List) steps=(List<String>)resp; else return ""; if((index<0)||(index>=steps.size())) ...
763aaadb-4035-44ac-b5e9-f3b562cd48c4
9
private EntityTreeNode<EC> subDivide() { ArrayList<EC> oldEntities = localEntities; double bMinX = maxX, bMinY = maxY, bMinZ = maxZ, bMaxX = minX, bMaxY = minY, bMaxZ = minZ; for( EntityRange e : oldEntities ) { AABB aabb = e.getAabb(); assert aabb.isFinite(); bMinX = Math.min(bMinX, aabb.m...
ec2b1ac0-3508-45f8-86ec-af61c7ba7936
9
private Node statement() throws IOException { try { Node pn = statementHelper(null); if (pn != null) { if (compilerEnv.isStrictMode() && !pn.hasSideEffects()) addStrictWarning("msg.no.side.effects", ""); return pn; ...
32d21598-5193-4676-952c-d9b016a3ef9c
0
public int getWidth() { return this.width; }
81d8f338-1c38-44b1-919b-8e24e5179eaa
2
public void Create(int windowSize) { if ((_buffer == null) || (_windowSize != windowSize)) _buffer = new byte[windowSize]; _windowSize = windowSize; _pos = 0; _streamPos = 0; }
f697c97b-0cba-404a-9666-663eb12ab06b
0
public void lastStep(Context ctx) { ctx.setState(new SecondState()); }
c7c9556e-f460-4210-96e2-0d2947c9cf1c
7
@Override protected void inspectContents(File file, ArrayList lines, ArrayList lineEndings) { for (int lineCount = 1; lineCount <= lines.size(); lineCount++) { String line = (String) lines.get(lineCount - 1); if (isRegexp) { input = new PatternMatcherInput(line); try { while(util.match(query, inp...
33cc0349-c068-454e-b527-e7561f3944e2
3
public void sortRanges() { if(!sorted) { if(numPE > 0 && ranges.size() > 1) { // Avoid Java's sorting, which dumps the list into an array before sorting quickSort(ranges, 0, ranges.size() - 1); } sorted = true; } }
d4d977ac-f1d5-418c-a970-5144ecb96c54
8
@Override public boolean equals(Object obj) { Rect<?> rect = (obj instanceof Rect<?> ? (Rect<?>) obj : null); return (rect == null ? null : (X == rect.X && Y == rect.Y && Width == rect.Width && Height == rect.Height)); }
eb73ee52-7c8e-4bae-a783-c90c7d24fc39
7
public Token getTokenAt(int pos) { if (tokens == null || tokens.isEmpty() || pos > getLength()) { return null; } Token tok = null; Token tKey = new Token(TokenType.DEFAULT, pos, 1); @SuppressWarnings("unchecked") int ndx = Collections.binarySearch((List) token...
d9f29cf8-be69-49bc-8f26-43d5c263f582
1
public void testConstructor_ObjectStringEx4() throws Throwable { try { new LocalDateTime("T10:20:30.040+14:00"); fail(); } catch (IllegalArgumentException ex) {} }
bcfc4541-f338-4527-b118-5b61f5f3762a
0
private void initTreeView(){ tree = new JTree(addNodes(null, new File("."))); treeView = new JScrollPane(tree); treeView.setSize(WINDOW_SIZE.width/3, WINDOW_SIZE.height-50); treeView.setLocation(10, 10); add(treeView); }
2093ad33-88cb-4693-af99-2fcc3e9fa9f8
9
private void findChildren(ArrayList<Pair> priorityQueue, int elementPosition, boolean greaterThan) { int childIndex = elementPosition; int childLeftIndex = 2 * childIndex + 1; int childRightIndex = 2 * childIndex + 2; Pair grandChildLeft = null; Pair grandChildRight = null; if (childLeftIndex < priorit...
05668637-7679-4e3b-b3a5-c56b87d1fe48
7
public static void main(String[] args) { ReversiBoard board = new ReversiBoard(); Move move = new Move(); int n = 1; int win = 0; int j=0; int drawn = 0; for (int i = 0; i < n; i++) { board.clear(); while (board.userCanMove(TKind.N) || boar...
40134998-beac-4ddb-aee9-51e02ce3e46e
8
private static Map<String, Prop> getProperties(Class c1) { Map<String, Prop> propsMap = new HashMap<String, Prop>(); Field[] fields = c1.getDeclaredFields(); for (Field f : fields) { f.setAccessible(true); // bye-bye "private" String fieldName = f.getName(); // Put the entry in the props map, // ...
b9414616-8a28-49af-a569-ad754e70f10d
6
public void refresh(RefreshEvent event) { LocalGameRefreshEvent ev = (LocalGameRefreshEvent) event; WorldModel wm = (WorldModel) ev.getSource(); int i = ev.getX(); int j = ev.getY(); AbstractState s = wm.getState(i, j); if (s.getFlag() == AbstractState.HOLLOW_FLA...
082db7f4-04c6-4ab9-b3ce-d0a061fcd397
1
public SortProcess(String args[]) throws Exception { super(args); if (args.length < 2) { System.out.println("usage: SortProcess <inputFile> <outputFile>"); return; } inputStream = new TransactionalFileInputStream(new File(arguments.get(0))); outputStream = new TransactionalFileOutputStream(...
7eea94fc-71a9-4e0a-84b5-9ae35f594cc2
1
public void visitEnd() { if (clinit != null) { clinit.visitInsn(Opcodes.RETURN); clinit.visitMaxs(0, 0); } cv.visitEnd(); }
6118de44-9265-4392-af7e-cae9e264d982
9
@Test public void testMulticastListenerNetworkInterface() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { ISSDPNetwork instance = SSDPNetworkFactory.getInstance(); fail("Not yet impleme...
990a5782-22d8-4dba-8d0c-a302bd3d3a92
6
private static double grad(int hash, double x, double y) { hash &= 15; double u = hash < 8 ? x : y; double v = hash < 4 ? y : (hash != 12 && hash != 14 ? 0 : x); return ((hash & 1) == 0 ? u : -u) + ((hash & 2) == 0 ? v : -v); }
954c003a-3418-42ba-8473-1c8cac1ce992
8
public static BeanstreamResponse fromHttpResponse(HttpResponse http) { int httpStatusCode = http.getStatusLine().getStatusCode(); HttpEntity httpEntity = http.getEntity(); String jsonPayload = null; try { jsonPayload = httpEntity != null ? EntityUtils.toString(httpEntity) :...
d69e0d4a-74d0-4720-b844-38b87c7e0599
2
public boolean contains(int card){ for (int i=0; i<cards.length; i++){ if (cards[i] == card) return true; } return false; }
5cc9db81-4cc7-415c-9a63-1d4f9c192221
9
private boolean isStandardProperty(Class clazz) { return clazz.isPrimitive() || clazz.isAssignableFrom(Byte.class) || clazz.isAssignableFrom(Short.class) || clazz.isAssignableFrom(Integer.class) || clazz.isAssignableFrom(Long.class) || clazz.isAssignab...
fcc65f05-9c60-4b77-b6e9-c3e83770fea8
8
public void setSelected(KWTCheckbox box) { if (box != null && box.group != this) { return; } KWTCheckbox oldChoice = this.selected; this.selected = box; if (oldChoice != null && oldChoice != box && oldChoice.group == this) { oldChoice.setSelected(false); ...
08de7e31-b607-42ea-bef8-935002ea7e0c
8
public static boolean containsNestedArgumentP(Proposition proposition) { { Keyword testValue000 = proposition.kind; if ((testValue000 == Logic.KWD_ISA) || ((testValue000 == Logic.KWD_FUNCTION) || ((testValue000 == Logic.KWD_PREDICATE) || ((testValue000 == Logic.KWD_EQUIVALENT...
c64d3f78-7181-4915-ab9d-07086d6c819b
5
public static void showGame(int game_no) { switch(game_no) { case 0: game_class = new Sudoku(); break; case 1: game_class = new RubiksCube(); break; case 2: game_class = new SpaceInvaders(); break; default: System.out.println("Unknown Game"); } if(game == null || !game.isVisible()) {...
be9cc306-de3d-4f7d-8b31-bc79bc8bbb93
2
private void getFloorPlanGetFloor(String line, CellDescription cellDescription) { int startIndex; int endIndex; /*get surface*/ startIndex = line.indexOf("ss") + 4; endIndex = line.indexOf('\'', startIndex); switch (line.substring(startIndex, endIndex)) { case "4": ...
d3986514-9313-4774-9f1a-5ce3c3e3ff32
6
@Override public boolean doLarge() { if (!script.houseTask.isInHouse() && !locationAttribute.isInLargeArea(ctx)) if (ctx.lodestones.teleport(lodestone, true, Random.nextBoolean())) { timeLastTeleport = System.currentTimeMillis(); if (Condition.wait(new Callable<Boolean>() { @Override public Boo...
98959421-faba-427c-b6c6-7f4beaa84b36
6
public int scoreFill(int r, int c, List<Intersection.Piece> colors, boolean checked[][], int score){ if (r < 0 || c < 0 || r >= 9 || c >= 9) { return 0; } if(checked[r][c]==true){ return 0; } else if(board[r][c].getContents()!=Intersection.Piece.EMPTY){ colors.add(board[r][c].getContents()); retur...
d0145712-7367-47bd-8cfb-6aa79f4fcabf
7
public void update(Graphics g) { Graphics2D g2 = (Graphics2D) g; dim = getSize(); if (v < 0.0f) v = dim.height * 0.3333f; if (isOpaque()) { g2.setColor(getBackground()); g2.fillRect(0, 0, dim.width, dim.height); } g2.setColor(getForeground()); g2.setFont(ViewAttribute.LITTLE_FONT); if (re...
b628e7df-9cd2-462e-ba05-8f4faae25255
0
public void setEventDate(Date eventDate) { this.eventDate = eventDate; }
5b98b6e0-2fdd-4c48-854b-61769517fe2e
7
private static void listParentheses(List<Homonym> homonymList) { String[] strings = new String[] {"(imp.)", "(perf.)", "(imp./perf.)", "(f)", "(m)", "(m/f)", "(f/pl)", "(m/pl)", "(@ ", "(## ", "(-"}; for (Homonym w: homonymList) { for (Word wt: w.getWords()) { if (wt.getMeani...
d14e6ae4-32c0-4bee-8758-d08c01fdba58
5
public void register() { if(userBean.getPassword().equals(userBean.getConfirmedPassword())) { if (AccessDB.getInstance().isValidCode(userBean.getAccessCode())){ if(Register.register(userBean)) { userBean.setLoggedIn(true); ...
2084bd68-e0c7-4316-ac13-715a7bd8dc31
0
public BigDecimal getPrice() { return price; }
b383af4c-c752-43fe-807a-6bb261c0a5d7
1
@Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.red); for (int i = 0; i < points.length; i++) { g2.fill(points[i]); } topLeftX = (int) points[0].getCenterX(); topLeftY = (int) points[0].getCenterY(); ...
d10eb1da-1884-4fbc-9770-cec19446e471
3
@Override public void adjust() { boolean enable = false; Component comp = getFocusOwner(); if (comp instanceof JTextComponent && comp.isEnabled()) { JTextComponent textComp = (JTextComponent) comp; enable = textComp.getSelectionEnd() - textComp.getSelectionStart() != textComp.getDocument().getLength(); }...
b6328ddd-81a3-42c9-9bfd-18279c206d20
3
private void updateMetrics() { height = text.length; if(height == 0) height = 1; width = 0; for(String line: text) { if(line.length() > width) width = line.length(); } }
a0fe4a9c-d355-4143-9d55-e5c5d74423e7
1
private boolean isInRange(Placeable currentTarget) { double rangeToTarget; rangeToTarget = currentTarget.distanceTo(tower); if (attackData.getRange() >= rangeToTarget) { return true; } return false; }
50f9f4ef-0f03-4bb4-a7b8-f44824d25fd2
9
private void set_cdt(CodeTracker cdt, int g0_or_g1, char[] data, int addnlOffset, boolean multibyte) { if (data[cdt.offset + addnlOffset] == '!' && data[cdt.offset + addnlOffset + 1] == 'E') { addnlOffset++; } else if (data[cdt.offset + addnlOffset] == ' ') { ...
a51c3020-b991-4806-a749-8d8fce132ba9
9
public double asDouble() { try { if (isNull()) { return 0.0D; } else if (isDouble()) { return ((Double) value).doubleValue(); } else if (isString()) { String s = (String) value; s=s.replaceAll(",",""); return Double.valueOf(s).doubleValue(); } else if (isShort...
586d03f1-be7b-4ac2-9531-36a661de4a2a
5
@Override public void sensorPacketReceived() { if (shuttingDown) { return; } int[] sensorData = roomba.getSensorData(); qmemory.setString("bump[0].location", "right"); qmemory.setInteger("bump[0].value", ((sensorData[0] & BumpRight) > 0...
c50f0e51-99bd-479e-91ad-b4f8dcca3151
4
public void mouseClick(Point p) { if(clicked)return; if(headingLbl.getBounds() == null){ return; } if(backBtn.getLabel().getBounds().contains(p)){ handler.objects.add(new MainMenu()); handler.objects.remove(this); } if(namesBtn.getLabel().getBounds().contains(p)){ handler.objects.add(ne...
2c6d449e-d041-43b1-af54-efb110de7f15
7
@Override public void action() { if(agente.getPasso() == 8){ System.out.println("Passo 8 AI"); ArrayList<AID> agentesRejeitados = new ArrayList<AID>(); ArrayList<Proposta> propostasRecusadasPelaReputacao = agente.getPropostasRejeitadasPelaReputacao(); for(Proposta proposta : propostasRecusad...
9177d628-051e-4325-86c1-9c42acc58a86
8
public double interpolate(double xIter) { int np = this.xArray.length; // number of points double d[] = new double[np]; // Newton form coefficients double x[] = xArray;//new double[np]; // x-coordinates of nodes double d[] = yArray; double y; double t; ...
d8293bfd-7a79-4d1c-b823-982600008381
8
private static String invalidColonyReason(AIUnit aiUnit, Colony colony) { String reason = invalidTargetReason(colony); if (reason != null) return reason; final Unit unit = aiUnit.getUnit(); final Player owner = unit.getOwner(); Player targetPlayer = colony.getOwner(); swi...
82b46eee-bbca-4fae-bffc-41180c727c89
5
public void setDef(final DefExpr def) { // if (Tree.DEBUG) { // System.out.println(" setting def of " + this + // " (" + System.identityHashCode(this) + ") to " + def); // } if (this.def == def) { return; } // If this Expr already had a defining statement, remove this from the // DefExpr use list. ...
f96e6b9e-b101-440d-9be8-ca1d4eeeed8f
4
public void right(float a) { for (float i = 0; i < a; i++) { if (!this.touchRobotRotate()) { this.rotateRobot(1); if (this.checkTouchBullet()) { this.onHitByBullet(); return; } ...
e56526f2-327d-4519-be49-2ad8d22b3630
5
public void compress(File[] files) { try { // File[] files = new File("tmp").listFiles(); for (File file : files) { try { System.out.println("[*] Archiving: "+file.getName()); if (file.isDirectory()) { compress(file.listFiles()); return; } add(file, target); } catch (java.util.zip.ZipE...
04449a12-9c9f-4ac3-8185-f1f4627b8af1
3
public synchronized void remove(long eventId, int clientId) { int i=0; for(Event event:events){ if(event.getEventId()==eventId && event.getClientId()==clientId){ events.remove(i++); } } }
747650fb-40bd-4e55-a8e4-237fcb76d8cd
8
public boolean accept(File pathname) { boolean isAcceptable = false; if (pathname.exists() && pathname.isFile() && pathname.canRead()) { try { if (m_extensionList != null) if (!checkFilenameExtension(pathname.getName())) return isAcceptable; FileInputStream in = new...
4d7843d9-7a04-4cd9-8a71-224715e1d587
3
@Override public void atacar(){ try{ for(int i = 0; i < ejercito.size(); i++){ int refPosX; int refPosY; refPosX = ejercito.get(i).refLabel.getLocation().x; refPosY = ejercito.get(i).refLabel.getLocation().y; ...
3a05789b-9158-4198-add9-6a47b003b9e4
2
public boolean isboss(Player p) { if (boss != null && p.equals(boss)) { return true; } return false; }
5c66901a-6692-44f7-8414-d86625c4b4df
0
public String getDescription() { return description; }
2d08657b-4d92-475a-9440-fa57f20b7fa6
8
public String getExitGreeting(String hour) { int time = Integer.parseInt(hour); if (time >= 0 && time < 12) { return GOODBYE_MORNING; } else if (time >=12 && time < 17) { return GOODBYE_AFTERNOON; } else if (time >=17 && time < 19) { return GOODBYE_EV...
117d0161-76d6-41be-af0e-0bbefc002557
6
public List<SimilarityInfo> similarityInfos() { List<SimilarityInfo> result; result = new ArrayList<SimilarityInfo>(thresholdEvaluators.size()); FindPvalueAPE roughQueryPvalueEvaluator = new FindPvalueAPE<ModelType, BackgroundType>(queryPWM, queryBackground, roughDiscretizer); FindPvalueAPE preciseQuer...
fe8495cc-a363-41c5-865c-309eb89eff5e
3
public Charset charsetForName(String charsetName) { if (name2charset == null) init(); // get charset instance for given name (case insensitive) Charset c = (Charset)name2charset.get(charsetName.toLowerCase()); try { if (c != null) c = (Charset)c.g...
43a894c6-216c-4716-a695-bf175dd8d01f
4
public static void convert(int number, int base) { if(number%base<0&&(number/base==0||number/base==1)){ System.out.print("-"); } if(number!=0){ convert(number / base, base); System.out.print(Math.abs(number % base)); } ...
b9e84b6c-ba17-4434-b56e-dad536c2dbf0
9
public final GalaxyXPreprocessorParser.array_return array() throws RecognitionException { GalaxyXPreprocessorParser.array_return retval = new GalaxyXPreprocessorParser.array_return(); retval.start = input.LT(1); int array_StartIndex = input.index(); Object root_0 = null; Token L...
a0db427b-fb54-4b8f-b6ec-3e92f398dd7b
6
public void processMessage() throws CruiseRuntimeException { TupleExpression tuple = messages.remove(); for (MessageHandler mh : behavior.getHandlers()) { Map<String,ValueExpression> match = new HashMap<String,ValueExpression>(state); if (mh.matches(tuple, match)) { match.put("$self", new Ac...
f733c39e-7136-4506-b771-48276b7299d7
2
private QueryResult queryInfoKey(Integer handle) { if (METHOD_QUERY_INFO == null) { METHOD_QUERY_INFO = getMethod(mRoot.getClass(), "WindowsRegQueryInfoKey1", int.class); } try { return new QueryResult((int[]) METHOD_QUERY_INFO.invoke(mRoot, new Object[] { handle })); } catch (Exception exception) { Lo...
0281c8e6-f1d1-4a27-b1b6-9f7d6c7b936a
4
public Color getColour(){ switch(colour){ case 0: return Color.white; case 1: return Color.lightGray; case 2: return Color.CYAN; case 3: return Color.blue; default: return Color.BLUE; } }
0a428382-8ab1-4953-8380-a4252dadaa69
0
@Override public void method2() { System.out.println("ClassB method2()"); }
136d11a0-cd88-40e2-84f2-46f1deadd128
2
public static Stock SelectStockById(int id) throws SQLException { String query = ""; Stock stock = new Stock(); ResultSet resultat; try { query = "SELECT * from STOCK where ID_STOCK=? "; PreparedStatement pStatement = ConnectionBDD.getInstance().getPreparedState...
9d9fd865-f84d-498b-9d41-0a59d0a39ed9
4
private void createClique(int n, boolean edges) { double d = canvas.getHeight() / 3.0 * Math.sqrt(n) / 5; for (int i = 0; i < n; ++i) { createVertex(d * Math.sin(i * 2 * Math.PI / n), -d * Math.cos(i * 2 * Math.PI / n), getNewVertexID()); } if (edges) { ...
cea75548-3ff2-4ea5-8886-2a575a2351f5
6
public String nextCDATA() throws JSONException { char c; int i; StringBuffer sb = new StringBuffer(); for (;;) { c = next(); if (end()) { throw syntaxError("Unclosed CDATA"); } sb.append(c); i = ...
0ff9b731-c87a-4684-ae95-5d0b3eee5d4c
9
public static List<Edge> kruskal(Graph graph) { //order the edges from the smallest to the biggest //keep track of connected components, at the beginning all components are unconnected //select always the smallest edge that does connect 2 different components int n = graph.numVertices(); int m = graph.num...
5b1b6368-5f34-4cda-a447-d2ae6c6312a9
0
private static void usage() { System.out.println("Runs a tracker on provided address and port.\n"); System.out.println("Usage: " + "tracker <-f filename> [-i ip] [-p port]"); System.out.println("\tfilename\t-\tTorrent-file the tracker will track."); System.out.println("\tip\t\t-\tIP address or hostname to b...
6dee61cb-424f-443c-8e86-2b9a11e8dbc7
2
private void setUpArraysColumn(TableColumn arraysColumn) { JComboBox comboBox = new JComboBox(); ArraysDataBase structureBase = Main.getStructureBase(); if(structureBase != null){ for(int i = 0; i<structureBase.getLength(); i++){ comboBox.addItem(structureBase.getDa...
a27a612b-c9de-4d8b-9794-fc06d3dc5df2
1
@Test public void testInorder() { tree = new BinarySearchTree<String, String>(); previousli = tree.inOrder(tree.returnRoot()); String[] orderTest = {"DW-210","DW-211","DW-2100"}; for(int i= previousli.size()-1;i>=0;i--){ assertEquals(orderTest[i],previousli.get(i)); } }
7839cf54-13ab-4659-b377-dc9f837c9ad1
6
public static void getTeachers() { Gson gson = new Gson(); String json; try { json = getJSON("http://dev.mhsnews.org/json_db/users.php"); char[] cson = json.toCharArray(); System.out.println(json.toCharArray().length); System.out.println(); //LOOP: //While there is a line in JSON up to a ce...
b04d3274-9bc0-458f-915f-38a04cf36d5e
9
public void generate(org.w3c.dom.Element parent) { Element span=_report.html().createElement("span"); String style=""; if (_bgColor!=null) { style+="background:"+_report.htmlColor(_bgColor)+";"; } if (_underlineMarkColor!=null) { style+="border-bottom: "+_report.htmlColor(_underlineMarkColor)+" solid "+_und...
c136afb6-3b1c-4790-9ed0-3ecb49c8354d
2
public static MonitoringTypeEnumeration fromValue(String v) { for (MonitoringTypeEnumeration c: MonitoringTypeEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
8e96a83d-130c-48e2-9ceb-50ef2a120437
3
protected int readShortArray(short[] s) throws IOException { if (s.length == 0) { return 0; } byte[] b = new byte[2*s.length]; if (read(b, 0, b.length) < b.length) { primitiveEOFThrower(); } char c = (char) (b[0] << 8 | b[1]); for(int i...
1dd27a01-00ac-4cc7-91b7-c2b17ad867f1
1
public void removeStock(Stock stock) { if (this.stocks.contains(stock)) { this.stocks.remove(stock); stock.removeSubProcess(this); } }
fe2d09c7-0306-4026-8497-08dd26d1cdfa
7
public boolean isBlockNormalCubeDefault(int par1, int par2, int par3, boolean par4) { if (par1 >= -30000000 && par3 >= -30000000 && par1 < 30000000 && par3 < 30000000) { Chunk var5 = this.chunkProvider.provideChunk(par1 >> 4, par3 >> 4); if (var5 != null && !var5.isEmpty()) ...
8cb26524-a030-4c64-84e5-344f03b695d2
5
@Override public void paint(Graphics g){ Graphics2D gr = (Graphics2D)g; super.paint(gr); gr.setFont(new Font(null, Font.PLAIN, 25)); gr.setColor(Color.white); this.requestFocus(); switch(stringCount){ case 1: gr.drawString("Prep", Map.FRAMEWIDTH/6+4*OFFSET, Map.FRAMEHEIGHT/2-OFFSET); stri...
5a7b2eda-2ba2-4a73-9735-06b6d0278487
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...
faf01917-cd9f-47ca-8bd8-507f4bfcf9ae
0
public void setName(String name) { Name = name; }
5a3062b6-bb37-429f-af6f-a1f4ac6a1bf3
4
public void setOrientation(int orientation) { NodeLinkTreeLayout rtl = (NodeLinkTreeLayout) m_vis .getAction("treeLayout"); CollapsedSubtreeLayout stl = (CollapsedSubtreeLayout) m_vis .getAction("subLayout"); switch (orientation) { case Constants.ORIENT_LEFT_RIGHT: m_nodeRenderer.setHorizontalAlignme...
1387a04a-c7ab-494d-ac61-0e4e4a3c4371
2
public void playCalmLoop() throws InterruptedException{ while(true){ try { in = new FileInputStream(calm); as = new AudioStream(in); ap.player.start(as); } catch(Exception e) { System.out.println("Got an IOException: " + e.getMessage()); e.printStac...
1cc4368f-97ee-4ed6-925d-95869f835f20
1
private void launchPad(final Shell shell) { //Void method that takes the shell as a parameter FormLayout layout= new FormLayout (); //Creates a form layout variable named layout layout.marginHeight = 5; //Sets the layout's margin height to five layout.marginWidth = 5; //Sets the layout margin width to five shel...
f6401962-31b4-49e9-a2c4-abc627f5687b
8
public void run() { OutputStreamWriter out = null; BufferedReader din = null; try { System.out.println("Client Connected!"); out = new OutputStreamWriter(socket.getOutputStream()); din = new BufferedReader(new InputStreamReader(socket.getInputStream())); ...
f4d5334a-c2ab-44eb-ae6c-847a1480a42c
6
private static String ai_simple_response(String input) { int rand = 0; String[] avaActionStr = input.split(" "); for(int i = 0; i < avaActionStr.length; i++) { System.out.print(avaActionStr[i]+ " "); } System.out.println("\n"); do { rand = (int) (Math.random() * 6); } while (0 == Integer.parseInt...
98802526-ad85-4e72-a079-3ec9bc28e731
0
public int size() { return this.map.size(); }
de02c6a3-6fa2-4026-bce1-cf254f45be2a
9
public static <K extends Key, M extends Map<K, Object>> M copy( final Map<? extends K, ?> origin, final Collection<? extends K> keySet, final boolean reset, final boolean ignoreOverhead, final M result) { if (ignoreOverhead || keySet.containsAll(origin.keySet())) { for (fina...
7ec3283f-4052-4619-abcd-8d6bc5c98e25
1
@Override public void init(ServletConfig config) throws ServletException { ServletContext sc = config.getServletContext(); botmgr = (UidBaseElementManager) sc.getAttribute("BOT_MANAGER"); if (botmgr == null) { System.err.println("Cound not obtain BOT MANAGER from the ser...
989829fc-e37f-4a11-b690-e2ece0b600d7
5
private static void doThat(int[] arr, int sum) { boolean found = false; while (!found) { for (int i = 0; i < arr.length - 1; i++) { // Try this arr[i] = arr[i + 1] + arr[i]; if (arr[i] > sum) { // doThis(arr, sum); } else if (arr[i] < sum) { for(int k = 0 ;k< arr.length ; k...
01be6935-de8f-494e-a761-511873b36199
7
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) return false; if((msg.tool() instanceof Ability) &&((((Ability)msg.tool()).classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_GATHERINGSKILL)) { msg.source().tell(L("The sacred eart...
e2fe2734-3536-4f3d-8b41-41491b085b6c
5
public ArrayList<Chromosome> generateNewPopulation(ArrayList<Chromosome> currentPopulation){ ArrayList<Chromosome> newPopulation = new ArrayList<Chromosome>(); if(minimize){ Collections.sort(currentPopulation); }else { Collections.sort(currentPopulation, Collections.rever...
eb3e9abf-b604-4caa-b5b5-ac52fce90fdd
4
@Override protected void process(List<RuleTaskState> chunks) { for (RuleTaskState chunk : chunks) { int progressValue = chunk.i; String imageUrl = chunk.s; if (progressValue == -1) { if (nbf.downloadedUrls.get(imageUrl) != null && nbf.downloadedUrls.get(i...
bc4e2db0-32ba-40c0-a2ea-93788baa0c4c
7
public static void main(String[] args){ GenericBot bot = new ProbBot(); // Socket which will connect to the engine. Socket socket = null; // Reader to read packets from engine BufferedReader inStream = null; // Convenience wrapper to write back to engine PrintW...