method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9077e3d1-1ab4-41a4-99ec-d305b1e7e4dc
2
@FXML protected void addFiles(ActionEvent event) throws Exception { final FileChooser fileChooser = new FileChooser(); List<File> list = fileChooser.showOpenMultipleDialog(currentStage); if (list != null) { for (File file : list) { addFileToList(...
4ae80062-565a-4f92-a029-fd82dd070968
6
public String identUser(String message, String oldname, Socket socket){ userpass = message.substring(10); userpassarray = userpass.split(" "); //Checks if the name is registered if(regnames.containsKey(userpassarray[0])){ //Identifies the user if(userpassarray[1].compareTo((regnames.get(userpassarray[0]))...
b43b2b0f-0661-40f1-85f3-30097a4161ff
4
public void getFlyAreas() { int sum=0; for (Area areasWithPC1 : areasWithPCs) { if (seenArea(areasWithPC1)) sum++; } flyAreas=new Area[sum]; System.out.println("Number of potential fly zones: "+sum); int index=0; for (Area areasWithPC : areasWithPCs) { ...
166e678a-e9d6-44d5-8702-6fc1be69bacf
9
@Override public boolean sendDeath() { WorldTasksManager.schedule(new WorldTask() { int loop; @Override public void run() { if (loop == 0) { player.setNextAnimation(new Animation(836)); } else if (loop == 1) { player.getPackets().sendGameMessage( "Oh dear, you have died."); } e...
fb57f24a-b7a1-4661-a939-0142204fcbd9
0
private boolean graphContainsEdge(Edge edge) { return edges.contains(edge); }
461afaac-814f-4b48-9b44-1bc3d5f66b90
1
public static void main(String[] args) { char[][] board = { {'X','X','X','X'}, {'X','O','O','X'}, {'X','X','O','X'}, {'X','O','X','X'} }; // char[][] board = { // {'X','X','X'}, // {'X','O','X'}, // {'X','X','X'}, // // }; ...
5e293130-b262-4541-91de-6b840ac326cd
9
@Override public void play() { if(choise1.equalsIgnoreCase("aucun") || choise2.equalsIgnoreCase("aucun")) { return; } else { nbGame++; if(!choise1.equals(choise2)){ if (choise1.equalsIgnoreCase("pierre")) { if(choise2.equalsIgnor...
78f3c9ed-e899-4956-80f1-6d7bfdf6c048
1
public void doLayout() { try { super.doLayout(); table.setLocation(tp); } catch (NullPointerException e) { super.doLayout(); } }
8915697b-7635-4dc0-8fd1-c6f7b6682e82
2
@Override public Serializable load(){ try { db.start(); DBCollection collection = db.getDB().getCollection("users"); XStream xStream = new XStream(); DBObject obj = collection.findOne(); if (obj == null) return null; String xml = (String)obj.get("blob"); Serializable xmlObj = (...
d6bba235-a3b9-4582-b322-d23d96965d7f
8
public static ArrayList<Post> getSearchResult(int page, String text) throws SQLException, NamingException { Connection conn = null; Statement stmt = null; ResultSet rs = null; ArrayList<Comment> comment = new ArrayList<Comment>(); ArrayList<Graffiti> graffiti = new ArrayList<Graffiti>(); DataSource ds ...
72741076-2a08-4ef4-858f-1672d67404ac
6
private void drawTickMarks(final GraphicsContext CTX) { CTX.clearRect(0, 0, size, size); double sinValue; double cosValue; double startAngle = getSkinnable().getStartAngle(); Point2D center = new Point2D(size * 0.5, size * 0.5); ...
4e07f85c-daa2-4ad4-9fee-dd6ff7c58d57
0
public static void main( String[] args ) { //prop.load(getClass().getClassLoader().getResourceAsStream("config.properties");)) }
ba1472c7-0e66-4966-9d8a-11839ef32967
5
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int sum = 0; int first, second, third, fourth, fifth; while(true){ System.out.println("Enter 5 numbers: "); first = sc.nextInt(); second = sc.nextInt(); third = sc.nextInt(); fourth = sc.nextInt(); fifth = sc.next...
79b7078c-bd7d-4599-94f3-3e25a55e1256
9
public static void main(String[] args) { // 1. reading data from file ArrayList<TrainingDataItem> items = new ArrayList<TrainingDataItem>(); File file = new File("car.data"); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(file)); String s = ...
eea90351-94d2-4291-bfb7-523716d5d8a5
3
public AnnotationVisitor visitArray(final String name) { if (values == null) { values = new ArrayList(this.desc != null ? 2 : 1); } if (this.desc != null) { values.add(name); } List array = new ArrayList(); values.add(array); return new Ann...
1a585a23-8033-4c7c-90ac-c18e87fa7ad6
1
public boolean successful() { if (line.endsWith("success: true}")) return true; return false; }
e97a36b8-2cea-4044-b1cc-c2a8859acdda
7
@Override public void run() { // Main game loop while (true) { //Sprite logic switch(playerSpriteType){ case 0: currentSprite = characterSpriteIdle; break; case 1: currentSprite = characterJumpedSprite; break; case 2: currentSprite = characterDownSprite; break; default:...
ed193576-2d20-4891-9153-51acffc60d3c
6
private void addRelations(Element parent, Relations relations) { if (relations == null || relations.isEmpty()) return; Element relationsNode = doc.createElementNS(getNamespace(), DefaultXmlNames.ELEMENT_Relations); parent.appendChild(relationsNode); Set<ContentObjectRelation> set = relations.exportRela...
2b1b4164-b4c2-4d3f-8f95-af8270584a19
8
protected Sorter getFallbackSorter(int k) { return new IntroSorter() { @Override protected void swap(int i, int j) { MSBRadixSorter.this.swap(i, j); } @Override protected int compare(int i, int j) { for (int o = k; o < maxLength; ++o) { final int b1 = byteAt(...
a9509909-46c6-4406-b3c2-49580524c3d7
5
public void sair() { if (w == null) { int op = JOptionPane.showOptionDialog(null, "You haven't even created a wallet yet ! Do you really wish to leave ?", "Exit", JOptionPane.YES_NO_OPTION, 3, null, null, null); if (op == JOptionPane.YES_OPTION) { System.exit(0); ...
96ca5cb8-ee5d-4969-b8d4-40014500ae9d
8
public String getSolutionTableau(){ String out = ""; out += "<table border=\"1\">\n"; out += "<tr><th colspan=\"7\">L&ouml;sung</th></tr>\n"; out += "<tr><td align=\"left\" colspan=\"5\">Solver Status: </td><td colspan=\"2\">"+this.modelData.getSolverStatus()+"</td></tr>\n"; if(this.isSolved()){ for (int i...
175fdf5c-0350-4625-aa16-249c7ec7759d
9
public static Object[] getToplist( int auctionID ) throws DatabaseException { Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; ArrayList list; String name, link; int uid, bids; list = new ArrayList(); String q = "SELECT a.uid, a.bid, u.displayName, u.link, sum(a.bid) AS s FROM...
11441368-36f3-4f7a-82d1-04ba5c89ab1a
1
public void setElement(int i, int j, int value) { try { array2d[j][i] = value; lengths2d[j][i] = String.valueOf(value).length(); } catch(IndexOutOfBoundsException e) {} }
10c38468-8aad-4e0c-b072-cf4cd9e7473a
9
public boolean verificaComponenteDigitado() { String componente = jFTComponente.getText().trim(); String descricao = retornaDescricaoComponenteProtheus(componente); String setor = jComboBoxSetor.getSelectedItem().toString(); String produto = ""; if (job != null) { ...
36e6a22c-dca1-4c28-abd2-171be2e58ea7
5
private void insertAtNode(E e, TreeNode<E> current, TreeNode<E> parent) { if(current == null) { TreeNode<E> newNode = new TreeNode<E>(e); if (parent != null) { newNode.parentTreeNode = parent; if(newNode.compareTo(parent) > 0) parent.rightTreeNode = newNode; else parent.leftTreeNode = newNode; } ...
c5e7fc62-a2e8-4f28-860f-034488b67a9d
0
public String getType() { return type; }
ea905e3c-25da-4cf4-8264-fdbdb12ef4b7
9
public static void main(String[] args) { init(); update(chess.getUserColor()); while (!chess.isCheckmate()) { try { semaphore.acquire(); ChessPiece chosen = chessBoard.get(myXCoor, myYCoor); buttons[myYCoor][myXCoor].setBackground(Color.green); ...
b885651d-77ff-4c78-a220-a2b6a57ba2a4
8
public static Date parseDate(String date) { int indexOf = date.indexOf('.'); int lastIndexOf = date.lastIndexOf('.'); Calendar calendar = Calendar.getInstance(); int dayOfMonth=0, month=0, year=0; int hours = 0; int minutes = 0; if(date.length() < 8) { return new Date(); } try { if(indexOf ==...
8a2de8a8-7bfe-4d1d-9c33-268fc6b2f5e4
1
public void removeSubProcess(SubProcess subProcess) { if (this.subProcesses.contains(subProcess)) { this.subProcesses.remove(subProcess); } }
85ba4ea1-0a02-4c6e-85a4-d545ed1396e2
8
public void demandeDeplacement(final int dx, final int dy) { final int nouveauX = this.x + dx; final int nouveauY = this.y + dy; if (!this.mort) { // Verifier mort pirate final BandeDeSingesErratiques bandeSinge = this.monkeyIsland.getSingesErratiques(); final List<SingeErratique> vectorSinge = bandeSi...
d9966406-59d5-464e-8cb4-ec54619c0e49
3
public static void main(String[] args){ Set<String> set = new HashSet<String>(); for (int i=0;i<10;i++) set.add(Integer.toString(i)); long sum=0; Set<String> per = permutate(set); System.out.println(per.size()); for(String k : per){ // System.out.println(k); if (checkSpecial(k)){ sum+=Long.parseLon...
6f1b27da-1499-4a22-b0cb-07ec75758049
0
public String getDescription(){ return ".gif"; }
6ff5c3d6-06c6-47d3-aab9-a42cada1cb4c
2
private static void test_strbtoi(TestCase t) { // Print the name of the function to the log pw.printf("\nTesting %s:\n", t.name); // Run each test for this test case int score = 0; for (int i = 0; i < t.tests.length; i += 2) { int exp = (Integer) t.tests[i]; String arg1 = (String) t.tests[i + 1]; i...
cf871f2b-3398-495b-be41-eb21800af770
1
public void startHandshake(HandshakeBuilder handshakedata) throws Exception { if (handshakeComplete) throw new IllegalStateException("Handshake has allready been sent."); this.handshakerequest = handshakedata; channelWrite(draft.createHandshake(draft .postProcessHandshakeRequestAsClient(handshakedata))); ...
69e85c29-93da-4bed-806c-040c8ea5d67b
6
@Override public boolean containsAll(Collection<?> c) { List list = new ArrayList(); for (Object o : c) { if (list.contains(o)) continue; list.add(o); } for (T t : this) { if (list.remove(t) && list.isEmpty()) return true; } return false; }
669384d6-3e49-4c74-85f7-f922db480eba
1
public void visitIfZeroStmt(final IfZeroStmt stmt) { if (stmt.expr == from) { stmt.expr = (Expr) to; ((Expr) to).setParent(stmt); } else { stmt.visitChildren(this); } }
3753fdc1-8378-4517-bb0e-f0df29e60231
3
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PlayersConnectedMessage that = (PlayersConnectedMessage) o; return Arrays.equals(playerName, that.playerName); }
02918f8a-f8ae-402a-8b11-8b778b77f970
9
private void serializeObject(Object obj) throws IOException { Method met = null; String getMetName = null; String serMethodName = null; Class retType; //First serialized line of an object that always // needs written, reguardless of object type out.write("<DPSerialization>\n"); //Creates an array of ...
597da251-a9f3-485c-b388-cf12301b74a4
5
@Override protected void update(long delta) { double timeFactor = delta / targetFrameDuration; // TWEENING STUFF // Move if any tweening for (int i = tweenOuts.size() - 1; i >= 0; i --) { GameObject o = tweenOuts.get(i); // Make it go to upwards yes... follow tweenIn?? if (tweenIn != null) o.pos.y = t...
d75fb82c-52ee-47ed-b5a1-f68f34ba72fc
5
public void save () { try { synchronized (slotsMutex) { for (int i = 0; i < slots.length; i++) { Spell spell = slots[i]; if (spell == null) { properti...
ca52bba2-6a21-4d03-8e07-55c9237a8de5
7
public ChangesStatus withdrawMoney(int account_id, int customer_id_by, int amount, int pin) throws BelowMinimumBalanceException, OverDraftLimitExceededException{ Connection connection = DBConnectionHelper.getConnection(); AccountDAO accountDAO = DAOFactory.getAccountDAO(); try { Account account = acc...
21f9971d-c995-4562-9f01-08c3ea377543
3
public GedcomRecord nextRecord() throws IOException, GedcomReaderException { if (pushback && getLineNumber() > 0) { pushback = false; return lastRecord; } String line = lnr.readLine(); if (lnr == null) return null; return parseLine(line); }
cb9a3412-f488-440c-9d17-871aa11a5c0f
6
public static void main(String[] args) throws InterruptedException { System.out.println("Initializing GUI and tray..."); try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); ...
a33cf5d3-8e6d-482c-be46-0d75729de156
8
@Override public void completeTask(Person p, SimulationMap map) { for(String state: pos){ p.addState("+"+state); } for(String state: neg){ p.addState("-"+state); } if(fulfilledNeed != null){ List<Need> needs = p.getNeeds(); fo...
1c9efb21-2f68-470c-8baf-0dbdb9a91c04
0
@Override public IEmailKontaktDao getEmailKontaktDao() { EmailKontaktDaoXml ekdx = new EmailKontaktDaoXml(); return ekdx; }
91d4a081-2c75-4322-912f-4ef5987fc055
7
public Object readConst(final int item, final char[] buf) { int index = items[item]; switch (b[index - 1]) { case ClassWriter.INT: return new Integer(readInt(index)); case ClassWriter.FLOAT: return new Float(Float.intBitsToFloat(readInt(index))); case Clas...
0a7a9160-cb70-4215-b1ae-42adeb0b14d6
4
PakkitPacket getPacket(String string) { if (!string.startsWith("Packet")) { string = "PacketPlayOut" + string; } for (final Map.Entry<Class<?>, PakkitPacket> entry : this.packets.entrySet()) { if (entry.getKey().getSimpleName().equalsIgnoreCase(string)) { ...
e4404ce5-2e1d-4a0a-bb5b-f821e4f61f07
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...
0f13d272-ac9f-4ddd-890f-c380ade6a15b
1
private static void loadSVGs(URL[] URLs) { for (int i = 0; i < 13; i++) { universe.loadSVG(URLs[i]); } }
41e107ae-0fe8-4bce-b147-45cb0e79132e
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Customer other = (Customer) obj; if (idCustomer == null) { if (other.idCustomer != null) return false; } else if (!idCustomer.equals(oth...
a42de597-7939-4dd3-b47c-30f77ced8a26
1
private String toString(final Properties azotProperties, final String key, final String defaultValue) { String value = defaultValue; if (azotProperties.getProperty(key) != null) { value = azotProperties.getProperty(key); } return value; }
370eaf93-3305-40e5-9d17-37aeb8c45255
2
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] argument) { SpoutPlayer player = null; if (sender instanceof Player) { player = (SpoutPlayer) sender; } if (command.getName().equalsIgnoreCase("spawndrug")) { SpoutItemStack stack = new SpoutItemStack(p...
1e84279f-e32f-402c-9be8-03904f4d483b
2
public Object opt(int index) { return (index < 0 || index >= this.length()) ? null : this.myArrayList .get(index); }
e70dbce1-0555-4762-8716-e23b2e02b211
8
public boolean sellStocksOrFunds(String accountID, String investSymbol, int type, int numberOfShares) { int dueNumber = numberOfShares; boolean flag = true; Timestamp targetTime, todayTime; int ownNumber, toSell, shortOrLong; double crtPrice, amount, prevPrice, gainOrLoss; Statement s; TransControl ...
c4ed84d5-5992-4ed8-baeb-a848e37e6a70
9
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof CustomXYURLGenerator)) { return false; } CustomXYURLGenerator that = (CustomXYURLGenerator) obj; int listCount = getListCount(); if (li...
ed0a1e09-32de-41bf-af67-c06baf31a3c4
2
public ByteBuffer write(Packet packet) { Integer foundId = packetMapping.inverse().get(packet.getClass()); if (foundId == null) throw new IllegalArgumentException("Unknown packet class: " + packet.getClass()); short id = foundId.shortValue(); ByteBuffer serialized = packet.serialize(); if (serialized.limit()...
201e6a6b-feb1-4e3b-8482-d50350c60ffd
1
public void decompile(String className, Writer writer, ProgressListener progress) throws java.io.IOException { if (searchPath == null) { String classPath = System.getProperty("java.class.path").replace( File.pathSeparatorChar, altPathSeparatorChar); searchPath = new SearchPath(classPath); } ClassIn...
67cb3641-f3e5-4d83-8b67-42fe33a650c9
5
public Boundsheet getLastSheet() { if( parent_rec != null ) { WorkBook wb = parent_rec.getWorkBook(); if( (wb != null) && (wb.getExternSheet() != null) ) { Boundsheet[] bsa = wb.getExternSheet().getBoundSheets( ixti ); if( bsa != null ) { if( bsa.length > 1 ) { return bsa[bsa.l...
d3343bfe-11ef-43f8-adff-0f67a96a7519
9
public void method216(int rotation, int xSize, int x, int y, int ySize, boolean flag) { int j1 = 256; if (flag) { j1 += 0x20000; } x -= offsetX; y -= offsetY; if (rotation == 1 || rotation == 3) { int srcXSize = xSize; xSize = ySize; ySize = srcXSize; } for (int l1 = x; l1 < x + xSize; l1++)...
181f96cf-da79-46d0-9516-90bc7577c4d6
0
public static void main(String[] args) { Student studentMax = new Student(); studentMax.course = new Course(); studentMax.name = "Max"; studentMax.course.name = "Java course"; studentMax.sayHello(); Student studentSlava = new Student(); studentSlava.name = "Slava...
d077a847-705b-494a-8d87-77d76d294ca0
8
@Override public boolean checkGrammarTree(GrammarTree grammarTree, SyntaxAnalyser syntaxAnalyser) throws GrammarCheckException { syntaxAnalyser.setOperionName("dice"); int commaAmount = grammarTree.getSubNode( new Token(TokenType.DELIMITER, ",")).size(); if (commaAmount == 0) { this.throwExceptionAndAd...
9b203acf-c798-43a7-ad95-bce5b3d80655
1
@Test public void branchInstr_testInvalidTargetRef() { //Checks instr. not created with invalid memory ref. try { instr = new BranchInstr(Opcode.BRE, 102, 9); } catch (IllegalStateException e) { System.out.println(e.getMessage()); } assertNull(instr); }
7b65a562-f078-41b8-a98f-89794102c7f7
6
@EventHandler public void EndermanStrength(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getEndermanConfig().getDouble("Enderman....
d553343a-e8b1-4d14-b644-3a39fefd63f3
1
public static void listEmployeesDepartment(EntityManager entityManager) { TypedQuery<Employee> query = entityManager.createQuery( "select e from Employee e", Employee.class); List<Employee> resultList = query.getResultList(); entityManager.close(); for (Employee employee : resultList) { System.out ...
9e81c744-b217-4404-8385-929484b461e1
3
private void updateStateRNF(List<Keyword> keywords, List<String> approval, List<String> terms) { if (approval != null && !approval.isEmpty()) { if (approval.get(0).equals("yes")) { getCurrentDialogState().setCurrentState(RecipeLearning.RL_ENTRY); teaching = true; return; } else { getCurrentDialogSt...
a3b95eb1-d89b-411a-876f-1fe8cc3a0cbb
2
private void dataMiningForRavagePatterns(){ RavagePatternDetector ravagePatternDetector; for(int startRow=0;startRow<get_rows()-ravagerPatternEncoder.getRows();startRow++){ for(int startColumn=0;startColumn<get_columns()-ravagerPatternEncoder.getColumns();startColumn++){ rava...
76de678a-34da-4653-9de1-bb7cb3bf5d83
9
public Object getValueAt(int row, int column) { if ((row < getRowCount()) && (column < getColumnCount()) && (row >= 0) && (column >= 0)) { ServerInfo si = items.get(row); switch (column) { case 0: return si.getName(); case 1: return...
9c37cbbf-6a94-4ad7-8ecc-975cb1ad9bcf
4
public GameCharacter.dir RandomDir(int i){ //System.out.println("RANDOM DIR"); switch(i){ case 0: return GameCharacter.dir.left; case 1: return GameCharacter.dir.right; case 2: return GameCharacter.dir.up; case 3: return GameCharacter.dir.down; ...
622fa7ae-9c54-4ad5-b7d5-702d6e5e64df
5
public void drawScene(Camera eyepers, int[] actors, double mult) { //First Draw the terrain, it's the simplest pretty much int terTricnt = baseScene.terrain.polys.length; for(int i = 0; i < terTricnt; i++) { int[] xpntarr = new int[3]; int[] ypntarr = new int[3]; Vector[] vecsplit = {baseScene.terrain...
c0cb2c0f-2598-48f7-944e-87380e4c744e
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...
5a2a8fa8-c588-4d7b-8568-c5baae332b17
2
@Test public void testStructure01() throws ParsingException, FileNotFoundException, XMLStreamException, TypeConversionException { setUp("/test01.xml"); assertTrue(parser.getElement() == null); Element e = parser.next(); assertEquals("level0", e.getName().getLocalPart()); assertTrue(e.hasAttribute(new QN...
a79ad94e-dfb5-4fbf-be34-668ad991e318
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Apartamento other = (Apartamento) obj; if (this.IdApartamento != other.IdApartamento && (this.IdApartamen...
2bcf22bf-3a00-4b87-a0b0-6be29a40eb51
9
public WordStatus dudenRequest(String myRequest) throws IOException { WordStatus result; String requestString; try { /* * URL to access the dictionary */ requestString = URLDecoder .decode("http://www.duden.de/rechtschreibung/" + myRequest, "UTF-8"); } catch (UnsupportedEncodingExcept...
2e16ffe2-dcb3-4c72-8961-3e8707a98407
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Album other = (Album) obj; if (myAuthor == null) { if (other.myAuthor != ...
32ee3220-80d6-4b63-97d7-546344791030
2
@Override public boolean contains(Object obj) { if (!isProperList()) { if (getDottedElement().equals(obj)) { return true; } } return super.contains(obj); }
8c41cf97-9ce0-499c-ad31-b87f8eeb731a
2
public void run() { for (int i = 0; i < 5; i++) { try { System.out.println(queue.take()); } catch (Exception e) { } } }
caa533db-992d-48ae-9e1a-4c8b8a94bfcf
6
public static Location extractTarget(AIUnit aiUnit, PathNode path) { if (path == null) return null; final Unit unit = aiUnit.getUnit(); final Location loc = path.getLastNode().getLocation(); Settlement settlement = loc.getSettlement(); Tile tile = loc.getTile(); Unit othe...
55862df9-8956-4c78-9339-c239ce038549
3
public void checkHummanity(){ if(!this.isAlive){ System.out.println("I'm dead, respawning..."); }else{ checkHunger(); checkWater(); checkStorage(); checkWeapons(); checkSight(); if(this.hunger <=2){ strength = this.hunger * 2; } if(this.water <=2){ strength = this.water * 2; ...
606b047b-aefc-4906-a64c-f7a07c345863
8
@Override public boolean canSetTrapOn(MOB mob, Physical P) { if(!super.canSetTrapOn(mob,P)) return false; if(mob!=null) { final Item I=findMostOfMaterial(mob.location(),RawMaterial.MATERIAL_WOODEN); if((I==null) ||(super.findNumberOfResource(mob.location(),I.material())<100)) { mob.tell(L("Y...
ee39ed9d-de5d-47cc-bea9-f9e3bc8ab90b
4
public void unpinPage(PageId PageId_in_a_DB, boolean dirty) throws ReplacerException, PageUnpinnedException, HashEntryNotFoundException, InvalidFrameNumberException { // Current frame descriptor index int frameNo = hashTable.lookup(PageId_in_a_DB); // Current frame descriptor...
82f07d97-d9b0-49fb-93aa-7db79c28b2cd
9
public final void setWalls(){ for (int i=0; i < width; i++){ grid[i][0].setUpWall(); grid[i][height-1].setDownWall(); } for (int i=0; i < height; i++){ grid[0][i].setLeftWall(); grid[width-1]...
cb6bebe0-e2d9-482b-b9b3-f62835ea7530
0
public void setPlainValue(Long value) { this.plainValue = value; }
c0282c63-cfa6-4b1b-84e0-3f4ed1933b06
8
public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (!f.hasTag(REGEXP_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args); } int id = f.methodId(); switch (id) { ...
366a6eca-0a81-47bb-a409-ee2ef369b6d4
8
public Attack(Type type, double damage, Moveable attacker, int direction) { super(type.shape); setColor(type.color); switch(direction) { case 1: dx = 0; dy = -1; break; case 2: dx = 1; dy = -1; break; case 3: dx = 1; dy = 0; break; case 4: dx = 1; dy = 1; break; case 5: dx = 0; dy = 1; break;...
8547eeef-2d39-4c2c-89bc-0467b3deca04
7
public static void main(String[] args){ Scanner in = new Scanner(System.in); int sum = in.nextInt(); int limit = in.nextInt(); int curr = 0; lower = new int[limit+1]; ArrayList<Integer> out = new ArrayList<Integer>(); HashSet<Integer> used = new HashSet<Integer>(); while(curr<sum){ int old = cu...
80f57d1e-0e1e-409a-b36b-371cff148603
9
protected boolean simpleExpressionEval(Environmental scripted, String arg1, String arg2, String cmp, String cmdName) { final double val1=CMath.s_parseMathExpression(arg1.trim()); final double val2=CMath.s_parseMathExpression(arg2.trim()); final Integer SIGN=signH.get(cmp); if(SIGN==null) { logError(script...
3b5eb57a-7f2a-44f4-91f0-adc80738cbf4
6
public static AccountCredentials getAccountCredentials() { String email = resourceBundle.getString("credential.email"); String token = resourceBundle.getString("credential.token"); email = email == null ? null : email.trim(); token = token == null ? null : token.trim(); // it ...
800a6984-6edc-4ee0-9625-2de3f492b5a9
9
public void filtrarCPF(String pesquisando) { filtrados.clear(); if (pesquisando == null) { pesquisando = ""; } pesquisando = pesquisando.toLowerCase(); for (ParceiroComercial atual : linhas) { if (atual.isFisica()) { if ((pesquisando.equ...
91e410c4-f97b-4696-931b-d079cd69e380
5
@Override public void doAction(String choice) { switch (choice) { case "G": // display the game menu GameControl.startNewGame(); GameMenuView gameMenu = new GameMenuView(); gameMenu.display(); break; case "H": // displ...
b649e545-e570-4c3e-8e1e-2c18d4d5a55e
8
public boolean stem() { int v_1; int v_2; int v_3; int v_4; // (, line 72 // do, line 74 v_1 = cursor; lab0: do { // call mark_regions, line 74 ...
413f41b5-f587-4f02-a438-58e97e00b0f1
9
public ArrayList<TestCase> getTestCaseContents(int caseNumber,String context, String component,String constraint, String effect){ for (int i=0;i<caseNumber;i++){ if (!context.isEmpty()) if ((testCase[i].getContext().getName())!= context) break; if (!component.isEmpty()) if ((testCase[i].getRcuT...
dfecff0b-88c1-4cde-b1d5-38129db9814d
6
public static String getSourceByClass(Class<?> koanClass) { File file = new File(getKoanFileLocation(koanClass)); StringBuffer contents = new StringBuffer(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(file)); String text = null; while ((tex...
4ffe4202-f24d-4940-b84b-7779f61f6163
5
@Override public void setCell(int x, int y, boolean live) { if (y<0 || y>=getHeight()) return; if (x<0 || x>=getWidth()) return; if (live) world[y][x] = 0; }
b2995999-3229-4d41-b454-dfffbfae8338
5
public CheckResultMessage checkG12(int day) { int r1 = get(23, 5); int c1 = get(24, 5); int r2 = get(47, 5); int c2 = get(48, 5); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); if (0 != getValue(r1 + 12, c1 + day, 5).compareTo( ...
40b3fcb0-a0f5-4e82-a322-d2e8e192d49f
1
private boolean jj_2_28(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_28(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(27, xla); } }
6674c66a-c487-416e-8fcf-07c3ae84f13b
3
public boolean duplicateEntryColumn(int y, String entry) { boolean duplicate = false; for (int i=0; i < sudokuGrid.length && !duplicate; i++) { duplicate = (sudokuGrid[i][y].equals(entry) ? true : false); } return duplicate; }
0a12664e-6c06-49c3-b1fa-04366321f0a0
2
public HashMap<String, Integer> readFilesFromFolder(String path) throws IOException { logger.debug("Reading files created."); if (!path.endsWith("/")) { path = path + "/"; } path = path + files_created; BufferedReader br = new BufferedReader(new FileReader(path)); String line; while ((line = br....
1e264888-59aa-4988-8184-ca4b588d88c4
9
public int Allegiance() { if(_occupants.isEmpty()) return 0; boolean contested = false; int loyalty = _occupants.get(0).getLoyalty(); for(int i = 1; i < _occupants.size(); i++) { if(!contested && _occupants.get(i).getLoyalty() != loyalty) { contested = true; if(loyalty != TurnManager.currentPlayer...
3c9b5fba-7186-419a-ba81-9c8dd78403d3
5
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + agi; result = prime * result + atk; result = prime * result + crit_res; result = prime * result + def; result = prime * result + ((itemset == null) ? 0 : itemset.hashCode()); result = prime * result + leve...
5f21e662-2608-407b-b3b8-eba9db57920b
8
String createDotString(String... dotStrings) { final StringBuilder sb = new StringBuilder(); double nodesep = getHorizontalDzeta(); if (nodesep < getMinNodeSep()) { nodesep = getMinNodeSep(); } final String nodesepInches = SvekUtils.pixelToInches(nodesep); // Log.println("nodesep=" + nodesepInches); d...