method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
be61e083-4ba5-4aa1-9d34-22ba372bc421
4
public boolean checkTables() throws SQLException, ClassNotFoundException { sqlClass(); DatabaseMetaData dbm = sqlCon().getMetaData(); ResultSet tables; if (forumType.equalsIgnoreCase("xenforo")) { tables = dbm.getTables(null, null, tablePref + "user", null); } else if (forumType.equalsIgnoreCase("smf") ...
34432a8d-b8e6-40ea-9d99-08777d60d9d1
8
@Override public void mouseClicked(MouseEvent e) { if (_move != null) { return; } Component c = _gameboard.findComponentAt(e.getX(), e.getY()); if (c instanceof PieceGUI) { PieceGUI p = ((PieceGUI) c); if (p.isSelected()) { p.setSel...
eff09643-c5b9-4193-b1b0-65794cc2199e
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; FightState other = (FightState) obj; if (!Arrays.deepEquals(atkCnt, other.atkCnt)) return false; if (spareDamage != other.spareDa...
0ea5bfaa-96be-4ff1-b164-79295d75dd6a
9
@Override public boolean execute(String code) { int indexValue = 0; int pointerToAdd = 0; String effectiveAddress = ""; String val = ""; seperateCode(code); // Get addressing mode. int addressMode = getAddressingMethod(code); try { ...
9419fe7b-6d74-4fcb-b7ba-5ecb859eb5e9
6
public float[][] decode() throws IOException { while(true) { int len = dsp.synthesis_pcmout(pcmp, idxp); if(len > 0) { float[][] ret = new float[chn][]; for(int i = 0; i < chn; i++) { ret[i] = new float[len]; System.arraycopy(pcmp[0][i], idxp[i], ret[i], 0, len); } dsp.synthesis_read(len)...
680daba8-fad4-41c8-a2c2-a0fbf0b2551a
2
public static TestInstanceInfo getTestInstanceInfo(HierarchicalConfiguration testInstanceData) { TestInstanceInfo testInstanceInfo = null; if (testInstanceData != null) { try { testInstanceInfo = new TestInstanceInfo(); testInstanceInfo.setId(testInstanceData....
93515403-5f57-4c73-aa75-d708a55609e0
0
protected void initDefaultCommand() {}
edfde7d4-7ae3-496e-b1d3-7bb26cfbc0af
9
private void jComboBox_AssetContractsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_AssetContractsActionPerformed System.out.println("In Action for Asset Combo main tab"); /*String nymID = Utility.getKey(nymMap, (String) jComboBox1.getSelectedItem()); String assetID...
71c8e05f-30c7-403f-ad61-a27d2ce98cc2
0
public long getT() { return initTemps[1]; }
69f5cc2f-2304-4779-b863-0636e45684e4
6
public void handleCustomPayload(Packet250CustomPayload var1) { ModLoader.receivePacket(var1); MessageManager inst = MessageManager.getInstance(); if (var1.channel.equals("REGISTER")) { try { String channels = new String(var1.data, "UTF8"); ...
509c1925-d058-4923-b149-2647dc58d10b
8
protected void inAttrib(final char c) { switch(c) { case ' ': case '\t': case '\r': case '\n': changedTagState(State.INPOSTATTRIB); return; case '=': changeTagState(State.BEFOREATTRIBVALUE); return; case '<': endEmptyAttrib(bufDex); piece.innerStart = bufDex; abandonTagState(State.BEFORETAG); r...
fe4d6623-1a4c-4b7e-a9bf-d8f8b41292b0
7
static final void method1430 (int i, byte i_1_, int i_2_, int i_3_, int i_4_, int i_5_, int i_6_, int i_7_, Mob class318_sub1_sub3_sub3, Mob class318_sub1_sub3_sub3_8_) { try { anInt2567++; int i_9_ = class318_sub1_sub3_sub3.method2425(-1); if (i_9_ != -1) { Object object = null; RasterToolkit ...
aa8438d3-6252-453c-a593-f8f90207a6f9
4
private boolean checkResource(Collection list, int id) { boolean flag = false; if (list == null || id < 0) { return flag; } Integer obj = null; Iterator it = list.iterator(); // a loop to find the match the resource id in a list while ( it.hasNex...
33a6e55b-be68-4f18-bd69-7c71824134a6
1
public void connectDb() { startSQL(); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection(url, user, password); st = con.createStatement(); } catch (Exception e) { e.printStackTrace(); ...
096434c3-4a7a-4b58-8035-09f5a6b89eed
8
private void createErrorImage() { Image eImg = new Image(rfr.getW(), rfr.getH()); for(int i = 0; i < errorBlocks.size();i++)//find min and max { RGB[][] e = errorBlocks.get(i); for(int y = 0; y < 16; y++) { for(int x = 0; x < 16; x++) { double err = getGrayPixel(e[x][y].getRGB()); if(...
d14bb3ec-08ae-4e81-b971-13d5ac027adc
1
public void setProtected(final boolean flag) { int modifiers = classInfo.modifiers(); if (flag) { modifiers |= Modifiers.PROTECTED; } else { modifiers &= ~Modifiers.PROTECTED; } classInfo.setModifiers(modifiers); this.setDirty(true); }
56a4772d-b295-4197-a0b6-8f3137bd72f1
1
private void sleep() { try { Thread.sleep(1000); } catch (InterruptedException e) { throw new CrawlerException("main thread died. ", e); } }
80cb8b9a-dc22-45c4-a05e-c020feeb43b1
4
public ListRadio(String[] list, String selecionado) { setLayout(new FlowLayout(FlowLayout.LEFT)); setBorder(new EmptyBorder(-10, 0, 0, 0)); boolean primeiro = true; for (String nome : list) { boolean marcado = false; if (primeiro) { primeiro = false; marcado = true; } if (selecionado !...
f76f3c3e-f288-400f-b0df-24bdf3f94441
1
public void openDevice(int index) { // Opens the device takes in index you // want to use deviceIndex = index; // Sets the index to the parameter try { // beginning of a try catch block sender = JpcapSender.openDevice(devices[deviceIndex]); // Opens the // selected //...
9bd0cbc7-ec02-498d-8321-97b91db6b702
9
@Override public void write(String currentDVDFile, String masterDVDFile) throws FatalBackEndException { FileWriter cdf, mdf; try { cdf = new FileWriter(currentDVDFile); } catch (IOException ex) { throw new FatalBackEndException(ex.getMessage(), FileType.CurrentDVD, currentDVDFile); } try { ...
5eabc9f4-46ac-43ee-ada8-1d232fc78014
7
public boolean SetBusActiveStatus(int busNumber, int inputBufferNumber, int packetSequence, int TIME, ConfigFile cfg) { //REMOVE IN CROSSBAR FABRIC TYPE //only one bus present in this fabric type, busNumber = 0; //ensure valid busNumber chosen if(((busNumber+1)<= VE...
e09b0241-0dd8-48eb-bc88-b1b1f3f6c8b5
8
public static void moveFile(File source, File dest){ StringBuilder debugMessage = new StringBuilder(64); debugMessage.append("Unable to move:\n"); debugMessage.append(source.getPath()); debugMessage.append("\nto:\n"); debugMessage.append(dest.getPath()); debugMessage.app...
caa46388-6758-41fb-83f2-f7bee2950b51
3
public void setLowerAndUpperBounds(double lower, double upper) { if (data == null) { return; } this.originalLowerBound = lower; this.originalUpperBound = upper; if (originalLowerBound < min) { offset = Math.abs(originalLowerBound) + 10; } else { ...
18fd3b9b-529d-4491-b626-c05f2836e164
4
public void keyReleased(KeyEvent e){ int key = e.getKeyCode(); if (key == KeyEvent.VK_RIGHT || key == KeyEvent.VK_LEFT){ dx = 0; } if (key == KeyEvent.VK_UP || key == KeyEvent.VK_DOWN){ dy = 0; } }
cb632c52-2d7d-4089-84d4-3343f4ae0d38
8
public int canAdd(CardStack src) { if(orderedPair(this.top(), src.chosen())) return 1; // If stack clicked twice on & doubleclicking set to select all // ordered cards, select them else if(src == this) { if(doubleClickSelect && nSelected < nOrdered() && nSelec...
81635795-d929-4616-a03b-0cf3fd1b34cb
6
public void damageDetection () { if (character.equals("P1")) { P2AttackArea getHit = (P2AttackArea)getOneIntersectingObject(P2AttackArea.class); hurt = false; if (getHit != null) { hitpoint-= getHit.damageDealt(); hurt =...
4d5d3c98-10aa-4a4c-9ff6-95016d1855fb
3
private int computeColorDepth(int colorcount) { // color depth = log-base-2 of maximum number of simultaneous colors, i.e. // bits per color-index pixel if (colorcount <= 2) return 1; if (colorcount <= 4) return 2; if (colorcount <= 16) return 4; return 8; ...
1778d482-c842-4c22-9783-19aabd5fd082
1
public float[] clone1df(float[] orig){ int ii = orig.length; float[] temp = new float[ii]; for (int i = 0; i<ii; i++){ temp[i] = orig[i]; } return temp; }
7169d6e5-e513-46e5-a492-243ec616f06a
7
@Override public void getAlleOpdrachten(OpdrachtCatalogus opdrachtCatalogus) { try { con = JDBCConnection.getConnection(); String query = "select opdrachten.idopdrachten, opdrachten.vraag,opdrachten.antwoord,opdrachten.maxAantalpogingen,opdrachten.antwoordHint,opdrachten.maxAntwoordTijd, opdrachtcategorieën.op...
8ee044b6-7b1d-4461-b6e8-c07cad1dc6a8
9
public String convert(String s, int nRows) { if (s == null || s.length() == 0 || nRows <= 0) { return ""; } if (nRows == 1) { return s; } StringBuilder res = new StringBuilder(); //every 2 column will be (2 * row - 2) int size = 2...
48048df8-6fba-490f-94b6-838428c07279
0
@Test public void testTruncate_trim() { String s = " Already short enough, when trimmed. "; Assert.assertEquals( "Already short enough, when trimmed.", _helper.truncate(s, 35) ); }
d7eb1164-758e-48b9-b933-385d674f1074
3
private DatabaseManager(ConnectionSource source){ this.source=source; try { TableUtils.createTableIfNotExists(source, Info.class); QueryBuilder<Info, Integer> queryEvent=getInfoDao().queryBuilder(); queryEvent.where().eq("key", DATABASE_VERSION_KEY); Info info=queryEvent.queryForFirst(); if(in...
c7c19b1c-f9dc-4636-bd24-be52f0bc9a81
6
public void DeleteProjeto(Projeto projeto) throws SQLException, excecaoDeletarElemento { Connection conexao = null; PreparedStatement comando = null; try { conexao = BancoDadosUtil.getConnection(); comando = conexao.prepareStatement(SQL_DELETE_UM_PROJETO); ...
d5b6cf0d-d2d9-4a21-9f95-4f9d7cc11b5d
0
public ArraysDataBase(){ arraysBase = new ArrayList<DataStructures>(); }
94601815-aa14-4524-87b3-a7649cd12163
7
public static Keyword continueForallProof(ControlFrame frame, Keyword lastmove) { lastmove = lastmove; { boolean testValue000 = false; if (frame.reversePolarityP) { testValue000 = true; } else { { { boolean alwaysP000 = true; { PatternVariable var = null...
3cfc5343-9b62-425d-8212-ed6a4dda3c9d
5
public void pedirAmistad(String Nick, String receptor) { //?? try { String queryString = "INSERT INTO peticionAmistad ( emisor, receptor) VALUES(?,?)"; connection = getConnection(); ptmt = connection.prepareStatement(queryString); ptmt.setString(1, Nick); ...
bcdddf5f-d460-4ac5-88b7-f3745abad7e2
0
public String getConsumerSecret() { return consumerSecret; }
5a34c106-6ab5-475e-8566-b95b0df63fb8
3
public void actionListener (Action e) { switch (e.getActionType()) { case "start": start(white_player); break; case "quit": unRegisterPlayer(curPlayer.color); end(); break; case "move": ActionMove mev = (ActionMove)e; curPlayer.put(board, mev.x, mev.y); process(); break; default: ...
3e61afcb-f6f7-40e5-a792-f47a4cf70a89
2
public EmailTest() { bigLocal = new String("a"); for(int i = 0; i < 70; i++) bigLocal = bigLocal.concat("a"); bigDomain = new String("c"); for(int i = 0; i < 257; i++) bigDomain = bigDomain.concat("c"); bigDomain = bigDomain.concat(".com"); }
679019d4-603c-4f25-91c9-479afea0f4fa
8
public static boolean isEffective(boolean player, int moveNum) { int move = getMove(player,moveNum); if(move <= 0) return false; int atkType = curGb.getROM()[curGb.pokemon.listMovesAddress + (move-1)*curGb.pokemon.listMovesEntryLength + 3]; int defenderTypeAddress = player ? curGb.pokemon.fightEnemyMonTypes...
30493421-936b-40f1-9962-59709cdf7c1c
0
public FlipTest() { }
6954657d-ff17-48a6-b094-48a8ecf415d4
2
public static ArrayList<Integer> getOtherServerIds() { ArrayList<Integer> serverIds = new ArrayList<Integer>(); for (int i = 1; i <= 3; i++) { if (i != serverId) serverIds.add(i); } return serverIds; }
4107b797-70b9-4092-8afd-309dd93bc10c
0
public String getMobileLab() { return MobileLab; }
fd1535b8-f30b-433c-98c8-e29288f3459b
8
private void method468() { super.modelHeight = 0; anInt1650 = 0; anInt1651 = 0; anInt1646 = 0xf423f; anInt1647 = 0xfff0bdc1; anInt1648 = 0xfffe7961; anInt1649 = 0x1869f; for(int j = 0; j < anInt1626; j++) { int k = anIntArray1627[j]; int l = anIntArray1628[j]; int i1 = anIntArray1629[j]; ...
e7a98bf0-c63b-42aa-bc3f-22fa50ce74cc
3
@Override public void paint(Graphics2D g2d) { //lo pintamos como sólido super.paint(g2d); try{ if(!disparos.isEmpty())//pintamos sus disparos si los hubiera for(Disparo d: disparos) d.paint(g2d); }catch(java.util.ConcurrentModificationExcepti...
4e5dcd96-2e2e-493b-8d79-0dca643e1e05
1
@Override public void restoreHealth(int healing) { if (this.curHP + healing >= this.maxHP) { this.curHP = this.maxHP; } else { this.curHP += healing; } }
5b9c4e9b-8e31-4e88-975c-beba9d30deff
7
public void notePhrase(String s, int id_phrase) throws SQLException { Phrase comm; comm = new Phrase(s); Statement lanceRequete; lanceRequete = connG.conn.createStatement(); ResultSet requete; ArrayList<String> liste; liste = new ArrayList<>(); liste = ext...
401aae67-7c6b-46b5-9cda-857ba685ef29
9
protected void getCloseCreatures() { Thread creatureRadarThread = new Thread(new Runnable() { @Override public void run() { try {// wait until the plants align properly Thread.sleep(80); } catch (InterruptedException e) { e.printStackTrace(); } // True if this creature is alive ...
7bf5ec92-99b7-44e0-a362-a3946db5ae07
8
public static AddItemDialog create(final Class type, final Object instance) { final AddItemDialog dialog = new AddItemDialog(); for (final Method m : type.getMethods()) { if (m.getName().startsWith("set") && (m.getParameterTypes().length == 1)) { final String name = m.getName().substring(3); Metho...
51b72d46-32cb-46b3-96cb-5ba261ee6a17
1
private void register(List<String> watchedFiles) throws IOException { for(String watchedFile : watchedFiles) { String watchedDir = new File(watchedFile).getParentFile().getAbsolutePath(); Path dir = Paths.get(watchedDir); // we are not watching for cr...
4c97d464-b378-4693-a6de-75513302a7d8
5
private HashFamily getHashFamily(double radius,String hashFamilyType,int dimensions){ HashFamily family = null; if(hashFamilyType.equalsIgnoreCase("cos")){ family = new CosineHashFamily(dimensions); }else if(hashFamilyType.equalsIgnoreCase("l1")){ int w = (int) (10 * radius); w = w == 0 ? 1 : w; famil...
a975c1c5-d5e8-41c3-947f-803755129bf7
2
static public Integer getZipFromString(String zipStr) { Integer retVal = null; try { retVal = getIntegerFromSubString(zipStr, "-"); if (retVal == null) { retVal = getIntegerFromString(zipStr); } } catch (Exception e) { retVal = null...
1cbba4cd-117c-4368-a504-10c756d8d1d5
3
public void queueSound(FilenameURL filenameURL) { if (!toStream) { errorMessage("Method 'queueSound' may only be used for " + "streaming and MIDI sources."); return; } if (filenameURL == null) { errorMessage("File not specified in method 'queueSound'"); return; } synchronized (soundSequenceL...
6483eadc-9a8a-42df-9945-e2f2fd54a429
7
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...
668a3405-681c-4469-babf-0dd41c9b9776
1
@Override public boolean canAttack(Board board, Field currentField, Field occupiedField) { return this.validSetupForAttack(currentField, occupiedField) && occupiedField.areAdjacentTo(currentField); }
80dbcc2f-2650-4d99-8ca0-79f7de35c2ef
0
public SolarSystemLoc(Ticker ticker) { super(ticker); initializationLevel(); }
00f5d4af-d885-4a1b-a5b1-ae056615aac7
0
public List<EventBranch> getEventBranchList() { return eventBranchList; }
8312eda6-1c87-4610-b212-df6d5fd765c8
0
public void setCueNaturaleza(String cueNaturaleza) { this.cueNaturaleza = cueNaturaleza; }
e61cfb9b-a216-4bb7-944f-f02866a9d5f3
3
public Point getPosn(ArrayList<Point> lst) { Point result = this.from; for (Point p : lst) { if (p.x == this.from.x && p.y == this.from.y) { result = this.to; } } return result; }
94ae40e1-e298-44a7-aabf-925776e63b60
7
public void addBook() { // User inputs: isbn, title, mainAuthors, otherAuthors, // publisher, year, subjects JTextField isbnField = new JTextField(15); JTextField titleField = new JTextField(20); JTextField mainAuthorField = new JTextField(20); JTextField otherAuthorsField = new JTextField(90); JTextFiel...
89e4380c-fe17-44b9-805f-72e0b4b0cf92
0
@RequestMapping(value = "/store/employee/skills", method = RequestMethod.POST) public String insertEmployeeSkillRatings(@RequestBody UserSkillSet userSkillSet ) { ObjectMapper objectMapper = new ObjectMapper(); ObjectNode objectNode = objectMapper.createObjectNode(); employeeDao.insertSkillSet(userSkillSet); o...
252e3444-e8f5-44bf-97f4-fdb97bdedfd3
3
public int execute() { // Build info /*String[] commands = YuccaCommandFactory.getImplementedCommands(); StringBuffer b = new StringBuffer( "Available commands: " ); for( int i = 0; i < commands.length; i++ ) { if( i > 0 ) b.append( ", " ); b.append( commands[i] ); } System.out.println( b.toS...
0845fe31-a6bf-414a-ada2-7e1e45c3039e
1
public Iterator<Point2D> getPoints( final float start, final float end, final int nPoints ) { if( nPoints == 1 ) { return new Iterator<Point2D>() { private boolean hasNext = true; @Override public boolean hasNext() { return hasNext; } @Override public Point2D next() { hasNext = ...
4bab4f8b-6533-4209-b30f-e7dafa77f8f7
4
@Override public void paint(Graphics g){ this.requestFocus(); Graphics2D tileGraphics = (Graphics2D) g; for (int row = 0; row < Map.ARRAYSIZE; row++) { for (int col = 0; col < Map.ARRAYSIZE; col++) { tileGraphics.setColor(Color.BLACK); tileGraphics.fill...
aed503e5-0fc1-40c8-8bb6-9ad38ac9d6b1
4
protected boolean in_grouping_b(char [] s, int min, int max) { if (cursor <= limit_backward) return false; char ch = current.charAt(cursor - 1); if (ch > max || ch < min) return false; ch -= min; if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) return false; cursor--; return true; }
f28ac6e1-b9db-4358-b70e-794777ca6739
8
public boolean containsValidCustomerDetails() { return isValidForename() && isValidSurname() && isValidHouseNum() && isValidStreet() && isValidPostcode() && isValidEmail() && isValidCardNum() && isValidPassword() && isMatchForPassword(); }
1b6a5330-6fdc-48ec-b776-384b76eb1221
4
public void paint(GC gc, int width, int height) { if (!example.checkAdvancedGraphics()) return; Device device = gc.getDevice(); if (ovalColorGB != null && ovalColorGB.getBgColor1() != null) gc.setBackground(ovalColorGB.getBgColor1()); gc.setAntialias(aliasValues[aliasCombo.getSelectionIndex()]); Path path =...
23c76c58-162c-4eaa-89ec-83fffa5311fe
0
public void correct() { System.out.println("correct method"); }
95860a72-f4c4-431e-a8fd-69847bf776bb
8
public boolean checkBookValues(String isbn, String title, String author){ boolean resultCheck = false; if(isbn.length() <= Model.getInstance().getBookIsbnSize() && title.length() <= Model.getInstance().getBookTitleSize() && author.length() <= Model.getInstance().getBookAu...
aa14ecc8-2992-447f-9107-09c1bdfbad4e
6
private static boolean isStalemateSituation(BotState state) { boolean isStalemateSituation = true; int ownIncome = state.getStartingArmies(); int opponentIncome = HeuristicMapModel.getGuessedOpponentIncome(); // No stalemate situation without seeing the opponent if (state.getVisibleMap().getEnemyRegions(state...
1b1e1b4c-4ff1-44a8-be6d-fbaf31050c94
9
public void calibrate() { double minValue = minData; double maxValue = maxData; if (minAxisFlag== AT_ZERO) { minValue = 0; } else if (minAxisFlag == AT_VALUE) { minValue = this.minValue; } if (maxAxisFlag== AT_ZERO) { maxValue = 0; ...
aa82434c-2df5-4ca9-9370-4514a487cdb5
5
private int affecteNumCourt(String terrain) { if (terrain.equals("Court central")) return 1; else if (terrain.equals("Court annexe")) return 2; else if (terrain.equals("Court d'entrainement 1")) return 3; else if (terrain.equals("Court d'entrainement 2")) return 4; else if (terra...
8af92c68-d6c0-4ecd-8f8d-b15326a915a6
9
public void updatePosition() { //System.out.println(xPos + " " + yPos); //System.out.println(xDestination + " yolo " + yDestination); if (xPos < xDestination) xPos+=2; else if (xPos > xDestination) xPos-=2; if (yPos < yDestination) yPos+=2; ...
9c18a3e1-8fe2-483a-b09c-cb97e0ac1bdc
2
private void buildQuestionPanelP2() { pnlNewQ2 = new JPanel(); pnlNewQ2.setLayout(new BoxLayout(pnlNewQ2, BoxLayout.X_AXIS)); pnlQTypeSwap = new JPanel(); cardQType = new CardLayout(); pnlQTypeSwap.setLayout(cardQType); /* Multiple choice: */ ButtonGroup bg = new ButtonGroup(); rbAnsList = new ...
461483f6-24e9-496e-92f6-ae83364fe5b2
5
public void paintIcon(Component c, Graphics g, int x, int y) { Color color = c == null ? Color.GRAY : c.getBackground(); // In a compound sort, make each succesive triangle 20% // smaller than the previous one. int dx = (int)(size/2*Math.pow(0.8, priority))...
db5f1974-d9b3-4ca8-8d54-6a21fffe52a6
0
public void movePegs() { x.centerX = centerX - Peg.width; z.centerX = centerX + Peg.width; y.centerX = centerX; x.centerY = centerY; z.centerY = centerY; y.centerY = centerY + Peg.height; }
41bfd8be-1881-44a9-a306-4b0fc80b93d8
6
public Token read() throws IOException { try { while (reader.ready()) { int c = reader.read(); if (Character.isWhitespace(c)) { whitespaceReader.readValue(reader, c); } else if (Character.isLetter(c)) { return identifierReader.getToken(reader, c); } else if (Character.isDigit(c))...
4f6cfba7-5348-4e8e-a81d-2f2747a44664
4
public void setCellState(int x, int y, boolean alive) { if (x > 0 && x < width && y > 0 && y < height) grid[y][x] = alive; }
f055d50e-b310-4526-addd-0f6da4870f58
5
private void handleEvents(byte[] resp) { if(resp == null || resp.length == 0) { return; } RS232Packet respPacket = socket.parseResponse(resp); creditAction = respPacket.getCreditAction(); rawFirmwareRevision = respPacket.getFirmwareRevision(); rawAcceptorMo...
1857985f-8c86-414b-b300-38f2b1ba1618
2
public boolean simpleIsConcurrent(String pathExpression1, String pathExpression2, String operator1, String operator2, String type1, String type2){ if (pathExpression1.equals(pathExpression2)){ if (type1.equals(type2)){ return mutuallyExclusive(operator1, operator2, type1, type2); } else { System.err.pri...
47401ae5-d211-4d3f-9b9f-587ac64cd825
8
private void buildQueryMapSet(Triple buildQuery){ Node subject = buildQuery.getSubject(); Node object = buildQuery.getObject(); Predicate predicate = buildQuery.getPredicate(); //Possible permutations of the query String Q1 = "?"+" "+predicate.getIdentifier()+" "+object.getIdentifier(); String Q2 = su...
234301dd-1f41-41c8-935a-8dfa4614f1a4
7
private void Build() { greenPlants = ps.getGreenPlants(); plasticWrap = ps.getPlasticWrap(); roundRocks = ps.getRoundRocks(); energy = ps.getEnergy(); Dialog.message("I can build a solar still to collect"); Dialog.message("water over time for me to consume.\n", 2000...
68704e92-d950-4de6-88b4-9a3856758e00
1
public void show() { if (getMessage() == null) setMessage(DEFAULT_MESSAGE); super.show(); }
3e0e8ec1-c49e-4b8a-8909-a42769d7a3ce
1
public static void changeToParent(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) { Node newSelectedNode = textArea.node.getParent(); if (newSelectedNode.isRoot()) { return; } tree.setSelectedNodesParent(newSelectedNode.getParent()); tree.addNodeToSelection(newSelectedNode)...
59c2c0ba-2b32-4dd3-baf4-03f9aa66d4fa
4
public void createTables() { // Table PLAYER if (!_sqLite.isTable("player")) { try { _sqLite.query("CREATE TABLE player(" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "playername TEXT UNIQUE COLLATE NOCASE);"); } catch (Exception e) { // TODO } } // Table LOGIN if (!_sqLit...
6aff5488-e05f-4bd4-a40e-522fb9be1b80
7
public void addOperator(BinaryOperator operator) { if (!functionContextStack.isEmpty()) { Integer sizeOperators = functionContextStack.peek().getSizeOperatorsForParameters(); if (sizeOperators != null) { while (!operatorStack.isEmpty() && sizeOper...
be3b931b-52f8-45c1-b849-502384809b30
3
public static ArrayList doit(ExtendedIterator<? extends OntResource> it, VelocityContext context) { /* create our list of maps */ ArrayList list = new ArrayList(); for (OntResource r = null; it.hasNext(); ) { r = it.next(); if (r.isAnon()) { continue; ...
fa4ab541-1507-4599-b230-e3be13e3a155
2
private void renderGrid(Graphics g) { Coordinate worldSize = wb.getSize(); g.setColor(Color.red); for (int i = 1; i <= worldSize.x; i++) { Coordinate c1 = coordinateToPixel(i, 0); Coordinate c2 = coordinateToPixel(i, worldSize.y); g.drawLine(c1.x, c1.y - blockHeight / 2, c2.x, c2.y); } for (int i =...
787a531e-99a5-4217-9c04-78e4b684524d
5
public static boolean correctOrder(String str){ //base case-if there are only 2 chars and the first and last are in correct order-true if(str.length()==3 && (str.charAt(0)>str.charAt(2))){ return true; } //if the string is less than 3 chars long it returns true as impossible ...
0c203b9c-16ca-4763-b8b5-ed45346d0865
8
private static void countWords(String file,String count, String struct) { DataCounter<String> counter = null; // divide into several situations and create different structures if(count.equals("-b")) counter= new BinarySearchTree<String>(new StringComparator()); else if(count.equals("-m")) ...
28f69014-2847-4a12-b3b2-bd27033d7849
5
public boolean search(int val) { DLNode current = head; if (this.head == null) { return false; } while (current != null) { if (val == current.getVal()) { return true; } else if (current.getVal() == Integer.MIN_VALUE) { if (current.getList().search(val) == true) { return true; } ...
d08b5c70-40ed-4083-b04f-87bb11c55b34
9
private void construct(Constraint[] constraints, int nconstraints) { this.constraints=constraints; this.nconstraints=nconstraints; VERBOSE=CSPStrategy.VERBOSE; variables=null; nodes = new ConstraintList[nconstraints*2]; nvariables=0; min=0; max=0; bestProbe=null; // tally variables and count maximum mines...
6701a10a-17e1-4ab2-b58b-f6f0302ebb6b
4
private ArrayList<Boolean> getRowByLeftState(String state, String topOrBottom) { ArrayList<Boolean> fullRow = new ArrayList<Boolean>(); if (topOrBottom.equals("top")) { int index = topOfTableRow.indexOf(state); if (index == -1 ) return fullRow; fullRow = topTable.get(index); ...
d3e70072-8e16-4304-8d1c-7efeb0693a09
4
public static void main(String[] args) { System.out.println("Start"); InputStreamReader input = new InputStreamReader(System.in); processor = new ValueFrequencyProcessor(); while (runing) { int value = 0; try { value = input.read(); } c...
50e075f7-6800-4fa3-a0ce-c9ae4b24483f
1
private void setToflagOthers(myDataList mylist) { for (int i = 0; i < mylist.size() - 1; i++) { ((data) mylist.get(i)).setFlag(false); } }
744a515c-f839-4fcc-8a6f-dca290a40996
9
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed // TODO add your handling code here: int chose = this.jComboBox1.getSelectedIndex(); if(chose==0) this.setParams(null, null, null,0,1,false); if(chose==3) this.setParams(...
0a115c09-afb5-4a58-9c31-5bf90f8ffba8
9
public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) { this.plugin = plugin; this.type = type; this.announce = announce; this.file = file; this.id = id; this.updateFolder = plugin.getServer().getUpdateFolder(); final File pluginFile...
571aa95f-5b01-4edd-8e92-81b77f4853e3
7
public static final void showCourses(DARSInfo.CLASS... classes) { for (DARSInfo.CLASS curClass : classes) { System.out.println(curClass.Subject + " " + curClass.Number); } Vector<CourseInfo> allCourse = CoursesFile.loadAllCourses(); for (CourseInfo course : allCourse) { for (DARSInfo.CLASS curCl...
a10bca75-dd5d-499f-b699-e7f3866a2625
5
public boolean cast (Sorcerer sorcerer, Trigger trigger, Event event) { if (isOnCooldown(sorcerer)) return false; cooldowns.put(sorcerer, System.currentTimeMillis() + 1000); if (trigger.isInteractTriggered()) { PlayerInteractEvent interactEvent = (PlayerInte...
832dcfad-7684-4321-8fa2-d7840ff230cf
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 Unidade)) { return false; } Unidade other = (Unidade) object; if ((this.codigo == null && other.codigo != null)...