method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9021325c-46e9-4d6d-b1da-98a3bbf4f441
8
public void render(int[] pixels, int offset, int row) { for (int yTile = yOffset >> 3; yTile <= (yOffset + height) >> 3; yTile++) { int yMin = yTile * 8 - yOffset; int yMax = yMin + 8; if (yMin < 0) yMin = 0; if (yMax > height) yMax = height; for (int xTile = xOffset >> 3; xTile <= (xOffset +...
cefc4cfe-1373-4077-95b2-91c037dc557f
9
public void checkfold() { for (Widget wdg = child; wdg != null; wdg = wdg.next) { if ((wdg == cbtn) || (wdg == fbtn)) continue; if (folded) { if (wdg.visible) { wdg.hide(); wfolded.add(wdg); } } else if (wfolded.contains(wdg)) { wdg.show(); } } Coord max = new Coord(ssz); i...
91e3da47-57c9-450f-a7ca-c21dac03de08
6
public boolean search(DirectedGraph g, Node start, Node end) { //Initialize all the nodes in the graph LinkedList<Node> nodes = new LinkedList<Node>(); for(Node n : g.getNodes()) { n.status = Status.Unvisited; } start.status = Status.Visiting; nodes.add(start); Node node; while(!nodes.isEmpty()) {...
17bba418-90ce-4911-8637-cfa5966b75e5
5
@Override public void tick(double dt) { super.tick(dt); handleIntersections(); if (liveTime < armTime) { liveTime += dt; } else if (!armed){ arm(); } if (explode && !triggered) explode(); if (!touchingGround) { accelerate(0, 0.08); } }
29912fed-7ace-41a6-a3bb-1fbb544794b0
1
private static byte[] executeS(byte[] block) { byte[] helperBlock = splitInSextets(block); // execute S function on each byte // each resulting byte contains 4 bits for (int i = 0; i < helperBlock.length; i++) { ByteHelper.printByte(helperBlock[i]); helperBlock[...
f26c0e14-c349-4d12-a36e-4ba22afe195b
9
public String preSendShippingDate(int postalCode, int arrivalDate, String string) { int[] shippingDate = new int[6]; shippingDate[0] = arrivalDate / 10000;//amYear shippingDate[1] = arrivalDate % 10000 / 100;//amMonth shippingDate[2] = arrivalDate % 100;//amDay shippingDate[3] = arrivalDate / 10000;//pmYear ...
b854858d-7b0e-41b6-b830-333b9e93db15
9
public boolean newAccountsAllowed(String login, Session session, PlayerAccount acct) { switch(newAccountNameCheck(login,session.getAddress())) { case NO_NEW_PLAYERS: session.println(L("\n\r'@x1' is not recognized.",CMStrings.capitalizeAndLower(login))); return false; case BAD_USED_NAME: session.printl...
4f335a8c-8ede-48d0-8cd9-c680cbeff220
2
public static String LoadShader(String fileName) { StringBuilder shaderSource = new StringBuilder(); BufferedReader shaderReader = null; try { shaderReader = new BufferedReader(new FileReader("./res/shaders/" + fileName)); String line; while ((line = shaderReader.readLine()) != null) shader...
03ea96c5-d544-4f4c-ab23-904f12282044
0
@Override protected void setColoredExes() { coloredEx = LineGenerator.WuAlgorithm(begin, end); center = coloredEx.get(coloredEx.size() /2); }
1c731816-a19f-4587-9187-b4bfb1fd3559
3
public static void main(String[] args) { // Working with Loops int number = 1; while (number <= 10) { System.out.println(number); number++; } int number2 = 11; do { System.out.println(number2); number2++; } while (number2 <= 20); for (int i = 21; i <= 30; i++) { System.out.println(i)...
4bea2f64-a581-4dcb-84a7-6b62c11ead8c
0
@Override public void componentHidden(ComponentEvent e) {}
853db6f5-795e-4401-8c81-330bec02f2c7
2
private static void doAnalysis(String outfile, Level level) throws TesseractException, IOException { layout = analyzer.analyzeLayout(); do { BoundingBox box = layout.getBoundingBox(level); if (box == null) { // If the bounding box is null, this indicates ...
96fa168c-cddd-4f35-8436-1cd1481b594c
0
public void setRowsCount(int rowsCount) { m_rowsCount = rowsCount; fitVectorsToSize(); }
ef8d3b62-7d6e-41f0-9a14-6d1766775d0f
6
@Override public void move(Excel start, Excel finish) { if (start.getX() == begin.getX() && start.getY() == begin.getY()) { begin = finish; setColoredExes(); return; } if (start.getX() == end.getX() && start.getY() == end.getY()) { end = finish; setColoredExes(); return; } for(E...
dbd857cb-8e79-4ba5-8931-aec80b3f28ee
0
protected ConfigurationSection getSection() { return yamlConfiguration; }
396f641d-3947-424f-84da-c65372a52947
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
41a6384c-bb0c-49eb-83e0-bb44cfdd1519
5
public void run() { try { in = new ObjectInputStream(connection.getInputStream()); } catch (IOException ex) { Logger.getLogger(ILServer.class.getName()).log(Level.SEVERE, null, ex); return; } boolean going = true; MessageObj incoming; ...
29b6992f-de46-4574-9039-cd90e7db0ddf
5
public void saveRegion(final Region region, final boolean immediate) { final BufferedYamlConfiguration config = this.configuration.get((region.isDefault() ? null : region.world)); String path = region.name; if (region.isDefault()) if (region.world == null) { path = "...
4e489b1c-ffbd-4e46-8f41-f752706328f4
1
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed JFileChooser apkChooser = new JFileChooser(); apkChooser.setFileFilter(new APKFilter()); apkChooser.setDialogTitle(parser.parse("installApp:chooserTitle")); apkChoo...
d8a464be-c32e-4ba3-ab9c-cc5165b4fff3
4
protected void createCachedParticles(ParticleEmitter emitterDetails) { int particleNumber = 0; for (int colorHex : emitterDetails.possibleColors) { for (BufferedImage particleImage : emitterDetails.particleGraphics) { // Take a copy of our image so we can freely modify it without // affecting the origina...
f44fc845-fae6-458c-8f09-2cb0ab759f24
5
@EventHandler void buffdamage(EntityDamageByEntityEvent event){ if((event.getDamager() instanceof Player)||(event.getEntity() instanceof LivingEntity)){ try { Player p = (Player) event.getDamager(); ItemShell is = getShell(p); for(int i = 2;i<19;i++){ ...
831661f1-27e6-4789-9bd9-c30625a4920f
0
public void mapToMouse(GameAction gameAction, int mouseCode) { mouseActions[mouseCode] = gameAction; }
ffc61090-9e5b-4f07-81d6-372f11bfc0d3
0
public Player getPlayer() { return player; }
db2641c3-12ae-48c7-b229-7231c1d8e1aa
7
public NumberNodeEditor(NumberNode node) { this.m_Node = node; String name = node.getText(); Number value = node.getValue(); int iteratorType = node.getIteratorType(); boolean showCheckBox = node.getCheckable(); boolean selected = node.getSelected(); textForeground = UIManager.getC...
34789d39-564e-4609-9969-f9d40d77433d
3
public int getDocumentID(int rID) { int result = 0; String strStatement = "SELECT dID FROM report WHERE rID = " + rID; try { ResultSet rstResultSet = startQuery(strStatement); if (rstResultSet.next()) { result = rstResultSet.getInt("dID"); } } catch (ClassNotFoundException e) { _logge...
3806ece0-fc5f-47a7-96d5-369dfc9a914b
1
public void testFormatAppend_PrinterParser_null_Parser() { PeriodParser parser = new PeriodFormatterBuilder().appendWeeks().appendLiteral("-").toParser(); PeriodFormatterBuilder bld = new PeriodFormatterBuilder().append(null, parser).appendMonths(); assertNull(bld.toPrinter()); assertNot...
d6a1c0b0-a7e3-460f-abeb-bf50ffa01809
6
public void setCellAt(String value, int row, int column) { try { Properties properties = new Properties(); String currentPath = System.getProperty("user.dir"); properties.load(new FileInputStream(currentPath + "/src/tictactoe/resources/" ...
1db822a9-da70-4d8e-ba64-861bcf38f156
7
public void onDisable() { // save players for (ChatPlayer p : PlayerManager.getPlayersByServer(name)) { String pre = "players." + p.name + "."; persist.get().set(pre + "channel", p.channel); persist.get().set(pre + "listening", p.listening); ArrayList<String> modes = new ArrayList<String>(); for(Chat...
9daa23ea-4c08-4433-bdb3-e72caed2084c
0
private int getLinearity() { return myLinearity; }
1fd17261-bfba-4a72-a8f5-751e4b153c18
5
@Override public boolean isWin() { for (int i = 0; i < 3; i++) { if (checkColumn(i)) return true; if (checkRow(i)) return true; } if (checkDiagnol1()) return true; if (checkDiagnol2()) return true; return false; }
6a5586c1-f7ca-420f-a47f-bc552cdf03f2
6
private static void showWinner() { int winner = 0; for(LightCycle p : players) { winner++; if(p.alive()) break; } if(winner != 1) { wins = 0; streak = false; msg.setText("Wow! You lose!"); lastKey = null; } else { int points = gameBoard.percentLeft(); score = score + points; win...
acfe3d7a-b38a-4dd9-a653-8f0be3236f9f
0
@Override public String toString() { return String.format( "inPackage(%s)", this.targetPackage ); }
9e88a127-fcb0-474d-aff2-f906fdaba3db
0
public JComboBox getjComboBoxPracticien() { return jComboBoxPracticien; }
7afa712a-b0c8-4b3c-9246-22d8d18c4d5f
1
public DataFinder(Class searchClass) throws IllegalArgumentException { if (searchClass.getGenericSuperclass() != Persistent.class) throw new IllegalArgumentException(); this.searchClass = searchClass; this.indexGlobal = DataWorker.GetIndexGlobalName(searchClass); }
938ca9b4-9df4-46d1-a2e2-82a109d4c31a
1
public List<Object> getAny() { if (any == null) { any = new ArrayList<Object>(); } return this.any; }
e7174a8a-aeca-481a-a60b-39f212bf5e8e
6
public GridPanel(final Grid grid) { this.grid = grid; this.size = new Dimension(grid.width * BLOCK_SIZE, grid.height * BLOCK_SIZE); this.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { posX = e.getX() / BL...
f325c10c-6170-403f-b874-11d045180977
4
private boolean _jspx_meth_c_when_0(javax.servlet.jsp.tagext.JspTag _jspx_th_c_choose_0, PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // c:when org.apache.taglibs.standard.tag.rt.core.WhenTag _jsp...
bfc83c63-f6e9-4f06-bb20-9c36440820fd
0
public SortedSet get(String variable, String lookahead) { int[] r = getLocation(variable, lookahead); return Collections.unmodifiableSortedSet(entries[r[0]][r[1]]); }
4c924a57-4cf1-4fd2-a129-22ff8e587beb
0
public Command getTurnOffCommand() { return turnOffCommand; }
f45c8deb-196c-43b8-9a29-e6dbfa914be4
9
public String ProcessTransaction(HttpMethod httpMethod, String url, Object data) throws BeanstreamApiException { try { Gson gson = getGsonBuilder().create(); String json = data != null ? gson.toJson(data) : null; // this is a temporary printl...
c25e49fc-a0a4-4909-9024-f9a8aaddc549
5
protected Date parseWFTDate(String[] words) throws MalformedDateException { if (!words[1].equalsIgnoreCase("EST")) throw new MalformedDateException("Second word \"" + words[1] + "\" not recognised in WFT date"); if (words.length < 3) throw new MalformedDateException("Too few words in WFT date"); if (w...
abc7b20f-5c7c-440b-8e6c-055fce3206c6
2
String readFile(String fileName) { File file = new File(fileName); if (!file.exists()) fatalError("No such file '" + fileName + "'"); if (!file.canRead()) fatalError("Cannot open file '" + fileName + "'"); return Gpr.readFile(fileName); }
4ec0b249-f46b-4fc4-a15f-90476a856f85
1
public void stop() { try { safeClose(myServerSocket); closeAllConnections(); myThread.join(); } catch (Exception e) { e.printStackTrace(); } }
5d258449-22ce-4d11-b2ec-f6cfc6630408
3
public void updateTrackLabel(Track t) { String result = ""; String s; if ((s = t.get("title")) == null) s = "Unknown"; result += s + " - "; if ((s = t.get("artist")) == null) s = "Unknown"; result += s + " - "; if ((s = t.get("album")) == ...
74297d5b-d374-45f1-a61a-c5211f1777b2
8
public void decode(final CachedInputStream pool) throws IOException { final InputStream input = (CachedInputStream)pool.clone(); // Make sure that everything is clear pmap.clear(); // Code version int version = input.read(); if((version & 0x7f) != DJVUPALETTEVERSION) { throw n...
0158984c-6f4a-45ed-b125-84e85cd95841
1
@Override public JSONObject main(Map<String, String> params, Session session) throws Exception { JSONObject rtn = new JSONObject(); User activeUser = User.findById(session.getActiveUserId()); if(!activeUser.isRemoving()) { rtn.put("rtnCode", this.getRtnCode(405)); return rtn; } session.setActiveU...
1003d01e-407a-4573-a4ef-464da5fac1f2
0
public void setCarTyp(CarType value) { this._carType = value; }
d08d7d9e-cdf0-4779-97fd-cf4e3de5e21e
3
public void endAudioChat(String chat){ AudioThread thread = audioRooms.get(chat); if (thread==null) return; Scanner scanner = new Scanner(chat); String sender = scanner.next(); String target = scanner.next(); ChatServerThread senderThread = users.get(sender).getThread(); if (senderThread...
cfdae76b-c808-4b8e-8b2f-f5f939d517e7
5
public void run() { Query query = new Query("p", new Term[] { new Atom("a"), new Atom("a") }); for (int i = 0; i < 10; ++i) { try { query.hasSolution(); } catch (JPLException e) { System.out.println("Threaded p(a, a) threw exception: " + e); System.exit(1); } System.out.print(id_); ...
d3085fe2-9bda-4395-b44a-8c27833cec9a
7
public static Clustering kMeans(Cluster[] centers, List<? extends Cluster> data) { int k = centers.length; int dimensions = centers[0].getCenter().length; ArrayList<ArrayList<Cluster>> clustering = new ArrayList<ArrayList<Cluster>>(); for (int i = 0; i < k; i++) { ...
40318214-b8a5-4ce6-b6b8-4c5121a7f73e
0
@Override public void execute(DebuggerVirtualMachine dvm) { dvm.executionFinished(); }
968d76a9-e8f8-436f-aca9-210304c6cd31
2
public ArrayList<Gebruiker> getAlleGebruikersDB() { ArrayList<Gebruiker> alleGebruikersDB = new ArrayList<Gebruiker>(); try { this.leesDatabase(); output = statement.executeQuery("SELECT * FROM gebruiker "); while (output.next()){ int rol_id = output.getInt("rol_id"); String naam = output.getStrin...
099f652b-4316-4a2f-8be2-2f8daa9df770
2
public void parseProcessState(ProcessState s) { int exitCode = s.exitCode; if (exitCode != 0 && !expectExit) { JOptionPane.showMessageDialog(this, "Launched game process unexpectedly exited with code: " + exitCode, "Process died", JOptionPane.ERROR_MESSAGE); } btnLaunch.set...
c839c072-6fe9-4522-93c4-1b069f7b17c1
0
@EventHandler public void postLoad(FMLPostInitializationEvent event) { }
68a13267-c015-4fcd-8a4a-3b28373b0dc3
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof User)) { return false; } User other = (User) object; if ((this.userID == null && other.userID != null) || (this...
5cea6976-4f52-45af-9468-9941d856727d
2
@Override public void mark(int boardPosition, Cell[] cellBoard, int rows, int columns) throws IllegalMark { //Find the row. int boardPositionRow = boardPosition / columns; //Find the column. int boardPositionColumn = boardPosition % columns; //Position to ma...
9172b9c7-a134-4820-80a1-44c96080bbb1
7
private void displayNeuronBrief(){ ArrayList<Node> neurons=new ArrayList<>(); for(int i=0;i<currentNetwork.getNeurons().size();i++) neurons.add(currentNetwork.getNeurons().get(i)); neurons=Node.sort(neurons); for(int i=0;i<neurons.size();i++){ Neuron neuron=(Neuro...
2a62b3a2-2be3-4b45-a532-f3633f59792c
7
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if (args.length == 0) { if (player == null) { sender.sendMessage(ChatColor.GOLD+"[ SimpleMail "+plugin.ge...
1ad4eb5f-3453-45c2-a206-255523ea0292
5
public static String indexToOptionID(int index) { String optionId = null; switch (index) { case 1: optionId = GRE_OPTION_A; break; case 2: optionId = GRE_OPTION_B; break; case 3: optionId = GRE_OPTION_C; break; case 4: optionId = GRE_OPTION_D; break; case 5: optionId = GRE_OPTIO...
046dae1f-99d6-4598-9998-37872fb133f5
4
@Override public void receivedObject(POWMessage m, Connection c) { alreadyRequested.remove(m.getInventoryVector()); if (datastore.put(m)) { for (Connection con : connections) { if (con != c) { con.advertiseObject(m.getInventoryVector()); } } if (m.getCommand().equals(MsgMessage.COMMAND)) { ...
b85e6e79-87b6-4046-baef-160f8ff4303f
0
public T getSecond() { return second; }
486231c0-3e97-4b6d-9941-5fc8d35b80e9
1
public TreeIterator(TreeElement<TreeValue> place) { if (place != null) { this.place = place; this.way = new Stack<>(); this.way.push(place.getValue(), place.getId(), place.getLeftSon(), place.getRightSon()); } }
267eba5d-16a3-4b2b-9635-e25989311ef7
9
@SuppressWarnings("unchecked") private void getEvidenceList(String actionType) { titleDLM.removeAllElements(); evidenceResultList = evidence.getEvideces(fileName, actionType, teamType); if (evidenceResultList.size() != 0) { for (int i = 0; i < evidenceResultList.size(); i++) { titleDLM.addElement(evidence...
805aff0f-8748-464c-8174-5939da97d479
5
void hookExampleWidgetListeners () { if (logging) { Widget[] widgets = getExampleWidgets (); for (int i = 0; i < widgets.length; i++) { hookListeners (widgets [i]); } Item[] exampleItems = getExampleWidgetItems (); for (int i = 0; i < exampleItems.length; i++) { hookListeners (exampleItems [i])...
d8e216ca-98da-4dd7-95f7-fd53c2f7139d
3
private String getXMLValue() { FileInputStream fis = null; String value = ""; try { fis = new FileInputStream(new File("D:/xml.xml")); Properties prop = new Properties(); prop.loadFromXML(fis); value = prop.getProperty("foo"); }...
d1299288-e211-43c0-baba-888e9bcb5d98
7
public void copyNewKeysToDisk(String fileName){ InputStream in = plugin.getResource(fileName); if (in == null)//File isn't in our jar, exit. return; //Load the stream to a ymlconfig object. YamlConfiguration locales = new YamlConfiguration(); try { locales.load(in); } catch (IOException e1) {e1.pr...
aead5f4c-6158-4603-a199-7c7d97f66cfd
2
@Override Integer deleteEntity(Criteria criteria, AbstractDao dao) throws DaoException { criteria.addParam(DAO_DIRECTION_STATUS, DELETED); Integer res = updateDirection(criteria, dao); List<Direction> list = getEntity(criteria, dao); for (Direction d : list) { List<Tour> ...
38f4aa06-3ece-4f30-8554-cbf7e809a486
3
public static byte[] gzip(String input) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzos = null; try { gzos = new GZIPOutputStream(baos); gzos.write(input.getBytes("UTF-8")); } catch (IOException e) { e.printStackTrace(); } finally { if (gzos != null) try { ...
7f28ca25-38d3-428a-9861-ff9ae46c11e0
4
@Override public boolean equivalent(Type that) { if (!(that instanceof TypeList)) return false; List<Type> olist = ((TypeList)that).list; if (list.size() != olist.size()) return false; for (int i=0; i<list.size(); ++i) { ...
93b5cafe-d10b-4f0f-bf15-34ad9f93ae99
1
public void test_getMillis_long_long() { assertEquals(0L, iField.getMillis(0L, 567L)); assertEquals(1234000L, iField.getMillis(1234L, 567L)); assertEquals(-1234000L, iField.getMillis(-1234L, 567L)); try { iField.getMillis(LONG_MAX, 567L); fail(); } catch (...
dd30b373-339c-467a-8681-3123d22bff86
4
private static WebDriver createLocalDriver(Capabilities capabilities) { String browserType = capabilities.getBrowserName(); if (browserType.equals("firefox")) return new FirefoxDriver(capabilities); if (browserType.startsWith("internet explorer")) return new InternetExplorerDriver(capabilities); if (brows...
60dc5f38-fa66-4fc4-b9f5-c89bad129cb5
5
public NNetwork(IActivationFunction function, int ... layers) throws NNException { if (layers.length < 2) { throw new NNException("A neural network must have at least 2 layers."); } inputLayer = new ArrayList<>(layers[0]); outputLayer = new ArrayList<>(layers[layers.length - 1]); midLayers = new ArrayList<...
3b400658-3dc5-4781-b23b-cda4fdf76dfe
5
private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed // TODO add your handling code here: String busqueda = tfBusqueda.getText(); boolean esDigito = StringValidation.validaDigitos(busqueda); boolean esCorreo = StringValidation....
7f542df1-b040-4722-8f4c-54f101a6f423
4
public Grid getGrid() { boolean test = false; if (test || m_test) { System.out.println("Game :: getGrid() BEGIN"); } if (test || m_test) { System.out.println("Game :: getGrid() END"); } return m_grid; }
23754c45-77dd-459e-b37a-f9032aae97f2
7
public static void initalize(String[] args){ if(args.length == 0){ printUsage(); Zegana.quit = true; return; } Zegana.parseArguements(args); if(Zegana.verbose) System.out.println("Reading card list"); Zegana.readCards("Zegana/standard.txt"); Zegana.currentGen = new Deck[genSize]; if(Z...
135e7c0e-cb21-4ba1-9ba5-dbb23db7d1a2
8
public static ArrayList<MstxImage> getMstxImageList(int mid) { ArrayList<MstxImage> result = new ArrayList<MstxImage>(); Connection con = DBUtil.getConnection(); PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = con.prepareStatement("select * from mstx_image where mid=?"); pstmt.setInt(...
be766a2a-9139-42ab-8b6c-60d815120f56
0
public boolean contains(int datum) { return indexOf(datum) >= 0; }
4837d22f-f6a8-4c23-a833-d7e542c56ea5
0
public boolean inCut(int v) { return marked[v]; }
8a1a3be5-9d39-4c51-9a59-e0d1a0c235da
7
public double getDirectionAngleChange(){ double sum = 0; long preX = mousePointer.getXpix(), preY = mousePointer.getYpix(); double preAngle=0,a,da; boolean isFirst = true; if (0 == mouseMoves.size()) return 0; int index = noSkipFirstPoint()?0:1; MouseMove mouseMove; for (;index<mouseMoves.size();index++...
2dad9f0d-3e34-41ae-b1cb-9be7f313f63a
1
public Pawn getNextPawn() { if (pawns.size() == 1) { currentPawn = pawns.get(0); return pawns.get(0); } else { final Pawn result = currentPawn; currentPawn = this.pawns.get((this.pawns.indexOf( currentP...
3a869eb7-7288-479d-b1f2-07eb0aa6e6ce
9
private static String skipToNextChild(String s) { int idx; int nest; idx = 0; if (!s.contains(")")) return (null); else if (!s.startsWith("(")) { while (s.charAt(idx) != '(') idx++; return (s.substring(idx)); } else { nest = 0; while (s.charAt(idx) != ')' || nest > 1) { i...
cf491e9b-050d-40f8-804d-c103705bf428
1
@Override public void run() { long time = System.currentTimeMillis(); while(System.currentTimeMillis()-time<80){} animation = type.checkAnimationState(prevAnimation); prevAnimation = animation; }
d3735ad8-1d4d-4596-9803-62e44dee8c42
3
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof PlayerDetailsMessage)) return false; PlayerDetailsMessage that = (PlayerDetailsMessage) o; return !(playerName != null ? !playerName.equals(that.playerName) : that.playerName != null); }
e50112f1-2c1c-46c9-8e77-06003f1870d0
7
public Blob2D deletePointBefore(int k) { int n = points.length; if (n < 4) return this; float[] x = new float[n - 1]; float[] y = new float[n - 1]; if (k > 0 && k < n) { for (int i = 0; i < k; i++) { x[i] = points[i].x; y[i] = points[i].y; } for (int i = k + 1; i < n; i++) { x[i - 1] =...
1c0a07ef-ec64-4696-b086-9e82ef6a89e7
6
@Override public void processDraw(Graphics g, ImageObserver imgObserver, boolean isEnterSub) { // 背景画像 g.drawImage( _model.getBg(), 0, 0, imgObserver ); // 背景ブロック描画 for ( int i = 0, len = _model.getBgBlockPos().size(); i < len; i++ ) { List< Integer > pos = _model.getBgBlockPos().get( i ); g.drawIm...
72792373-6992-4263-9de8-690b16e9e5d2
4
public void draw(Graphics2D canvas) { for (GameObject object : inactiveObjects) { if (is(TraceFlag.DRAWS)) { System.out.println("\tdraw inactive object: " + object.getID()); } object.draw(canvas); } for (GameObject object : activeObjects) { if (is(TraceFlag.DRAWS)) { System.out.println("\tdraw...
a8708477-f8b8-4dae-a169-38a499370b25
7
@Subscribe public void packChange(PackChangeEvent evt) { final PackChangeEvent event = evt; SwingUtilities.invokeLater(new Runnable() { public void run() { if (event.getType() == PackChangeEvent.TYPE.ADD) { boolean doneWork = false; ...
944ac724-6089-45ec-b17a-f637165d6daa
6
public void keyPressed(int k) { if(player.getMovable()){ if(k == KeyEvent.VK_LEFT) player.setLeft(true); if(k == KeyEvent.VK_RIGHT) player.setRight(true); if(k == KeyEvent.VK_W) player.setJumping(true); if(k == KeyEvent.VK_R) player.setScratching(); if(k == KeyEvent.VK_F) player.setFiring(); } }
fd1100d6-2c3f-4add-aa2d-ae15f8c08cb0
7
boolean calc(GtexExperiment gtexExperiment) { boolean changed = true; int iteration; if (verbose) System.err.print(gtexExperiment.getTissueTypeDetail() + "\t"); for (iteration = 0; changed && iteration < MAX_ITERATIONS; iteration++) { changed = false; HashSet<Entity> done = new HashSet<Entity>(); for...
07b35a72-1515-40c0-a3e3-ce01a986c141
4
public static int getPlantAmount(int plantType) { if (plantType == GREEN_PLANT) { return GREEN_PLANT_AMOUNT; } if (plantType == RED_PLANT) { return RED_PLANT_AMOUNT; } if (plantType == YELLOW_PLANT) { return YELLOW_PLANT_AMOUNT; } if (plantType == MAGENTA_PLANT) { return MAGENTA_PLANT_AMOUNT;...
da7aa5dd-05db-4844-a41b-dad60c99eb1b
9
public void run(int nOfIterations){ int i = 0; while (i < nOfIterations){ i++; ArrayList <Chromosome> newPopulation; newPopulation = new ArrayList<Chromosome>(); for (Chromosome aSubject : population){ if (isTimeToMutate()) aSubject.mutate(); else { for(Chromosome aCouple : po...
99028bf3-fa1d-4cbf-96a5-7c324c4faae0
5
public void renderPixel(int xp, int yp, int col, int alphaPercentage) { xp -= xOffset; yp -= yOffset; if (xp >= 0 || yp >= 0 || xp <= (width << Level.PDRX) || yp <= (height << Level.PDRY)) return; if (col != 0xFFFF00D0) pixels[xp + yp * width] = col; }
34b469a2-6504-4f6c-a523-ce39e01f79eb
2
public void update(long deltaMs) { if(!messageQueue.isEmpty()) { messageQueue.peekFirst().update(deltaMs); if(messageQueue.peekFirst().finished()) { nextMessage(); } } }
f319d727-a890-4377-a66c-331cd7f5095d
4
protected void leftRotate(TreeNode<K, D> nd) { TreeNode<K, D> nd2 = nd.right; if (isNil(nd2)) { return; // do nothing } //turn nd2's left subtree into nd's right subtree nd.right = nd2.left; if (!isNil(nd2.left)) { nd2.left.parent = nd; } ...
610299a0-547b-4b5d-94ba-fd2eac902861
7
public static void downclassifyOneDescription(LogicObject self) { { Object old$Classificationsession$000 = Logic.$CLASSIFICATIONSESSION$.get(); try { Native.setSpecial(Logic.$CLASSIFICATIONSESSION$, Logic.getClassificationSession(Logic.KWD_DESCRIPTION)); if (!LogicObject.downclassifiedP(self)...
af2e19e1-d661-48f4-bead-9467fe8789b9
3
@SuppressWarnings("unused") private static int find_card( int rank, int suit) { int i, c; for ( i = 0; i < 52; i++ ) { c = deck[i]; if ( ((c & suit) > 0) && (((c >> 8) & 0xF) == rank) ) return( i ); } return( -1 ); }
bcf711d4-009f-41c8-b9a6-863fb931b721
8
public Expr evaluate(IEvaluationContext context, Expr[] args) throws ExprException { assertArgCount(args, 3); Expr et = evalArg(context, args[0]); if (!isNumber(et)) return ExprError.VALUE; int trials = ((ExprNumber) et).intValue(); if (trials < 0) ...
b8d5d8a5-53db-4093-a504-08af4b3f32a2
2
@Override protected String getChildNodesXPath() { switch (variant) { case SIDEBAR: return SIDEBAR_CHILD_LINK; case CENTRAL_INDEX: return INDEX_CHILD_REF; } return null; }
fe7b8372-9d7c-4bbb-88c1-d868f62df647
5
public String getToken() { String retorno = this.getNumber(); if (retorno != null) { return retorno; } retorno = this.getString(); if (retorno != null) { return retorno; } if (this.getBegin() < this.getCad().length() && (this.getCad().charA...
e8d707e7-5949-4144-8481-17d784b36313
9
private void quicksort(int low, int high) { incrementRekursionDepth(); int i = low, j = high; // comparison element // is median of the array values with highest, lowest and middle index int middle = (low + high) / 2; int comparisonElement; if (array[countStep(middle)] < array[countStep(high)] && arra...