method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
38c1427b-f2e9-4048-b2d4-d943b58a6e1e
7
static final public void Term() throws ParseException { NotFact(); label_8: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case MULTIPLY: case DIVIDE: ; break; default: jj_la1[23] = jj_gen; break label_8; } switch ((jj_ntk==-1)?jj_n...
6e54724c-acd8-4371-a81a-bbf99d18fa9c
4
private int maxBest(int i, int j, int k){ double di = fitness.get(i); double dj = fitness.get(j); double dk = fitness.get(k); if(di >= dj && di >= dk){ return i; }else if(dj >= di && dj >= dk){ return j; }else{ return k; } }
04d09ed8-cc1f-4e95-81f0-e41f49dd61de
7
private String digestExpressionAux(String originalExpression) { final String PATTERN_START = "%{"; final String PATTERN_STOP = "}"; final char PATTERN_DELIMITER = ':'; while(true) { int PATTERN_START_INDEX = originalExpression.indexOf(PATTERN_START); int PATTERN_STOP_INDEX = originalExpre...
9268c827-02af-454f-afd2-2482de8ac2d3
8
private String removeCommentedOutScripts2(String script) { if (script == null) return null; int beg = script.indexOf("//"); if (beg == -1) return script; List<int[]> list = new ArrayList<int[]>(); int end = script.indexOf("\n", beg + 2); int beg0 = -1; while (beg != -1 && end != -1) { list.add(ne...
bed0930f-1d5b-4970-88d3-29b9c05422dd
2
@Override public void render(Screen screen) { super.render(screen); screen.render(getX(), getY(), getHeight(), getWidth(), sprite); if (text != null) { Art.FONT.render(getX()+(getWidth()-Art.FONT.getStringWidth(text))/2, getY()+(getHeight())/2 - (Art.FONT.getHeight()/2), text, screen); } // Render h...
c1fe6416-2cf1-4395-9316-da259a2e4820
3
private static Polls getPoll(String id) { Polls retVal = null; try { XStream xstream = new XStream(new DomDriver()); File remFile = new File((String) Server.prop.get("pollFilePath")); Polls[] allPolls = (Polls[]) xstream.fromXML(remFile); for (Polls poll : allPolls) { if (poll.getId().equals(id))...
0c91d39c-60f2-4eda-b682-500108d5e131
8
private Partition sIB_OptimizeT(Partition tmpT, Input input) { boolean done = false; int change = 0, loopCounter = 0; if(m_verbose) { System.out.println("Optimizing..."); System.out.println("-------------"); } while (!done) { change = 0; for (int i = 0; i < m_numInstances; i+...
7c78c53b-0a1d-4414-82df-fffca1a16f4e
2
private void createStructure() { Random random = new Random((int)Math.random()*100); data = new DataArrays<String[]>(); for(int i=0; i<kitSize; i++){ array = new String[length]; for (int j=0; j<array.length; j++){ array[j] = Integer.toString(random.nextInt...
58a21977-d447-47f4-9a5e-03008936af3c
3
private void loadResourcesIDs() { LinkedList resList; _resourcesIDs = new LinkedList<Integer>(); // waiting to get list of resources. Since GridSim package uses multi-threaded environment, your request might // arrive earlier before one or more grid resource entities manage to register ...
c76a88b1-c425-4749-971d-921a1c330f28
0
public Run() { states = new GameStates(); //Selecting Characters p1 = selectCharacters(1); p2 = selectCharacters(2); states.setPlayerOneTurn(); //Opens up GUI and start playing game = new GUI(states); play(); //Displays results results(); //Rolls for wild Benjamin benjamin(); ...
54f6d8ac-8faf-4800-a491-7730227e7d1d
3
public static Sha1Hash forFile (File file) throws IOException { MessageDigest md = null; try { md = MessageDigest.getInstance("SHA1"); } catch (NoSuchAlgorithmException e) { // If the SHA1 algorithm doesn't exist, returns null return null; } F...
0a5785ac-9340-44d0-a7d3-d6c404766654
5
@SuppressWarnings({"RedundantIfStatement"}) @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Cell cell = (Cell) o; if (column != cell.column) return false; if (row != cell.row) return fals...
98a3dd9e-ae66-45c3-939b-0471ba3782cc
8
public static Stella_Object clTranslateBooleanTest(Stella_Object tree, boolean invertP) { if (Stella_Object.safePrimaryType(tree) == Stella.SGT_STELLA_CONS) { { Cons tree000 = ((Cons)(tree)); { GeneralizedSymbol testValue000 = ((GeneralizedSymbol)(tree000.value)); if (testValue000 == Stell...
f8a51144-d7ac-4021-becb-a62ba9af672c
8
public void visitLdcInsn(final Object cst) { Item i = cw.newConstItem(cst); // Label currentBlock = this.currentBlock; if (currentBlock != null) { if (compute == FRAMES) { currentBlock.frame.execute(Opcodes.LDC, 0, cw, i); } else { int size; // computes the stack size variation if (i.type ==...
56295227-32fa-47a8-b10e-16c36948e372
6
private boolean _jspx_meth_c_otherwise_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:otherwise org.apache.taglibs.standard.tag.common.cor...
30252c6d-e5f0-493d-97ce-14321c27790d
0
@Override public void setMyProcess(Process p) { this.myProcess = p; }
5ab4200a-9b3d-4fb4-badd-28b20918565b
9
static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[41]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 29; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { ...
da6e747f-2e9c-43ec-8458-f79d4174ab1c
2
private String getRepresentation(String binary, String[] variables) { StringBuffer buffer = new StringBuffer(); for (int k = 0; k < binary.length(); k++) { char ch = binary.charAt(k); if (ch == ONE_CHAR) { buffer.append(variables[k]); } } return buffer.toString(); }
bab5395c-ec55-4371-bb63-0a6e7ed0063c
8
public String calculerGain(String gagnant, UUID uuid){ double totalMiseProrata = 0; double totalMiseGagnante = 0; if(gagnant == "N"){ for (ParisPersonne parisPersonne : listParisMatch) { return "SetBet|Mise de depart:" + parisPersonne.getMise() + "$,Resultat:" + (parisPersonne.getMise() * 0.75) + "$"; }...
43053a1b-95cf-4dbc-b329-663ed61667e4
7
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // PrintWriter writer = resp.getWriter(); resp.setCharacterEncoding("utf-8"); List<Event> list = null; list = LoadDriver.load(); if(list == null && list.size() > 0){ writer.writ...
552d4068-5709-48b3-87f1-6b56978c9540
0
@Basic @Column(name = "FUN_SUELDO") public Integer getFunSueldo() { return funSueldo; }
e7e7bedb-101b-46de-ab24-69bb051b3217
6
private String getMime(String extension) { String mime = ""; switch (extension) { case ".pdf": mime = "application/pdf"; break; case ".png": mime = "image/png"; case ".css": ...
2ba34bda-8ff0-4e9c-80b3-b2595235bea1
5
private AreaNode findLeaf(AreaObject objToFind) { Rectangle bounds = objToFind.getBounds(); for (int i = 0; i < mStorageCount; i++) { if (bounds.intersects(mStorage[i].getBounds())) { if (!mLeafNode) { AreaNode result = ((AreaNode) mStorage[i]).findLeaf(objToFind); if (result != null) { ret...
fdb094f9-1256-4516-9e24-44673918f191
2
public List<DependencyNode<T>>[] getLevelNodes() { List<DependencyNode<T>>[] levelNodes = new ArrayList[maximumDepth + 1]; for (int i = 0; i <= maximumDepth; i++) { levelNodes[i] = new ArrayList<DependencyNode<T>>(); } for (int i = 0; i < orderedSize; i++) { DependencyNode<T> dn = orderedNodes[i]; ...
4b9e42cb-5f80-453c-870e-04c9d437f60b
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TblStockId other = (TblStockId) obj; if (!Objects.equals(this.DistributorProductCode, other.DistributorPr...
ada096e0-2112-4914-8744-0d1f401da46b
5
public String execute() throws CrashException { try { Registry registry = LocateRegistry.getRegistry(destPeer.IPaddr, destPeer.serverPortno); ServerSideInterface stub = (ServerSideInterface) registry.lookup("ServerSide"); Set<Byte> crashedOrds; synchronized (sourcePeer) { if (timer != null) { /...
0bde4f65-6136-4899-bd1e-8e2de08430bc
8
public static void main(String[] args) throws Throwable{ BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); ArrayList<int[]> elefantes=new ArrayList<int[]>(); elefantes.add(new int[]{0,100001}); for(String ln;(ln=in.readLine())!=null;){ StringTokenizer st=new StringTokenizer(ln); elef...
36786c36-ce0e-46bd-967f-aa4427756df6
8
private static boolean logPassword(final String args[], int a) { // check current argument if (args[a].startsWith("-p") && args[a].length() > 2) { log.debug("args["+a+"]=-pxxxx"); return true; } else if (args[a].indexOf('=') != -1) { String[] split = arg...
7685f649-eab5-4a02-a81a-8781197285db
3
private int readBytes(byte[] b, int offs, int len) throws BitstreamException { int totalBytesRead = 0; try { while (len > 0) { int bytesread = source.read(b, offs, len); if (bytesread == -1) { break; } totalBytesRead += bytesread; offs += bytesread; len -= bytesread; }...
390d76af-7bb1-4cb2-a522-66d765503aaf
9
public void oldAgeDeath(Player p, Entity animal ){ if(this.willDie == true && this.getAge() > maxAge){ p.getWorld().playEffect(animal.getLocation(), Effect.EXTINGUISH, 50); animalUtility au = new animalUtility(plugin); this.animalNoise(animal, p); this.removeAnimalData(); Bukkit.broadcastMessage(Ch...
bbb3af42-c406-47f6-8358-ad4730ad12e1
0
public ByteCode getCode(int index) { return bytecodes.get(index); }
f45a23cd-8007-456f-80f8-55d24a1975c6
9
public String toString() { String outputString = ""; return super.toString() + "["+ "distance" + ":" + getDistance()+ "," + "linkActive" + ":" + getLinkActive()+ "]" + System.getProperties().getProperty("line.separator") + " " + "travelTime" + "=" + (getTravelTime() != null...
6a41907f-1a5e-443a-8798-8a40c70a2eb4
6
private Expr factor() throws IOException { Expr e; switch (token) { case '(': token = tokenizer.nextToken(); e = expr(); if (token != ')') throw new XLException("expecting \")\", found: " + token); token = tokenizer.nextToken(); ...
4f9dc08b-5ae3-4cf0-894f-3b9068b39347
9
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed // TODO add your handling code here: //DebugMode = true; logDebug("jComboBox1ActionPerformed:" + evt.getActionCommand()); if (evt.getActionCommand().equals("comboBoxEdited"...
2abd6aac-a80a-4ce8-8a7e-38dd0178f041
2
public double[] standardizedPersonVariances(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.variancesCalculated)this.meansAndVariances(); return this.standardizedPersonVariances; }
eb32e70c-1767-4b34-9317-c9a9993cb509
8
public boolean computeData(String response, double startOfRange, double endOfRange, int numberOfGifts){ boolean isEndOfRangeReached = false; try{ if(!response.equals(null)){ Object resultObject = jParser.parse(response); JSONObject resultJObject = (JSONObject) resultObject; JSONArray resultArray...
cd48821d-44bf-4f6a-a13f-e2ab3260bdb6
3
void fillArrayRandom(int n) { int[] arr = new int[n]; int min = Integer.MAX_VALUE, minIndex = 0; int max = Integer.MIN_VALUE, maxIndex = 0; int sum = 0; double average = 0; for (int i = 0; i < arr.length; i++){ arr[i] = (int) (50 + Math.random() * 51); ...
c2baf061-d4d5-4d35-9dd7-0146bf6d2c57
8
@Override public Parameter getParameter(final int parameterIndex) { Parameter parameter; switch (parameterIndex) { case 0: parameter = lo; break; case 1: parameter = mid; break; case 2: ...
21e72b54-6471-476f-9f34-51a14d5e017e
8
public void passLine(int bet) { if (money > 0 && bet <= money && bet >= 0) { if (combinedRoll == 7 || combinedRoll == 11) { player.loseMoney(bet); info.updateMoney(); } else if (combinedRoll == 2 || combinedRoll == 3 || combinedRoll == 12) { player.addMoney(bet); info.updateMoney(); } el...
8f821c94-ba0c-47a9-9136-a1112e9bccfc
0
public static void main(String[] args) { Game game = new Game(); game.create(); game.start(); }
accb5810-c534-49bb-868a-18c198df15b1
3
private static void initParameters(String[] args) throws ExecutionException { if ((args.length == 1) && (args[0].equalsIgnoreCase(PARAM_HELP))) { throw new InputMismatchException(); } else if (args.length == 3) { getParameters(args); } else { throw new ExecutionException(null); } }
11e89b3a-6a0e-4217-9840-7a99308f30a3
6
boolean user2Won() { for (int i = 0; i < 3; i++) if (getNumEachPiece(board[i], O)[0] == 3) return true; for (int j = 0; j < 3; j++) if (getNumEachPiece(getColumn(j), O)[0] == 3) return true; if (getNumEachPiece(getBottomUpDiag(), O)[0] == 3 || getNumEachPiece(getTopDownDiag(), O)[0] == 3) ret...
c4e6373c-99fb-4204-94f4-0bfaaaa60e6a
0
public int attack(){ return monster.fight(); }
87cfb66c-28a8-4c00-9633-68ec2640b814
8
@Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { /* get the default renderer */ super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); /* set the icon */ Task task =...
567a5c91-d664-4e86-aeeb-6c2d396b967b
0
public void setPrice(BigDecimal price) { this.price = price; }
d0585f14-081a-4c0d-91a4-adb7196ba03a
3
@Test(expected = ImpossibleSolutionException.class) public void test_unsolvable_matrix_solve() throws ImpossibleSolutionException,UnsquaredMatrixException, ElementOutOfRangeException{ int height=2; int width=2; System.out.print("Testing unsolvable matrix sol...
88c2d982-650a-46af-99f2-0cb2374c6fa2
0
@Before public void init(){ sortInsertion = new SortInsertion(); }
e55c161e-7781-40e3-9d0c-d3bca45bac25
6
private static String getVote(int bureau, int index) { int nombre = 0; // contient le nombre entré String choix = ""; // contient le texte entré par l'utilisateur do { choix = JOptionPane.showInputDialog("Concernant le bureau de scrutin numéro "+(bureau+1)+", "+ ...
11d4dec6-c5d8-4ab0-a4c1-79b0e4e4cce0
8
public ArrayList<Value> getLPS(String s) { String t = preProcess(s); int P[] = new int[t.length()]; P[0] = 0; int C=0,R =0; int maxLen =0; for(int i=1;i<t.length()-1;i++) { if(R>i){ int j = 2*C-i; P[i] = P[j] > R-i? R-i:P[j]; } else P[i] =0; while(t.charAt(i+P[i]+1)==t.charAt(...
ee30ec81-be6d-4fd6-ac7a-77a66cf84d5c
6
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int max = 0; boolean hasNegativeValue = false; while (true) { System.out.println("Please enter a number!"); int input = sc.nextInt(); if (!hasNegativeValue && input < 0) { max = input; hasNegativeValue = true; } ...
ce6187d3-a0f3-4fe5-b9ec-8f5440f90f8c
1
public WriteFile(String path) { try { writer = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(path, true))); } catch (FileNotFoundException e) { e.printStackTrace(); } }
6ea72249-e442-4f7d-8635-81aef022d3b9
4
@Override public void run() { try { while(!Thread.interrupted()) { lock.lock(); try { while(restaurant.meal != null) condition.await(); } finally { lock.unlock(); } ...
ca7deb81-e22e-4806-9e24-d0bf34e0c090
3
private void checkLevelSum() { if ( levelSum == -1 && resos != null ) { levelSum = 0; for(int i = 0; i < 8; i++) levelSum += resos[i]; } }
d0f55b5d-2276-435f-9c4a-0f730e695182
6
public void promptMove(GoEngine g) { boolean valid = false; while (valid == false) { int row; int col; System.out.println(name + ", select a space"); System.out.print("Row: "); row = g.in.nextInt(); System.out.print("Column: "); col = g.in.nextInt(); if (row >= 0 && row < 9 && col >= 0 && c...
a6fa0e29-19cb-4f13-a19b-cb23b3808630
1
public int numTokens() throws Exception { if (!tokenizer.hasMoreTokens()) { tokenizer = new StringTokenizer(reader.readLine().trim()); return numTokens(); } return tokenizer.countTokens(); }
02b40383-a9a1-498d-9ec1-8a50894d3183
2
@Override public String toString() { return "position "+ (position==null?"?":String.format("%02d",position)) +"/" +(setLength==null?"?":String.format("%02d",setLength)); }
fb602174-0a98-4899-93b7-d68b0613ba45
9
public void renderBottomFace(Block block, double d, double d1, double d2, int i) { Tessellator tessellator = Tessellator.instance; if (this.overrideBlockTexture >= 0) { i = this.overrideBlockTexture; } int j = (i & 15) << 4; int k = i & 240; double d3 = ((do...
303c1142-600a-4c75-bb56-638b69aafbd3
1
public final void visitEnd() { addEnd("class"); if (!singleDocument) { addDocumentEnd(); } }
600df4c4-7042-4c5a-b073-08321cc6624b
8
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { String json = request.getParameter("requestParam"); json = new String(json.getBytes("ISO8859_1"), "utf-8"); if (json != null) { // 解析请求的数据内容 RequestParam requestParam = RequestP...
0001e427-c913-4398-8296-7e77182d0de2
5
public static boolean existsT_USER_DU3() { java.sql.Statement stmt = null; try { synchronized (DBconn.class) { stmt = (Statement) connection.createStatement(); } int count = 0; String sql = "SELECT COUNT(*) FROM information_schema.tables WH...
14cce3e3-db1b-4f86-a685-358c44e054c8
4
@Override public void run(){ try { while(running){ objectReader = new ObjectInputStream(socket.getInputStream()); tmp = objectReader.readObject(); if (tmp != null && tmp instanceof Message){ this.game.handleOponentMessage((Messa...
9d6bb3a2-a146-4f6c-8196-dcb93f9d9f71
9
public final void unsubscribeSender( ClientSenderInterface sender, SystemObject[] objects, DataDescription dataDescription) { if(_highLevelCommunication == null) { throw new InitialisationNotCompleteException( "Die Datenverteiler-Applikationsfunktionen sind noch nicht initialisiert." ); } if((sender...
ec8ceaf2-9c84-4587-84c8-5d50f6a6ae06
6
public void writeType(Class c) { // A big ol' case statement -- what's polymorphism mean, again? // I really wish I could extend the base classes! // use the appropriate flags to tell SuperCollider what kind of // thing it is looking at if (Integer.class.equals(c)) { stream.write('i'); return; } ...
38d6f038-75fa-47dd-8333-05f872cfe438
1
public JPanel getStatustextInListChangesMenu() { if (!isInitialized()) { IllegalStateException e = new IllegalStateException("Call init first!"); throw e; } return this.statustextListPanel; }
7f0ddaf1-aba3-44d0-97de-9ea08a7dc432
3
@Override public void render(GUIContext container, Graphics g) throws SlickException { super.render(container, g); if (this.show) { for (int i = 0; i < this.items.size(); i++) { if (this.items.get(i) != null) { this.items.get(i).render(container, g); } } } }
23713298-e6c1-4895-9ea1-daa6097f0050
6
public synchronized void doSend() throws MessagingException { if (!isComplete()) throw new IllegalArgumentException( "doSend called before message was complete"); /** Properties object used to pass props into the MAIL API */ Properties props = new Properties(); props.put("mail.smtp.host", mailHost); ...
ee593b96-df69-48f4-8cd2-3d428f4ed0bd
2
@Override public void render(GameContainer gc, Graphics g) throws SlickException { int yOffset = 50; int xOffset = 50; for (int i = 0; i < 4; i++) { spriteSheet.getTileImage(i % 2, (int)Math.floor(i / 2)).draw((i * 40) + xOffset , yOffset); } spriteSheet2.getFullImage().draw(100 ,100); sprite.render(100...
d11a3cfb-392a-45ce-8089-1611c76eaec0
4
public static void showBorder(String worldName, BorderData border) { if (!borderEnabled()) return; if (!Config.DynmapBorderEnabled()) return; if ((border.getShape() == null) ? Config.ShapeRound() : border.getShape()) showRoundBorder(worldName, border); else showSquareBorder(worldName, border); }
9cfa5ff0-df2b-4d6a-86bb-f42bda6f9565
2
public Polarity inverse() { switch (this) { case Neg: return Pos; case Pos: return Neg; } throw new IllegalStateException(); }
5a3f4134-438f-4911-ad61-f6a75197108f
6
public static int StoreNewQuestion(Question QuestionToStore) { try { String statement = "INSERT INTO QUESTION (QUESTIONTEXT, ISVALIDATED,ISREJECTED,AUTHORID) "; statement += String.format("VALUES ('%s', %s, %s, %d)", QuestionToStore.questionText, QuestionToStore.isValidated ? "TRUE" : "FALSE...
b1f45e02-505d-43bb-b822-56f32088e9d8
3
public boolean isIndependent(){ ArrayList<String> subordinatingConjunctions = new ArrayList<>(); subordinatingConjunctions = this.initialize(subordinatingConjunctions); for(String s: clause){ for(String sc: subordinatingConjunctions){ if(s.equalsIgnoreCase(sc)){ return false; ...
ee201315-f012-4d1b-bbc5-9057fcfdb798
1
public boolean isEmpty() { if (! built) return itemBoundables.isEmpty(); return root.isEmpty(); }
14b3b8e6-8d13-4716-8625-847256c2863e
9
private FlowToken readCommandOrEnvironmentOrVerb() throws SnuggleParseException { /* We are handling either: * * 1. \command[opt]{arg}{...} * 2. \verb(*)... * 3. \begin{env}[opt]{arg}{...}...\end{env} * * Get the first character after '\' - which the calle...
99f6999a-7d05-40c5-aa14-8c2e3c39949c
1
public boolean checkPlayerIntersect(){ Rectangle r = new Rectangle(x, y, width, height); if (r.intersects(CharacterManager.character)) return true; return false; }
a960d316-132c-43e0-9434-b24cebf3f17e
9
private String fixBadChars(String s) { if (s == null || s.length() == 0) return s; Pattern p = Pattern.compile("[<>\"&]"); Matcher m = p.matcher(s); StringBuffer b = null; while (m.find()) { if (b == null) b = new StringBuffer(); switch (s.charAt(m.start(...
69da2580-05e2-4028-8fc5-153aec78f972
3
public SINR() { try{ alpha = Configuration.getIntegerParameter("SINR/alpha"); } catch(CorruptConfigurationEntryException e) { Tools.fatalError("The configuration entry SINR/alpha is not a valid double:\n\n" + e.getMessage()); } try { beta = Configuration.getDoubleParameter("SINR/beta"); } catch(Corru...
9bc718b3-ce65-42cb-9a49-dc21d5f8d9b7
3
@Override public boolean createLoan(Loan loan) { if (doc == null) return false; Element currRoot = doc.getRootElement(); Element parrentLoan = currRoot.getChild("loanBooks"); Element newLoan = new Element("loanBook"); int id = 0; for (Loan item : getLoans()) { if (item.getLoanID() > id) { id = i...
96b7f12f-922f-496e-97ae-f0379b0580c5
3
public Notowanie getOstatnie() { if(this.ostatnie == null) { if(this.getNotowania() != null && !this.getNotowania().isEmpty()) { this.ostatnie = this.getNotowania().get(this.getNotowania().size()-1); } } return this.ostatnie; }
fa9a6b1f-6388-4dcb-bf76-ed4a8e48e872
1
public boolean _setSpeedY(int speedY) { if(speedY > -1) { this.speedY = speedY; return true; } else { return false; } }
abf5569f-9110-4127-a38d-acf5ed8fb63e
0
public boolean isInRadius(Point3 p, double radius){ return this.minus(p).modulo() < radius; }
d1f2588b-8879-4172-bb14-f9eae101fad3
5
private void paintMarker4(Graphics2D g2, Cell a) { if(colorMode == 0) g2.setColor(Color.BLACK); else if(colorMode == 1) { Color c = new Color(238,154,0); g2.setColor(c); } else if(colorMode == 2) { g2.setColor(Color.red); } else if(colorMode == 3) g2.setColor(Color.white); //g...
91e5bc91-b3e3-4f0b-890d-36098bcbd140
2
public Double calcularValor(Jugador jugador) { List<Double> puntajes=jugador.getPuntajes(); List<Double> misPuntajes=new ArrayList<Double>(); if(!puntajes.isEmpty()){ misPuntajes.add(jugador.getPuntajes().get(puntajes.size()-1)); } if(puntajes.size()>1){ misPuntajes.add(jugador.getPuntajes().get(puntaj...
db5155c4-de7c-4912-9ce9-3d1a04d3cfb7
3
public long set(long millis, int value) { int[] ymd = iChronology.gjFromMillis(millis); millis = iChronology.getTimeOnlyMillis(millis) + iChronology.millisFromGJ(value, ymd[1], ymd[2]); if (ymd[1] == 2 && ymd[2] == 29 && !iChronology.isLeapYear(value)) { millis = iChronol...
281ea9b8-ead3-4714-acbb-0edf55988dcc
1
public String addParameters(String keyValuePairs) { blackhand = Boolean.parseBoolean(((keyValuePairs .split(GameSocketServer.BLACKHAND_KEY)[1]).split(",")[0])); surrender = Boolean.parseBoolean(((keyValuePairs .split(GameSocketServer.SURRENDER_KEY)[1]).split(",")[0])); teams = Boolean.parseBoolean(((keyVa...
40ffe76e-f45b-4ff5-90c6-07fce72d6695
2
public final String getFirstHeader(String name) { List<String> list = getHeader(name); if (list != null) { return list.isEmpty() ? "" : list.get(0); } return null; }
c3ffed3c-c041-4ad9-a4dd-9e033da7a744
8
public Set<Map.Entry<Character,Character>> entrySet() { return new AbstractSet<Map.Entry<Character,Character>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TCharCharMapDecorator.this.isEmpty(); } ...
dda86d46-5ac4-4a4d-9a6c-27ba7408c810
7
private List<Tile> getTilesAround(GameObject object) { List<Tile> tiles = new ArrayList<Tile>(); Area objectArea = object.area(); if (objectArea == null) { objectArea = new Area(object.tile().derive(-1, 1), object.tile().derive(1, -1)); } final Room room = script.roomStorage.getRoom(object); if (room !...
968c89c6-e7e7-4a23-889a-881688d844ac
6
private void saveChosenSeats(JButton[] button, int flightID, int numberOfSeats, String flight, int methodChecker, int customerID, JDialog dialog) { int seats = 0; String nameOfSeats = new String(); for(int i = 0; i<button.length; i++) { if(button[i].getBackground() == Color....
9aaca0fe-751e-4283-bb8a-5bfd841a6d13
0
@Test public void validaSenha(){ assertTrue("Valida senha: ", validadorUsuarios.validaSenha("123") == true); }
16f69ef2-96b7-47cf-83ef-f8e51e42335f
8
private static void makeTet7(SquareColor[][] tet) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (((i == 1 || i == 2) && j == 1) || ((i == 2 || i == 3) && j == 0)) { tet[i][j] = SquareColor.YELLOW; } else tet[i][j] = null; ...
0e3c39e3-c200-49a5-ae5e-c78c81081751
5
static final public ActorType actor_type() throws ParseException { Token typeToken = null; ActorType result; Token bname; Behavior beh; jj_consume_token(ACTOR); ...
f7104c91-8d82-405c-b334-ab810a42976e
3
public static String hexDigest(String algorithm, File[] files) { try { MessageDigest md = MessageDigest.getInstance(algorithm); byte[] buf = new byte[4096]; for (File f : files) { FileInputStream in = new FileInputStream(f); int nread = in.read...
caca52f5-a7fb-47ca-9d97-a32a9264d903
2
public JSONObject append(String key, Object value) throws JSONException { testValidity(value); Object object = this.opt(key); if (object == null) { this.put(key, new JSONArray().put(value)); } else if (object instanceof JSONArray) { this.put(key, ((JSONArray)objec...
b1a26fde-a9a9-4ea2-8f6d-29ff4268f86e
2
public void run() { List<String> codeByLine = new ArrayList<String>(); /* Read all lines of code from the file and merge them into one string. */ Scanner scanner = new Scanner(inputStream); while(scanner.hasNext()) { String c = scanner.nextLine(); ...
ce611ac6-190b-4c55-9dd7-7b05c47021f9
1
private void clearMaps() { // Iterate our draw layers and create maps for them for (List<VisibleSprite> visibleSpriteList : visibleSprites.values()) { visibleSpriteList.clear(); } }
e42fe883-ca9b-417f-9c62-dac18531a288
5
public GBC(int gridx, int gridy, Align align) { this.gridx = gridx; this.gridy = gridy; if (align != null) { if (align == Align.LEFT) setInsets(5, 5, 5, 60); else if (align == Align.MID) setInsets(5, 5, 5, 5); else if (align == Align.RIGHT) setInsets(5, 60, 5, 5); else if (align == Align.T...
5e2a346f-3b29-4461-ac09-9000d8f97475
9
private void loadCards() { InputStream xmlStream = this.getClass().getResourceAsStream("cards.xml"); InputStream textStream = this.getClass().getResourceAsStream("text.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder; try { dBuilder = dbFactory.newDoc...
35fb7078-6b4e-46a2-924d-66eab3518c06
9
public Value unaryOperation(final AbstractInsnNode insn, final Value value) { int size; switch (insn.getOpcode()) { case LNEG: case DNEG: case I2L: case I2D: case L2D: case F2L: case F2D: case D2L: ...
610e0ffa-ac5c-48de-ad3b-d09074a8a0d5
3
private void checkRunBridge() { // TODO Auto-generated method stub if(client_bridge.isCreateAttackUnitRequest()){ } if(client_bridge.isMeoMeoNumIncreaseRequest()){ } if(client_bridge.isMeoMeoTechUpgradeRequest()){ } }
732a5acf-4878-4a2a-9c16-653a7f07531a
7
@Override public void mousePressed(MouseEvent e) { //right lick on shape if (e.getButton() == MouseEvent.BUTTON3 && entered != null) { model.removeShape(entered); } //left click else if (e.getButton() == MouseEvent.BUTTON1) { ...