method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f9864876-19cd-44e7-b961-f9886026ed55
3
public static Cliente isCliente(ArrayList<Cliente> array, String dni){ boolean aux=false; Cliente a=null;; for(int i=0; i<array.size() && aux==false; i++){ if(array.get(i).getDni().equalsIgnoreCase(dni)){ aux=true; a=array.get(i); } } return a; }
e2feeb3f-962f-40c4-a521-93277ed6da06
9
public boolean add(String S){ Node currNode; //If the DLB is empty creates a link list of children followed by a Node with a sentinel character. Sets the root to the first character //of this word. if(DLBStart == null){ Node tempNode = new Node(S.charAt(0),null,null); DLBStart = tempNode; for...
843adcab-5a8a-4cb3-b50c-8c5d5fbb3a9a
0
public int getRuscus() { return ruscus; }
29f22d70-c958-43d7-9e8a-caa54e0e0368
3
@Override protected void press() { switch (selected) { case 0: setState(joinServerId); break; case 1: setState(startServerId); break; case 2: setState(startId); break; } }
57500910-f335-4793-9ab9-b8957a866fa7
4
public void update() { x += dx; while(x <= -width) x += width; while(x >= width) x -= width; y += dy; while(y <= -height) y += height; while(y >= height) y -= height; }
42e9c7d4-b644-4697-a923-4a3108c34e60
9
public void rotate(Vektor3D vekt,double angle) { double tempX = x; double tempY = y; double tempZ = z; if(vekt.getX() == 0 && vekt.getY() == 0 && vekt.getZ() > 0) { x = Math.cos(angle)*x-Math.sin(angle)*y; y = Math.sin(angle)*x+Math.cos(angle)*y; ...
114a9255-eed8-48a8-b85a-849f88d7dba4
5
public JSONObject toJSONObject() throws ParseException { JSONObject obj = new JSONObject(); obj.put(KEY_NUM_CONTEST, new Integer(numInitialContestants)); JSONArray cons = new JSONArray(); for (Object o : allContestants) { if (o != null) cons.add(((Contestant) o).toJSONObject()); } JSONArray users =...
c399b031-e5c9-4b10-9e26-ac46ac5fa03d
8
public final void init(){ for (int i = 0; i < width; i++){ for (int j = 0; j < height; j++){ grid[i][j] = new Node(i,j); } } for (int i = 0; i < width; i++){ ...
b222b88b-829e-407a-8dd0-ad08810e8e37
4
public Integer clearSigns(Integer timerID) { Integer changed = 0; DB_StartSign startSign = this.getStartSign(timerID); DB_StopSign stopSign = this.getStopSign(timerID); if (startSign != null) { Sign sign = this.getSign_Start(startSign); if (sign != null) { sign.setLine(0, ""); sign.setLine(1, "");...
8ccc0496-ca1c-4780-b65d-825ca2ca3c48
1
public void complete() { if(callback != null) callback.run(this); }
516912cf-a832-453a-83b7-eeceaca85a48
1
public boolean checksums() { if (h_protection_bit == 0) return true; else return false; }
1f2fa6cd-4b52-49cd-8189-ba82df09f5ed
8
private void processSecondaryOrders(RdpPacket_Localised data) throws OrderException, RdesktopException { int length = 0; int type = 0; int flags = 0; int next_order = 0; length = data.getLittleEndian16(); flags = data.getLittleEndian16(); type = data....
a99a7e71-b520-4711-b584-5517373a9c8b
1
static String read() { try { return in.readLine(); } catch (IOException e) { e.printStackTrace(); return ""; } }
c1e69608-0f7b-4719-b51e-740b8cd1af45
1
public String toString () { if (ampString == "") generateAmpString(); return ampString; }
a5d669f5-bf69-4dd4-97c3-3979f2b939de
5
private boolean versionCheck(String title) { if (this.type != UpdateType.NO_VERSION_CHECK) { final String localVersion = this.plugin.getDescription().getVersion(); if (title.split(delimiter).length == 2) { final String remoteVersion = title.split(delimiter)[1].split(" ")[...
8f685a2b-5429-408d-90d5-7d6cb59658c7
8
private void drawBorder() { int height = getDecoratedView().getHeight(); int width = getDecoratedView().getWidth(); // Top border for(int i = 0; i < thickness; i++) { for(int x = 0; x < width; x++) { getDecoratedView().draw(new Coordinate(x, i), character.get...
4795f73e-b999-4089-81b0-26b138c8a119
6
public boolean close() { final Component child = ctx.widgets.component(1477, 54).component(2); if (child.valid() && child.visible()) { final Rectangle rect = child.boundingRect(); if (rect != null) { rect.translate(15, 20); rect.width /= 2; rect.height /= 3; TargetableRectangle targetableRecta...
62cc209d-9a86-4c9f-9c99-14dbdb35ee10
6
public void shiftAC(int left, int right) { if(left < 0 || left > 9) { return; } if(right < 0 || right > 9) { return; } while(left != 0) { AC.setCarry(getACValue() / 100); setACValue((getACValue() % 100)...
b97101c4-e55f-412e-ae95-bfc5cc13f663
9
private void comShooting(){ if(level=="Easy"){ easy(); } else if(level=="Medium"){ skll=(int)(Math.random()*5); if(skll>=0 && skll<2) easy(); else medium(); } else if(level=="Hard"){ skll=(int)(Math....
a424021a-6d50-4deb-a537-84ee907f2a61
9
boolean toKatakana(KanjiInput input, Writer output) throws IOException { if (!isHiragana(input.get())) { return false; } while (true) { int ch = input.get(); if (ch == '\u3046') { // 'u' input.consume(1); int ch2 = input.get(); ...
5f89c256-92bc-4dfd-a399-292a6a1f600c
3
public ArrayList<Block> filter(ArrayList<Block> list) { if (!enabled) return list; for (int i = 0; i < list.size(); i++) // Okay to check status by pointer if (list.get(i).offering.getStatus() == status) list.remove(i--); return list; }
b3e10e55-5b0c-48d1-9bad-dcbd781e6266
0
public int[] getIgnoreColumnIndex() { return ignoreColumnIndex; }
441504f7-2f76-4cb9-ab8a-4b3aea2ef748
1
public static JSONObject showNotImplemented() { JSONObject jo = new JSONObject(); try { jo.put("rtnCode", "501 not implemented"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return jo; }
4e466f90-5236-4520-8c88-98f97c6b0088
6
@EventHandler public void IronGolemSlow(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.getIronGolemConfig().getDouble("IronGolem.S...
e9c02a66-3cc9-4641-9517-6cd83b286601
0
public SingleScorePanel(AnswerSide answerSide) { this.answerSide = answerSide; setBorder(DefaultUIProvider.getDefaultEmptyEtchedBorder()); setPreferredSize(new Dimension(150, ScorePanel.MAX_HEIGHT)); BoxLayout boxLayout = new BoxLayout(this, BoxLayout.Y_AXIS); setLayout(box...
5cf2557b-99ba-437d-8435-a7b10fdba17a
3
private void setBodyPart(BodyPart bodypart, Robot robot){ switch (this.activeBodypartSummaryPanel.getBodypart().getType()){ case Head: robot.setHead((Head) bodypart); break; case Body: robot.setBody((Body) bodypart); break; case Limbs: robot.setLimbs((Limbs) bodypart); break; } }
bae12286-3499-4323-a0ce-1fb6c3c5a8fe
6
private void resaveParamsShowDirections(SessionRequestContent request) { String validDirectionStatus = request.getParameter(JSP_DIRECTION_VALID_STATUS); if(validDirectionStatus != null) { request.setSessionAttribute(JSP_DIRECTION_VALID_STATUS, validDirectionStatus); } String...
02baddde-2f41-4203-a669-4080a9042346
3
private String sentenceToString(AbstractComponent component) throws BookException { StringBuilder sb = new StringBuilder(); try { Iterator<AbstractComponent> iterator = component.getIterator(); while (iterator.hasNext()) { AbstractComponent c = iterator.next(); if (c.getType() == EComponentType.LEX...
3d17f79d-7703-48ce-9700-e4db0594bedc
8
final void method488(int i) { if ((((ObjectDefinition) this).anInt874 ^ 0xffffffff) == 0) { ((ObjectDefinition) this).anInt874 = 0; if (aByteArray885 != null && (aByteArray885.length ^ 0xffffffff) == -2 && aByteArray885[0] == 10) ((ObjectDefinition) this).anInt874 = 1; for (int i_82_ = 0; i_82_ < ...
0e6189e4-ae21-43cd-acbd-3d261d030c36
8
@Override public void tick(double deltaTime) { boolean touching = false; for(GameObject go: ep.getGos()){ if(go.touches(this) && go != this){ if((go.getPos().getX()-go.getWidth()/2-this.getPos().getX()) /(go.getPos().getY()-go.getHeight()/2 - this.getPos().getY()) < 2 && ((EpWall)go).getSize() ...
6ccf4620-f683-43dc-ba2e-f9e65c381eb9
2
public void salvarLista(List<T> ts) throws ValidacaoException { try { transacao = session.beginTransaction(); session.clear(); for (T t : ts) { session.save(t); } transacao.commit(); } catch (HibernateException e) { ...
27f6310b-3fc6-4387-b961-7c9ceebdc105
3
public static void toggleComment(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree); JoeNodeList nodeList = tree.getSelectedNodes(); for (int i = 0, limit = nodeList.size(); i < limit; i++) { toggleCommentForSingl...
d2f271e5-6d27-47f7-b762-e4ec25fe1378
2
public void testWrite() { try { ConfigurationManager.init("src/test/resources/test.json"); try { ConfigurationManager.writer.write("diff", new String[]{"test", "object", "test"}); JSONObject test_diff = ConfigurationManager.read.getJSONObjectItem("test", "object"); assertEquals("diff", test...
955229c5-5821-4a7f-9b3e-8aac58ca0225
9
public void prePhysicsTick(PhysicsSpace space,float tpf){ if(isPressedFarward) { if(throttle+tpf*2<1) { throttle +=tpf*2; } else{ throttle = 1; } resetInpu...
a974219e-4ea1-4a56-a193-d496015f72dd
8
public void write( byte[] data, int off, int len ) { assert data != null; assert off >= 0; assert data.length >= off+len; int wLen = len+3; // Total length of block+framing if written as a WHOLEBLOCK // If it would fit in a single packet, but not in the current one, flush first. if( bufPos+wLen > buf...
5e70124a-610a-44d1-8c8d-cd4cf2e941b4
5
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { /** * Servlet tulostaa tietokannasta paistoa ja toimitusta vaille olevat * tilaukset. */ // Luodaan tyhjät listat ArrayList<Tilaus> paistettavat = new ArrayList<Tilaus>(); ArrayLis...
d544611a-3530-4cdd-9c9a-9eea2d90231c
9
public boolean isNear(int index) { //directly on top of the ball if (currentLocation == index) { return true; //directly adjacent(left, right, up, down) } else if (currentLocation == index + 1 || currentLocation == index - 1 || currentLocation == index - 28 || currentLocation == index + 28) { return true;...
e0e2c842-daa7-441b-b86a-49f4ae61ee4c
5
public static void main(String[] args) throws IOException { for (int m=0; m<4; m++) { // load in the maze strings ArrayList<String> lines = new ArrayList<>(); File file = new File("level0.txt"); Scanner s = new Scanner(file); while (s.hasNextLine()) { lines.add(s.nextLine()...
6ca4d228-859e-4e28-ae3b-6f705cf0ffbb
9
public static void process(java.util.Scanner scan,boolean stdin) { while(true) { if(stdin) { System.out.print(">"); } if(!scan.hasNextLine()) { break; } String code=scan.nextLine(); if(stdin&&(code.startsWith("exit")||code.startsWith("quit"))) { return; } try { if...
e2283914-193b-4192-abfa-3e013907e959
0
public CYKTracer(Grammar grammar, ArrayList<Production> trace) { myOriginalGrammar=grammar; myTrace=trace; myAnswer=new ArrayList <Production>(); myOriginalProductions=myOriginalGrammar.getProductions(); initializeLambdaStepMap(); }
8b51b2db-5532-4ba6-8b33-5933e42a4a79
0
@Override public void rotateZ(int angle) { base = DimensionalTrasform.rotateZ(angle, base); setColoredExes(); }
dcddcea3-ae6c-4966-a1f4-5b4d58fc35c7
3
@Override public List<AccessPoint> list() { Process p; ProcessBuilder pb = new ProcessBuilder("nm-tool"); List<AccessPoint> accessPoints = new ArrayList<AccessPoint>(); try { p = pb.start(); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); String line; while ((li...
29d6dcc0-874f-445c-9d34-9db2965e7640
7
public ArrayList<Node> readFromAdjacencyMatrix(String file){ ArrayList<Node> nodes = new ArrayList<>(); try { BufferedReader in = new BufferedReader(new FileReader(file)); String line; String[] parts; line = in.readLine(); parts = line....
95515ca6-f6cd-4bd7-b33c-56a5c5e922ac
2
public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException { Input input = gc.getInput(); if(input.isKeyPressed(Input.KEY_SPACE)){ Sounds.bleep.play(); sbg.getState(1).init(gc, sbg); sbg.enterState(1); } counter+=delta; if(counter > 2000){ bgcolor = (bgcolor+1)...
fca3b4d9-99a0-42d1-a18c-7cc5a5ceead6
9
public static int testPublic(int testNum) { String inputFilename = String.format("tests/test%02d.crx", testNum); String outputFilename = String.format("tests/test%02d.rea", testNum); String expectedFilename = String.format("tests/test%02d.out", testNum); Scanner s = null; try { s = new Scanner(new File...
e3f15da1-7161-4471-b4d2-30d3b139cf84
6
public static PictureQuestion getPictureQuestionByXMLElem(XMLElement root, Quiz quiz, int pos) { int quizID = quiz.quizID; int position = pos; Object question = new String(); Object answer = null; double score = 10; String url = null; for (int i = 0; i < root.childList.size(); i++) { XMLElement elem = ...
276cf829-88c1-4f66-ab02-122caea967a5
9
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException { float xa = getPlayer().getX(); float ya = getPlayer().getY(); float xb = getX(); float yb = getY(); if(pythagore(xa, ya, xb, yb) < getRayonDetection() && !getDetected()) { // Le joueur est detecté...
121a83fb-ec1e-45a8-939e-ffbb5b649ce7
8
public Boolean deterministic(float dt, rrandom rng) { double saturation; saturation = (double) 1.; for (int i = 0; i < input_species.size(); i++) { double cons; cons = input_species.get(i).getNumber(); // cons = input_species.get(i).getMy_concentration(); saturation = saturation * cons; } double ...
8186474b-92ca-44a8-bb91-6291ff469241
2
public final boolean flush () { // If there are no un-flushed items, do nothing. if (w == f) { return true; } // Try to set 'c' to 'f'. if (!c.compareAndSet(w, f)) { // Compare-and-swap was unseccessful because 'c' is NULL. //...
4b2427cd-0168-4d2a-a80c-875987541cc5
0
public void playWarnSound() { warnClip.start(); }
7785dc71-bf49-48ad-8182-bdbfa6e0dbce
9
public void update() { // Moves Character or Scrolls Background accordingly. rect.setRect(centerX -34, centerY-63, 68, 63); rect2.setRect(rect.getX(),rect.getY() +63, 68, 64); rect3.setRect(rect.getX() - 26, rect.getY()+32, 26, 20); rect4.setRect(rect.getX() + 68, rect.getY()+32, 26, 20); yellowRed.setRect...
0f1ce681-450f-49c0-aa4b-7559ff5f6050
1
public String getData(InputStream inputStream) throws IOException { Scanner reader = new Scanner(inputStream); reader.useDelimiter("\\|"); return reader.hasNext() ? reader.next() : ""; }
7b82558c-f955-4ca7-804d-2cd87160fb1a
5
public void startPublicServerGame(Map map) { if (map.getMap() != null) this.map = map.getMap(); if (map.getCollisionMap() != null) this.collisionMap = map.getCollisionMap(); for (int x = 0; x <= collisionMap.getWidth() - 1; x++) { for (int y = 0; y <= collisionMap.getHeight() - 1; y++) { if (collisio...
8f25c5ef-c76e-4a11-b1f4-bc0b09f38bd1
7
private CMListNode nodeAt(int arg0) { if((arg0<0)||(arg0>=size)) return null; else { CMListNode curr; int i; int ch; if((arg0==size-1) || (arg0 > size/2)) { curr=tail; i=size-1; ch=-1; } else { curr=head; i=0; ch=1; } while(curr != null) { if(i==arg...
26307021-89e8-4761-a98b-a0f1d913c633
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://downl...
a148ae07-16c5-44a9-81c9-0b4453996cd9
6
public static void main(String[] args) { Scanner in = new Scanner(System.in); int chapters = in.nextInt(); int maxProbs = in.nextInt(); int bookPageIndex = 0; int magicProbs = 0; System.out.println("Chapters : "+chapters); System.out.println("Max Probs : "+maxProbs); for(int i=0; i<chapters; i++){ in...
8e141380-9135-4978-a5a4-e9249aa79560
0
public void setPrueba(String prueba) { this.prueba = prueba; }
a579cfe2-a9c1-43be-b99c-422f904fc94f
9
private final void method2593(byte[] is, int[] is_76_, int[] is_77_, int i, int i_78_, int i_79_, int i_80_, int i_81_, int i_82_, int i_83_, int i_84_, int i_85_, int i_86_, aa var_aa, int i_87_, int i_88_) { aa_Sub3 var_aa_Sub3 = (aa_Sub3) var_aa; int[] is_89_ = ((aa_Sub3) var_aa_Sub3).anIntArray5...
788c4069-6fa3-4402-8dbe-6e392a98c7ff
4
static boolean isNotACountry(final String tag) { // Tested and found that .equals is much faster than .matches, even if // it's done several times and .matches is done once. if (tag.length() == 0 || tag.equals("---") || tag.equalsIgnoreCase("XXX") || tag.equalsIgnoreCase("none"))...
bf6775ed-6052-4a96-9e4e-905117220ada
2
SlidingPuzzleBoard(final int colCount, final int rowCount) { setStyle("-fx-background-color: #f3f3f3; " + "-fx-border-color: #f3f3f3; "); cols = colCount; rows = rowCount; double gameBoardWidth = SlidingPuzzlePiece.getPuzzleSize() * colCount; double gameBoardHei...
870dff5f-5f69-4464-b81d-8782c785d171
5
public void AttackAllStates(int[] inTargets){ // Iterator<GameState> i = AllStates.iterator(); // while(i.hasNext()){ // GameState a = i.next(); // if(a.WolfAttack(inTargets)){ // // state is allowed, and has been updated. // } else { //state was not allowed, and is removed // i.remove(); // } // } ...
940bbb57-3034-40c4-a62d-cba69a75f481
0
private void drawArrow(Graphics g, Point head, Point away) { int endX, endY; double angle = Math.atan2((double) (away.x - head.x), (double) (away.y - head.y)); angle += ARROW_ANGLE; endX = ((int) (Math.sin(angle) * ARROW_LENGTH)) + head.x; endY = ((int) (Math.cos(angle) * ARROW_LENGTH)) + head.y; g.draw...
1cc3d6fa-75d5-4145-abf3-3bbf332769af
9
@Override public Set<String> checkConflict(String resource, String transaction, LockType requestType) { ResourceLock thisLock = locksOfR.get(resource); // There is no lock on this resource. if (thisLock == null || thisLock.getType() == null) return new HashSet<Strin...
c4a4076a-fb26-4e15-819e-96d86275fd88
8
public fgraph create(String edge_file, String feat_file) throws IOException { fgraph g=new fgraph(); String line=""; BufferedReader br=new BufferedReader(new FileReader(edge_file)); while((line=br.readLine())!=null) { if(!line.matches("^[0-9]+[\t][0-9]+")) { throw new IOException("Error in file fo...
7f0f9543-32d6-4079-acbf-e385cbc84c89
5
private void processMasterAddResult(Sim_event ev) { if (ev == null) { return; } Object[] data = (Object[]) ev.get_data(); if (data == null) { return; } String filename = (String) data[0]; // get file name int registrationID = ((Integer) d...
01b63983-a6d5-4136-9a48-0a8a28165d3f
5
static void update(int delta) { for (int i = 0; i < entities.size(); i++) entities.get(i).update(delta); if (spawnNazi > 0) spawnNazi -= delta; else if (areThereAnyDoses()) { int naziX = random.nextInt(4100) + 600; entities.add(new Nazi(naziX, 0)); print("Spawned a Nazi at " + naziX + ", 0"); s...
81136345-87cf-4438-9b3e-2b5076036da9
0
protected void initialize() { Robot.tomahawk.move(_forward); _hasChanged = false; lightCommand.start(); }
ababad53-cc63-4a1d-958e-ff337d4573dd
4
public static int rangeRing(String key){//, int shardsAmount){ //by rangeRing (MongoDB simple implementation) /*if (DataPartition.shardsAmount == 0 || DataPartition.shardsAmount != shardsAmount){ constructRangeRing(shardsAmount); DataPartition.shardsAmount = shardsAmount; } ...
8d62d83e-7c01-4e5a-bb7b-31c929b87170
3
public void reintegros(){ String concepto; float debe, haber,saldo,saldonuevo; CCuenta cta=leer(nregs-1); saldo=cta.getSaldo(); concepto = Pantalla.pideCadena("Introduce concepto: "); haber = 0;//siempre 0 debe=Pantalla.pideFloat("Introduce cantidad a ret...
6fe82c0c-445e-4290-aff8-10442478ec23
7
private void loadData() { try { File file = new File(getDataFolder(), "data.txt"); if(file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String l = br.readLine(); while(l != null) { if(l.startsWith("oq:")) { oq.add(new String(l.substring(3))); ...
8d23709a-5ed9-41d3-b157-f76a346ce250
5
public void delete() { Connection conn = null; PreparedStatement pstmt = null; try { Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://localhost:3306/rock?user=root&password=123456"; conn = DriverManager.getConnection(url); String sql = "delete from emp2 where ename=?"; pstmt = ...
d68f82dc-8d5f-4daf-a848-2762d64592ea
2
public void deleteRow(int index) { // delete row from database EntityTransaction userTransaction = manager.getTransaction(); userTransaction.begin(); projectService.deleteProject((String) getValueAt(index, 0)); userTransaction.commit(); projectResultList.remove(index); int row; int col; for (row = i...
695be436-c0fa-40f7-bf29-0693431e874a
4
public boolean isAllowed(int number) { if (!grid.isEditable(selectedRow, selectedColumn)) { Toolkit.getDefaultToolkit().beep(); return false; } Point p = grid.isAllowed(selectedRow, selectedColumn, number); if (p == null) { return true; } else ...
f34bd55d-8192-4777-9890-7e5985d1a845
2
public ExtractWorker(ExtractingDialog ed, File pack) { this.ed = ed; this.pack = pack; try { try (ZipFile zf = new ZipFile(pack)) { this.totalFiles = zf.size(); System.out.println("[Package] Total files: " + this.totalFiles); } } ca...
42400627-a8ab-4f17-b2ea-a4418c1b68cb
4
public String getClassType(int i) throws ClassFormatException { if (i == 0) return null; if (tags[i] != CLASS) throw new ClassFormatException("Tag mismatch"); String clName = getUTF8(indices1[i]); if (clName.charAt(0) != '[') { clName = ("L" + clName + ';').intern(); } try { TypeSignature.checkT...
a9a4ea25-c71d-4925-8837-e6da6b4d0cca
0
public double getRightSpeed(){ return _right.get(); }
8ef4acf0-5915-41a1-a007-8a6b681cb6ea
4
public boolean accept(File f) { if(f != null) { if(f.isDirectory()) { return true; } String extension = getExtension(f); if(extension != null && filters.get(getExtension(f)) != null) { return true; }; } return false; }
b8be7ae9-8934-4390-8cf3-0fff4b3511ef
1
public void testFactory_standardDaysIn_RPeriod() { assertEquals(0, Days.standardDaysIn((ReadablePeriod) null).getDays()); assertEquals(0, Days.standardDaysIn(Period.ZERO).getDays()); assertEquals(1, Days.standardDaysIn(new Period(0, 0, 0, 1, 0, 0, 0, 0)).getDays()); assertEquals(123, Day...
d82924c6-0322-4834-a4cb-0359d06b8f0e
4
public static void arc(double x, double y, double r, double angle1, double angle2) { if (r < 0) throw new RuntimeException("arc radius can't be negative"); while (angle2 < angle1) angle2 += 360; double xs = scaleX(x); double ys = scaleY(y); double ws = factorX(2*r); doubl...
e3772f46-48fe-4cdf-aa6b-b30bedf3c3b9
1
private int getMonthOfBirth() { view.printMonthOfBirthInputRequest(); int monthOfBirth = ConsoleInputUtils.readIntValue(); List<ValidateException> validateExceptionList = new DOBValidator().validateMonth(monthOfBirth); if (!validateExceptionList.isEmpty()) { view.printValid...
1dd1473f-b835-45c7-80db-f0451b9fa3e0
3
private boolean isLawyerOverflow(Processo proc) throws Exception{ List<Processo> list = retrieveAllProcessoAdvogado(proc.getAdvogado().getCodAdv()); int i = 0; for(Processo p : list){ if(p.getSituacao() == 0) i++; if(i == 3) return true; } return false; }
ebd7e057-e1f7-49f7-a061-71d4748f950a
7
private static void makeMove(List<Piece> placedPieces, List<Piece> remainingPieces, boolean performAnalysis) { Piece curPiece = remainingPieces.get(0); boolean moreOptions = true; boolean testResult = false; while (moreOptions && !testResult) { testResult = testPiece(curPiece); if (!testResult) { ...
e5e230e7-5c79-4132-9780-cade89613f44
6
public OnDemandData getNextNode() { OnDemandData onDemandData; synchronized(aClass19_1358) { onDemandData = (OnDemandData)aClass19_1358.popHead(); } if(onDemandData == null) return null; synchronized(nodeSubList) { onDemandData.unlinkSub(); } if(onDemandData.buffer == null) return onDem...
4f5aac88-44a9-4a7c-9bbb-0941faa27608
5
private boolean askNodesorFinish() throws IOException { /* If >= CONCURRENCY nodes are in transit, don't do anything */ if (this.config.maxConcurrentMessagesTransiting() <= this.messagesTransiting.size()) { return false; } /* Get unqueried nodes among the K close...
34d0d7a6-5d26-46a0-9b86-7192e0c38f6f
1
public boolean take(long id) { if(weaponID != NO_WEAPON) { return false; } weaponID = id; return true; }
d6e12aba-4cf0-4d69-80ee-d849a192c3ad
1
public static HttpServletRequest removePatient(HttpServletRequest request) { int patientID = Integer.parseInt(request.getParameter("patientID")); if (canRemove(patientID)) { Models.DatabaseModel.Patient patient = new Models.DatabaseModel.Patient(); patient.removePatient(patientI...
7aff7dd7-607f-41f8-9734-7b94a40087ae
1
@Test public void tiedostonLukeminenToimiiOikeallaSyotteella(){ kirjoitaOikeanmuotoinenSyote(); tiedot.LueTiedotTiedostosta(); String mappiinTallennetutTiedot = ""; HashMap<String, Integer> kartta = tiedot.getOpiskelut(); for (String avain: kartta.keySet()){ ...
390c2b6e-7e98-4f72-aff2-b9a627104c62
8
public void getTimes(Properties props) throws Exception { String valueString; int value; valueString = props.getProperty("interval"); if (valueString == null) { throw new MissingPropertiesException("monitor interval"); } value = Integer.parseInt(valueString);...
c332be64-0e16-4739-9cbd-827f139a4b48
1
public static EventBus getDefault() { if (eventBus == null) { eventBus = createDefaultEventBus(); } return eventBus; }
de892ad5-14e7-4659-87a2-55659a771bde
5
public static int evalRPN(String[] tokens) { Stack<String> stack = new Stack<String>(); for (int i = 0; i < tokens.length; i++) { int num1 = 0; int num2 = 0; if (tokens[i].equals("+")) { num1 = Integer.parseInt(stack.pop()); num2 = Integer.parseInt(stack.pop()); stack.push(String.valueOf(num2 +...
df2dfb71-9c5e-4d2a-ac5c-84610eb9fda0
0
public Serializable getObject() { return getLSystem(); }
46a3a3ad-d443-4e65-bc9a-6593c924c8f5
2
int getDirectionInt() { int dirInt = 0; for (int i = 0; i < Direction.values().length; i++) { if (Direction.values()[i].newPosition(getGrid().getElementPosition(parentPowerFailure)).equals(pos)) { dirInt = i; break; } } return dirInt; }
9ddcdbdf-e768-4dfc-8373-852462e35367
3
public void resetToStart(boolean twoPlayer) { vel[0] = vel[1] = 0; rotPos = rotVel = 0; acc[0] = acc[1] = 0; if (twoPlayer == false) { pos[0] = Asteroids.getScreenWidth() / 2; pos[1] = Asteroids.getScreenHeight() / 2; } else if (player == 0) { pos[0] = Asteroids.getScreenWidth() / 4; pos[1] = Aste...
86cb0483-d60f-4867-8281-6038ff13f600
4
public void init(){ topLeftWaypoint = new Point(); topLeftWaypoint.x = 200; topLeftWaypoint.y = mapheight - 200; bottomRightWaypoint = new Point(); bottomRightWaypoint.x = mapwidth - 200; bottomRightWaypoint.y = 200; base1Waypoint = new Point(); base1Waypoint.x = 200; base1Waypoint.y = 200; base2Way...
feb48556-9cc1-4f08-839a-30055dd49498
0
public void windowOpened(WindowEvent e) { System.out.println("Die Anwendung wurde ge\u00F6ffnet..."); }
364bb861-cbee-48d4-b5b4-00ae5ee60e2f
8
private boolean edge_adj(Edge e1,Edge e2) { if(e1.source.getId()==e2.source.getId() && e1.target.getId()==e2.target.getId()) return false; else if(e1.target.getId()==e2.source.getId() && e1.source.getId()==e2.target.getId()) return false; else if(e1.source.getId(...
f1bb424c-6655-4d34-903a-4fc1abe33773
3
public boolean validateExpression(String expression) throws Exception{ if(content.getAutomatonType() == AutomatonType.AFD) return validateAFDExpression(expression); else if(content.getAutomatonType() == AutomatonType.AFN) return validateAFNExpression(expression); else if(...
f2f4d84d-8a40-407e-82de-22a4b6d60145
7
public void compFinalResult() { do { iStage++; compAllocation(); if (compDistribution()) { /* deadline can not be satisfied */ if (!bDeadline) { System.out.println("THE DEADLINE CAN NOT BE SATISFIED!"); return; } else { System.out.println("\nNEW ROUND WITHOUT CHECKING:"); dEv...
c46c57c8-7361-44d1-97b5-78129ac4a597
9
public int getTemperatureAsRGB() { int temperature = this.getTemperature(); if (temperature<600) { // Y class // TODO correct color return 0xbf2901; // Brown } else if (temperature<1300) { // T class // TODO corr...
29a1da5b-2332-4893-ace7-b545475d6678
6
public Goods getMostValuableGoods() { if (!isEuropean()) return null; Goods goods = null; int highValue = 0; for (Colony colony : getColonies()) { for (Goods g : colony.getCompactGoods()) { if (getArrears(g.getType()) <= 0 && hasTraded(g.getType())) { ...