method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
da4e8e01-ef70-413c-94d5-a183f0cbcc5d
5
private static Population[] generate(){ Population[] h = new Population[GLOBAL_STEPS]; operationCounter = new double[OPERATIONS_NUMBER]; for (int pop = 0; pop < GLOBAL_STEPS; ++pop){ h[pop] = new Population(populationSize, individualSize); } resultsRandom = new double...
e40d0781-7cca-45be-95c3-6c8656903520
0
@Test public void runTestActivityLifecycle4() throws IOException { InfoflowResults res = analyzeAPKFile("Lifecycle_ActivityLifecycle4.apk"); Assert.assertEquals(1, res.size()); }
39a49140-7257-4090-983f-c94c598755cd
3
public List<Integer> returnIntsFromStart (int start) { List<Integer> listI=new ArrayList<Integer>(); BitSet bset=new BitSet(); int a,bcount=0; for (a=start;a<totalLength;a++) { if (this.get(a)==true) bset.set(bcount); else bset.clear(bcount); bcount++; if (bcount==8) { listI.add(binaryToInt8(bse...
e07fa955-c84d-4540-a269-c7470079cd16
7
public InsertStatus insertFromBuffer(ItemStack[] buffer) { if (isFull()) return InsertStatus.FAIL; for (ItemStack is : buffer) { if (is == null || is.stackSize == 0) continue; InsertStatus i = insert(is, false); switch (i) { case FAIL: case PARTIAL: return InsertStatus.PARTIAL; case SUC...
67d96a7d-4946-444e-a087-90dfe51e3a9a
6
@Override public int compareTo(Track o) { int artistcompare = this.get("artist").compareToIgnoreCase(o.get("artist")); if(artistcompare == 0) { try { int albumcompare = this.get("album").compareToIgnoreCase(o.get("album")); if (albumcompare == 0) { ...
65c32bbb-8be5-4560-8441-346af5cd83a8
0
public static void main(String[] args) { RecursionFb fb = new RecursionFb(); System.out.println(fb.fbMethod(4)); }
fc578f68-86fb-47bd-8c72-a81ec336e7e3
7
private void drawChunks(int x0, int y0, int width, int height, Graphics2D gI) { for (int x = (int) ((x0-.0)/Chunk.getPixelLength()-0.5); x <= Math.ceil(((double)x0+width)/Chunk.getPixelLength()); ++x) { for (int y = (int) ((y0-.0)/Chunk.getPixelLength()-0.5); y <= Math.ceil(((double)y0+height)/Chunk.getPixelLen...
5d843cfd-4073-42cf-994e-1c4669b189f9
3
@Override public void addProduct(Product product) throws SQLException { Session session=null; try{ session=HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.save(product); session.getTransaction().commit(); }catch(Exception e){ e.printStackTrace(); }finally{ ...
cbc30909-3eb9-4c84-80cb-6aa2ac37e534
1
double tryGetProfit(Match m) { double total = 0; if ((total = makeTotalPredict(m)) < 0) { return 0; } return m.betLine.getProfit(total, m.score.total, eps1, eps2); }
bbd69211-cf55-405a-b8e7-c848411d96ba
5
public Sha1Hash (byte[] bytes) { if (bytes == null) { throw new NullPointerException(); } if (bytes.length != 20) { throw new IllegalArgumentException(); } this.bytes = Arrays.copyOf(bytes, bytes.length); hash = Arrays.hashCode(bytes); ...
03a90a1c-984d-423f-b821-fb7034a961ea
9
protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxN...
cbb1903d-f83e-4e32-af78-8ada6a6a7ea7
6
public int getImageIndex() { if (type.equalsIgnoreCase("red")){ return 6; } else if (type.equalsIgnoreCase("blue")){ return 7; } else if (type.equalsIgnoreCase("dark")){ return 8; } else if (type.equalsIgnoreCase("blank")){ return 9; } else if (type.equalsIgnoreCase("darkRed")){ return 10; } ...
9cdcc03d-cb55-4732-950a-4eb75dfbbfa3
2
private int MakeThem(Commande data) throws InterruptedException { int nbRatees = 0, nbFaites = 0; TypePiece tp = Commande.TypePiece.valueOf(data.GetPiece()); Random r = new Random(); while (nbFaites < data.GetNbrPieces()) { if (r.nextInt(5) == 3) nbRa...
fbbeccc1-f035-4095-87b0-3a88ac8bc087
1
static void tuneAll(Instrument[] e) { for (Instrument i : e) tune(i); }
18ea969b-3034-4d15-9de7-d460b7379c92
2
@Override public String toString() { String words = ""; for (Map.Entry<String, Integer> entry : countWords.entrySet()) { words += entry.getKey() + " - " + entry.getValue() + "\n"; } String extractedSentences = ""; for (String sentence : sentences) { e...
82c94e18-1eb4-42b5-890b-d0826656d7e3
3
public boolean isEmpty() { if (hasNoGold() && hasNoWumpus() && hasNoPit()) return true; return false; }
e3e7569e-614c-452a-92c1-3c27e99d9374
8
private void checkFormatting(int lineNumber, String line, String[] partsToCheck) throws Exception { String baseMessage = "On line " + lineNumber + ": Invalid formatting found - "; String pFound = findIllegalPunctuation(line); if (pFound != null) { throw new Exception(baseMes...
2017af68-51ba-44db-8620-e31ee649f758
3
@Override public void repaint(TextGraphics graphics) { border.drawBorder(graphics, new TerminalSize(graphics.getWidth(), graphics.getHeight()), title); TerminalPosition contentPaneTopLeft = border.getInnerAreaLocation(graphics.getWidth(), graphics.getHeight()); TerminalSize contentPaneSi...
6e4369ea-6a4c-4932-ad82-45ef761baf72
3
public boolean checkStatus(User user) throws BusinessException { boolean canAccess = false; // O usuário foi autenticado com sucesso e se encontra ativo. if(User.STATUS_ATIVO == user.getStatus()) { canAccess = true; } else if(User.STATUS_BLOQUEADO == user.getStatus()) { // Caso o usuário esteja bloquea...
f8af8618-e34d-47a2-8673-8c34901def72
6
public Movie[] load() throws Exception { Movie[] finalResult = new Movie[0]; if (!Session.hasKey("LoggedUser")) { throw new Exception("User is not authorized"); } if (Session.hasValue("LoggedUser", "admin")) { XmlDocument xmlMovies = loadXml(); ArrayL...
bc312e81-ecb2-4526-aa68-7149c0684cc8
4
public boolean isOnPoint(double mx, double my) { if (locked) { mx = (mx - (x - graph.canvas.offX) / graph.canvas.zoom) * Math.sqrt(graph.canvas.zoom) + (x - graph.canvas.offX) / graph.canvas.zoom; my = (my - (y - graph.canvas.offY) / graph.canvas.zoom) * Math.sqrt(gra...
7433c9b7-4351-457e-ae2f-a6184cf49bc9
8
public void updateTileBar(ArrayList<Integer> pages, Color c, int RedGreenOrBlue){ for(int i = 0;i < pages.size(); i++){ if(pointersToRecolors[pages.get(i) - startingPage] == null){ addPortion(pages.get(i)-startingPage, c); } else { Color currentPanelColor = pointersToRecolors[pages.get(i) - starti...
a33c8dbf-a169-4e87-ae12-c09faec3f8e8
4
private static String byteToHex(byte[] messageDigest) { StringBuilder buf = new StringBuilder(); for (byte b : messageDigest) { int halfbyte = (b >>> 4) & 0x0F; int two_halfs = 0; do { buf.append( (0 <= halfbyte) && (halfbyte <= 9) ? (char) ('0' + halfbyte) : (char) ('a' + (halfbyte - 10))); ...
55c61bac-7458-4fb2-9752-f4c99f3af184
2
public synchronized int bytesCompleted(){ int num = 0; for(Integer k : this.blocks.keySet()){ Block b = this.blocks.get(k); if(b != null) num += b.getLength(); } return num; }
eae2671b-9f7f-4c1c-a674-3dcad1bae701
8
public void angleDistanceBeforeStarted() { if (score <= -anglebow.angle*5 || score <= 600 + anglebow.angle*5) { if (score < -anglebow.angle*5) { flydot.y += FLYDOT_JUMP_VY; } else if (score > -anglebow.angle*5) { flydot.y += 1; } } if (score <= 600 + anglebow.angle*5 || score <= -anglebow.a...
761b445e-4645-4978-a444-c7279f4168be
9
@Override public String stringify(int level) { ArrayList<String> strArray = new ArrayList<String>(); int width = 0; for (int i = 0; i < length; ++i) { JSON obj = mapArray.get(i); String strJSON; if (obj == null) strJSON = "null"; else strJSON = obj.stringify(level + 1); width += strJSON...
2454be3b-d01f-4d54-98c1-8a75d0cda31d
9
private final void method2333(BufferedStream buffer, int i, int i_8_) { anInt9517++; if ((i_8_ ^ 0xffffffff) != -2) { if ((i_8_ ^ 0xffffffff) == -3) { int i_9_ = buffer.readUnsignedByte(); anIntArray9522 = new int[i_9_]; for (int i_10_ = 0; (i_10_ ^ 0xffffffff) > (i_9_ ^ 0xffffffff); i_10_++) an...
00208511-016d-4a42-aff4-1a263a2b3364
7
private void checkWater() { if(this.water >= 10){ this.water = 10; this.waterStatus = "Fulness"; this.isAlive = true; } if(this.water < 10 && this.water >= 7){ this.waterStatus = "Dursty"; this.isAlive = true; } if(this.water < 7 && this.water > 2){ this.waterStatus = "Very Hungry"; this...
9ff3531e-9015-44c3-afa9-b41b83f97cd5
5
@Override public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { if (args.length == 0) { Main.courier.send(sender, "requires-argument", "message", 0); return false; } final String text = Add.join(args, "...
3a1f0af1-b192-434e-a4fc-9ae8aa5ba048
5
private static void updateMaps () { for (int i = 0; i < mapPanels.size(); i++) { if (selectedMap == i) { String packs = ""; if (Map.getMap(getIndex()).getCompatible() != null) { packs += "<p>This map works with the following packs:</p><ul>"; ...
5a2f4ca3-79b0-4497-87bb-4521cff62540
4
public boolean addPolyNode(int coefficient, int exponent){ //Check to see if exponent is a positive number(-1 = no exponent) if(exponent < -1) throw new IllegalArgumentException("Exponent must be a positive" + " integer."); //Check to see if Polynomial is empty ...
e2d8158b-3f35-4b04-9842-9a73c20173d7
0
@Override public void documentRemoved(DocumentRepositoryEvent e) {}
96e8dd1f-21b0-454c-8094-ef6eeb4cbfff
5
public static byte[] encryptSecretKey(SecretKey sk,PublicKey pk) { try { Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.ENCRYPT_MODE, pk); return cipher.doFinal(sk.getEncoded()); } catch (NoSuchAlgorithmException e) { e.printStackTrace(...
28fc4b78-f732-4462-b53e-0700df0daad3
9
public static KAryTreeNode<Integer> genRandomIntegerKAryTree(int k, int treeNodeCount, boolean full) { Random random = new Random(); KAryTreeNode<Integer> root = new KAryTreeNode<Integer>(random.nextInt(1000), k); int currNodeCount = 0; Queue<KAryTreeNode<Integer>> queue = new LinkedList<KAryTreeNode<Integer...
04b4d8ff-53b0-4ac8-b8b0-b0637a06ddad
8
public static int countNeighbours(boolean[][] world, int col, int row) { int c = 0; if (getCell(world, col - 1, row - 1) == true) { c += 1; } if (getCell(world, col, row - 1) == true) { c += 1; } if (getCell(world, col + 1, row - 1) == true) { c += 1; } if (getCell(world, col - 1, row) == true)...
e6d78b26-0445-46ed-ae24-52e8a26529e4
5
private void parseAndAddBiomes(Collection<ParameterNode> nodes) throws Exception { for (ParameterNode p : nodes) { if (!p.isGroup()) { continue; } ParameterGroup g = (ParameterGroup) p; Logger.getLogger(WorldGenerator.class.getName()).log(Level.SEVERE, g.toString()); if (!g.hasChild("colo...
7be638e6-7c78-4905-bbf0-bd59df254314
9
public boolean isPrimitive() { if (this.type.equals("void")) { return true; } else if (this.type.equals("byte")) { return true; } else if (this.type.equals("char")) { return true; } else if (this.type.equals("double")) { return true; ...
19d496c3-34fb-494b-97a9-044b19ffacc3
6
private void setLookAndFeel() { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (UnsupportedLookAndFeelException e) { // handle exception } catch (ClassNotF...
238f4791-d08a-40f7-b9c9-7eadbed61609
1
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { JFrame frame = new JFrame(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
82fff00f-684f-4b1e-baea-1ba5615d26a4
8
public static String rexecute(String command, String success, String failure){ //Queries the data class for login credentials. The data class directly queries //A local embedded database for the information. String username = data.getUser(); String hostname = da...
70720b9a-5561-4b80-b251-5b5785f12c01
5
public synchronized void unblock() throws IOException { boolean running = false; if (state == RUNNING || state == CONFIRMED || state == ERROR) { running = true; } state = CLOSED; if (socket != null) { socket.close(); socket = null; ...
5b47b8a2-deb7-47cd-b655-5b0deb65f798
5
public void openDoor(String name, InternalDoor door) { Avatar a = null; for(Avatar b: avatars){ if(b.getName().equals(name)){ a = b; } } if(a!= null){ String locName = a.getLocationName(); String doorName = door.getName(); Location l = locations.get(locName); for(GameObject g: l.getAllObj...
9d001093-fb6c-4755-97db-4dee0e3ce8fa
1
@Override protected TreeContainerRow clone() { TreeContainerRow other = (TreeContainerRow) super.clone(); ArrayList<TreeRow> children = new ArrayList<>(mChildren.size()); for (TreeRow row : mChildren) { row = row.clone(); children.add(row); row.mParent = other; } other.mChildren = children; other....
7cf9f41c-5cd6-4ebd-8ad3-b2fd5d4996dd
5
public List<ReceiptSaleSummaryBean> getCashOutData(final Long customerGroup, final Long revision) { List<ReceiptSaleSummaryBean> ret = new ArrayList<ReceiptSaleSummaryBean>(); List<Receipt> receipts = null; Currency currency = null; try { currency = CurrencyApiService.getByNumber(DbReader.getToken(), Long....
fcacde1c-12e1-4602-907f-03be2d3585f2
2
private void validerHeuresTransferees() { if (declaration.getHeuresTransfereesDuCyclePrecedent() < 0) { declaration.setHeuresTransfereesDuCyclePrecedent(0); declaration.ajouterMessageErreur("Nombre d'heures transférées du" + " cycle précédent est négatif. La valeur 0 s...
a2af7a1f-6d95-4b3b-9275-1830a64c5542
8
@Override public List<ChessPosition> getTargetPos(ChessPosition current) { List<ChessPosition> pos = new ArrayList<ChessPosition>(); ChessPosition CpTemp; int x, y, upBound, lowBound, leftBound, rightBound, value; int dx[] = { 0, 1, 1, -1, -1 }; int dy[] = { 0, 1, -1, 1, -1 }; // khoi tao gioi han di chuye...
6dcedda8-618f-460a-83d6-f963b40ce546
6
public boolean validateLocation(Point cellLocation) { MapObstacle obstacle = getMapObstacle(cellLocation); if (obstacle != null) { /* Note that this implementation provide a default obstacle event * handler "this.obstacleEvent(obstacle)" - see method above - that ...
ea3f97d6-8fea-4dd0-808a-c0b2e4cad1dc
4
private int jjMoveStringLiteralDfa33_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjMoveNfa_0(0, 32); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 32); } switch(curChar) { case 49: return jjMoveStringLiter...
9e387426-2934-4876-aac3-37d37c74c54a
0
public UserImplXml() throws DaoException { super("/xml/User.xml", User.class); }
44863a5e-da86-4440-a209-5068b9ddead1
6
public static void main(String[] args) { int[][] arr = {{75}, {95, 64}, {17, 47, 82}, {18, 35, 87, 10}, {20, 4, 82, 47, 65}, {19, 1, 23, 75, 3, 34}, {88, 2, 77, 73, 7, 63, 67}, {99, 65, 4, 28, 6, 16, 70, 92}, {41, 41, 26, 56, 83, 40, 80, 70, 33}, {41, 48, 72, 33, 47, 32, 37, 16, 94, 29}, {53, 71, 44, 65, 25, 43, 9...
26552adb-3cfb-4f08-9be6-4f3d97c5c78e
7
public static void equateValues(Proposition prop, Stella_Object term1, Stella_Object term2) { if (Stella_Object.eqlP(term1, term2)) { } else if (Logic.skolemP(term1)) { Skolem.bindSkolemToValue(((Skolem)(term1)), term2, false); } else if (Logic.skolemP(term2)) { Skolem.bindSkolemToValue(...
40f4fc29-273d-4813-b65d-839eda6bef98
2
public static void executeThreads(Runnable... runnables) { if (exct == null) { exct = Executors.newCachedThreadPool(); } for (Runnable r : runnables) { exct.execute(r); } }
c5a016da-58e7-477d-8d11-f4d74f63fa8f
9
public static void main(String[] args) { File file = null; if (args.length == 0) { JFileChooser chooser = new JFileChooser(); chooser.setFileFilter(new FileFilter() { public boolean accept(File f) { if (f.isDirectory()) return true; String filename = f.getName(); return filename.to...
3d030a38-ef2f-4aeb-8e19-e5a1fb6f840c
6
private void importConfig(){ File configFile = new File("voidCosmos.conf"); try { configHashMap = SimpleConfig.getHashMap(configFile); } catch (FileNotFoundException e) { JFileChooser jf = new JFileChooser(); jf.setFileSelectionMode(JFileChooser.FILES_ONLY); //only files jf.setMultiSelectionEnabled...
aebd4d32-5b8f-4a1e-a7e3-5f59cd34cc9b
0
public void desenhar(Graphics2D g2) { Rectangle2D.Double retangulo = new Rectangle2D.Double(this.getPosX(), this.getPosY(), largura, altura); g2.draw(retangulo); }
55b57bbd-64c4-4514-ba4d-e474b8e21ae6
8
private void saveConversionRules(Map<String, Set<String>> conversionRules, // Map<String, Set<String>> conflictRules, Map<String, Set<String>> exclusionRules) throws IOException { List<String> modeUsed = new Vector<String>(); modeUsed.addAll(conversionRules.keySet()); for (String m : conflictRules.keySet()) {...
5488e290-44f8-48a2-801c-4c7d1b1298cd
9
public void setOptions(String[] options) throws Exception { String tmpStr; setRawOutput(Utils.getFlag('D', options)); setRandomizeData(!Utils.getFlag('R', options)); tmpStr = Utils.getOption('O', options); if (tmpStr.length() != 0) setOutputFile(new File(tmpStr)); tmpStr = Utils.get...
66acecda-bf13-4f58-b665-4af59ba2c2e2
9
@Override public void run() { //streams BufferedReader bufferedReader = null; DataOutputStream dataOutputStream = null; try { //create wrapper streams bufferedReader = new BufferedReader(new InputStreamReader(this.socket.getInputStream())); dataOutputStream = new DataOutputStream(this.socket.get...
2432bd22-96e9-4e89-832d-6bddb68f50a8
6
public static int maxProduct (int[] seq) { int max_product = 1, min_product = 1, max_sofar = 0xFFFFFFFF; int temp_max_begin = -1; int temp_min_begin = -1; for (int i = 0; i < seq.length; i++) { if (seq[i] > 0) { max_product *= seq[i]; min...
01becc15-48de-458d-8ff4-e52382834a0a
1
public void draw(Graphics2D g) { g.drawImage(tileTexture, posX, posY, 16, 16, null); if(icon != null) g.drawImage(icon.getSubimage(0, 0, 32, 32), posX, posY, 16, 16, null); }
61f2acc6-0f30-44a3-8382-3d4ab0b49421
5
public static void addBan(String victim, int type, long length, String mod, String reason, int display) { PreparedStatement ps = null; ResultSet rs = null; // add player try { ps = conn .prepareStatement( "INSERT INT...
dce5f6df-f7b5-45ff-a7a8-e9399e5bc8ac
6
public void paintComponent(Graphics g2) { final int w = getWidth() / 2 + 1; final int h = getHeight() / 2 + 1; if (img == null || img.getWidth(null) != w || img.getHeight(null) != h) { img = createImage(w, h); final Graphics g = img.getGraphics();...
55b08c55-5588-4508-af26-2514682b55dc
3
public static Database createDatabase(DatabaseConfig config) throws InvalidConfigurationException { if (!config.isValid()) throw new InvalidConfigurationException( "The configuration is invalid, you don't have enought parameters for that DB : " + config.getType()); switch (config.getType()) { case My...
e6f11eeb-0f6c-42c4-8b6c-24fa067e944b
1
public void addErrorMessage(BeamMeUpMQError errorMessage) { if (this.errorMessages == null) { this.errorMessages = new ArrayList<BeamMeUpMQError>(2); } this.errorMessages.add(errorMessage); }
02a2a2bd-ee18-4a4f-a012-64b125d02694
6
public void drawState(int x, int y){ /* State Drawing Option * 0 = Regular drawing * 1 = Checker Board pattern * 2 = Randomized * 3 = Randomized/Checker Board */ if(rcflag){if(sdo == 1){ stateCheckDraw(x,y, false);}else{stateAltDraw(x,y);}} else{ switch(sdo){ ...
94ac2a76-e38a-4a37-a642-6d63583df4f4
7
private void MovieSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MovieSearchButtonActionPerformed String search = MovieNameTextField.getText(); String movieReturn; boolean wordSearched; wordSearched = Pattern.compile("[a-zA-z].*").matcher(search).matches(...
9a8ae572-8eba-49fd-adb2-1750a4f1155f
8
private String convertFileToString(File file) { final int bufferSize = 1024; if (file != null && file.exists() && file.canRead() && !file.isDirectory()) { Writer writer = new StringWriter(); InputStream is = null; char[] buffer = new char[bufferSize]; try...
208513dc-11d8-46ca-92da-93b0fbce76e6
7
public static Map<String, String> GetEntityColumnsWithParameters(Class<?> c, boolean hasAutoGenerated) { Map<String, String> res = new HashMap<String, String>(); for (Field field : Arrays.asList(c.getDeclaredFields())) { if ((field.isAnnotationPresent(Column.class) && hasAutoGenerated) ...
45afee7f-002e-4ca7-9763-baeae7dc5f9c
4
@SuppressWarnings("unchecked") public void handshake(Byte destination) { System.out.println("Handshaking initialized"); lock.lock(); byte sequence = (byte) (new Random()).nextInt(); while (sequence == 0) sequence = (byte) (new Random()).nextInt(); sequencer.setSequenceTo(destination, sequence); System...
07ab1b48-f411-4b13-8127-d94d57b4b27b
0
public void initializeConverter() { MAP = new HashMap(); UNIQUE_ID = 0; }
5243d32f-9a9d-4029-a03c-836efabe9334
8
protected Content throwsTagsOutput(ThrowsTag[] throwTags, TagletWriter writer, Set<String> alreadyDocumented, boolean allowDups) { Content result = writer.getOutputInstance(); if (throwTags.length > 0) { for (int i = 0; i < throwTags.length; ++i) { ThrowsTag tt = thro...
453f2c45-2888-4758-bab9-21006721c30a
0
@Autowired @Qualifier("dao") //TODO убрать заглушку, юзать dao public void setEmployeeDao(EmployeeDao employeeDao) { this.employeeDao = employeeDao; }
cbfe3bd4-6818-487d-be2f-5cb88b385d8a
9
public static Component getChild(Component parent, String name) { parent = getContainer(parent); if (parent instanceof JSplitPane) { JSplitPane split = (JSplitPane) parent; if (JSplitPane.TOP.equals(name)) { return split.getTopComponent(); } else if (...
770c7dd5-3729-4bcd-ab16-ef5ff2ee12b2
4
@Override public void componentResized(ComponentEvent e) { if(e.getComponent() == null || e.getComponent() instanceof JFrame == false) return; JFrame frame = (JFrame)e.getComponent(); Container contentPane = frame.getContentPane(); ...
db0886fd-4a63-42c8-bc68-ad7bacd1cd49
9
protected void calculateMotion() { boolean fallGlide = gliding && dir.y > 0; fallSpeed = (fallGlide)?glideFallSpeed:baseFallSpeed; maxFallSpeed = (fallGlide)?glideMaxFall:baseMaxFall; super.calculateMotion(); if((sprite.getCurrentState() == SCRATCHING || sprite.getCurrentState() == FIREBALL) && !(jumping ...
ecd4fe47-cd58-44e3-8211-9ade7149101e
8
@Override public void draw(Graphics2D g) { updateInformation(); if (list.size() == 0) return; if (!GUI.controls.get("v_bubble-all-vertices").isActive()) return; float alpha = transparency * (isOnPoint(graph.mousex, graph.mousey) ? 0.5f : 1.0f); if (alp...
bf97fd79-b70d-4f85-8277-f0b49b58bf6f
8
public int compareTo(PeptideLocationLine p) { if(this.chromosomeName < p.getChromosomeName()){ return -1; } if(this.chromosomeName > p.getChromosomeName()){ return 1; } if(this.startLocation < p.getStartLocation()){ return -1; } if(this.startLocation > p.getStartLocation()){ return 1; } ...
b5390160-a217-4aa7-8c2d-d99244a84df6
6
private void SetZipChckbx(String project ,JFrame frame){ String projectName=""; if("designer".equals(project)){ projectName="zip_designer"; }else if("res".equals(project)){ projectName="zip_res"; }else if("mobile".equals(project)){ projectName="zip_mobile"; } zipNameList=GetZipNames(projectName); ...
207ae4d0-2de6-4e18-8032-f678052129e3
4
private void setScrollPaneDefault(Attributes attrs) { // find the value to be set, then set it if (attrs.getValue(0).equals("starttime")) { scrollpaneDef.setStartTime(Integer.valueOf(attrs.getValue(1))); } else if (attrs.getValue(0).equals("endtime")) { scrollpaneDef.setEndTime(Integer.valueOf(attrs.getValu...
74e5f478-c8cf-423d-9e59-68b808382808
0
public String getName() { return Name; }
56caca4e-c36f-4ae3-86eb-b8f513ceb750
0
public Filter xnor( Filter other ) { return new Not( xor( other ) ); }
4dcc2338-afd2-4bdb-b4b1-ee2b0fd9cba1
8
protected Instances determineOutputFormat(Instances inputFormat) throws Exception { FastVector atts; FastVector values; Instances result; int i; // attributes must be numeric m_Attributes.setUpper(inputFormat.numAttributes() - 1); m_AttributeIndices = m_Attributes.getSelecti...
736d30f0-0257-4f2e-a34e-cf2a260a3781
2
@Override public void keyTyped(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_ENTER) { try { // login(); } catch (Throwable e1) { e1.printStackTrace(); } } }
067beec2-a643-4a16-b26a-202869ca0cd9
6
private void quicksort(int low, int high) { int i = low, j = high; // Get the pivot element from the middle of the list int pivot = numbers[low + (high - low) / 2]; // Divide into two lists while (i <= j) { // If the current value from the left list is smalle...
0e27b498-cb6d-4546-8348-1957e6235a60
5
public Tile[][] generateTBlock() { Tile[][] piece = new Tile[3][2]; for (int i = 0; i < piece.length; i++) for (int j = 0; j < piece[i].length; j++) { if (j == 0 || (j == 1 && i == 1)) ...
895e1d36-86c2-49cc-9634-1b9f809428df
9
public String escapeAttributeValue(String value) //protected void writeAttributeValue(String value, Writer out) throws IOException { int posLt = value.indexOf('<'); int posAmp = value.indexOf('&'); int posQuot = value.indexOf('"'); int posApos = value.indexOf('\''); i...
d22a34c8-78c3-4ecb-8495-9e1250a48cd1
4
private char randChar(boolean numbers) { if(numbers) { if(ClassParseTests.RANDOM.nextBoolean()) { if(ClassParseTests.RANDOM.nextBoolean()) { // 65-90 return (char) (ClassParseTests.RANDOM.nextInt(90 - 65) + 65); } else { // 97-122 return (char) (ClassParseTests.RANDOM....
0bfdf564-613e-4d57-acef-43b8496b0ea7
3
public void calcPossiblePos(MapScrollPane msp) { Tile[][] grid = msp.getGrid(); for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[i].length; j++) { if (Collision.noCollision(grid, new Point(i,j), new Point(i + width - 1,j + height - 1))) { this.possiblePos.add(new Rectangle(i,j,...
9cdc716c-c9e9-491e-892c-b230f7c55209
0
public void draw() { System.out.println("Draw Triangle"); }
36002c48-7fec-4fbb-a60e-f79488f4b125
0
void setState(State state) { this.state = state; }
f3f29bea-35c9-4309-b450-669f90dc3730
5
public static boolean dismissInvite(String[] args, CommandSender s){ //Various checks if(Util.isBannedFromGuilds(s) == true){ //Checking if they are banned from the guilds system s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin if you b...
21f2d484-76be-4ab4-ab4f-84b438933106
8
public void recoveryTokenCheck() { switch (this.currentToken) { case TokenNameLBRACE : RecoveredElement newElement = null; if(!this.ignoreNextOpeningBrace) { newElement = this.currentElement.updateOnOpeningBrace(this.scanner.startPosition - 1, this.scanner.currentPosition - 1); } this.lastCheckPoint ...
b09cfb99-a825-4b42-8246-0ccc16dbc35d
8
public List<ACommand.Executor> processClass(Class<?> clazz, Object instance) { List<ACommand.Executor> cmdList = new ArrayList<ACommand.Executor>(); Method[] methodList = clazz.getMethods(); for(Method method : methodList) { ACommand acmd = method.getAnnotation(ACommand.class); // skip it if it doesn't have...
751043a0-06fe-4a3a-94fc-8e404cbe4f1c
7
public static void dlModlist(File modlist, String dloc) throws InterruptedException, IOException{ FileReader fr = new FileReader(modlist); //Opens the selected modlist LineNumberReader lnr = new LineNumberReader(fr); //Used to read the modlist int totalmods = 0; //Start the...
bf96f49a-a3ad-4112-9183-9f32e792d706
1
@Test public void diag_test() { try{ double []mat= {1.0,2.0}; double[][]result = Matrix.diag(mat); double [][]exp= {{1.0,0.0}, {0.0,2.0}}; Assert.assertArrayEquals(exp, result); } catch (Exception e) { // TODO Auto-generated catch block fail("Not yet implemented"); } }
ad8a5e10-ee76-4784-b410-4a76bca48855
1
private Sound(String name) { try { clip = AudioSystem.getClip(); AudioInputStream inputStream = AudioSystem.getAudioInputStream( this.getClass().getClassLoader().getResource("sounds/" + name)); clip.open(inputStream); } catch (Throwable e) { e.printStackTrace(); } }
ec9a21ec-f6ef-46fc-b37c-90288933e4a9
3
@Override public int hashCode() { int hash = 5; hash = 23 * hash + (states != null ? states.hashCode() : 0); hash = 23 * hash + (initialState != null ? initialState.hashCode() : 0); hash = 23 * hash + (liveStates != null ? liveStates.hashCode() : 0); return hash; }
f9abd05c-287d-4f0f-bd28-76fe7ea3098a
7
private void btnIntersectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIntersectionActionPerformed JFileChooser saveFile = new JFileChooser(); int selected = saveFile.showOpenDialog(this); if(selected == JFileChooser.APPROVE_OPTION){ String path = saveFile.getSelectedFile(...
a18992f4-ea60-45f9-8738-683987fbe522
9
private void talk() { while (true) { question(); logWriteUser(question); if (exit()) { break; } else if (stop()) { answer(MSG_FOR_STOP); while (true) { question(); if (start())...
b693bcbd-c9a2-4cde-9d7c-2f74e95bc201
7
public static String task2(String expression) { int openBrackets = 0; for(int i=0; i<expression.length(); i++) { if(expression.charAt(i) == '(') { openBrackets ++; } if(expression.charAt(i) == ')' && openBrackets>0) { openBrackets --; ...