method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c05eb27a-e43e-49aa-bc0b-77535b4f2203
7
protected void testPower() { if (!(this instanceof ITrackPowered)) return; int i = tileEntity.xCoord; int j = tileEntity.yCoord; int k = tileEntity.zCoord; ITrackPowered r = (ITrackPowered) this; int meta = tileEntity.getBlockMetadata(); boolean powere...
11b378bd-f9f3-497c-84a9-057e45b8b3c0
9
public static void openURL(String url) { try { //attempt to use Desktop library from JDK 1.6+ Class<?> d = Class.forName("java.awt.Desktop"); d.getDeclaredMethod("browse", new Class[] {java.net.URI.class}).invoke( d.getDeclaredMethod("getDesktop").invoke(null), new Objec...
268f47b3-8ff1-4fec-9c66-666b73287434
6
protected void filter() throws LexerException { if (state.equals(State.COMENTARIO)) { if (comment == null) { comment = (TComentAninhado) token; text = new StringBuffer(comment.getText()); count = 1; token = null; } else { ...
0ccde532-3a55-4f7a-b358-b6750276f0ea
4
public static void main(String[] args) { File mountPath = null; FileSystem fsMount = new StaticFileSystem(); //this line turns the static file system into a static file system with RAM-Disk :) fsMount = new jfilesyslib.filesystems.MergeDirectlyFs(new MemoryFs(), fsMount) { @Override public Str...
9176346c-9875-4bc5-abfe-7618ab5b08b1
6
public boolean getBoolean(String key) throws JSONException { Object object = this.get(key); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String) object) .equalsIgnoreCase("false"))) { return false; } else if (object.equals...
8e1a73db-5bcf-4102-9052-15bba406b8ab
4
private boolean dansRectangle(int x1, int y1, int x2, int y2, int x, int y){ if ((x1<=x && x<=x2) && (y1<=y && y<=y2)) return true; return false; }
4cc0272c-1a3e-47fb-b128-a7f3078373f7
8
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { String identificador = null; try { identificador = obtemIdentificador(req); } catch (RecursoSemIdentificadorException e) { resp.sendError(400, e.getMessage()); } if...
7a136231-13cf-4201-b714-f2fe3cfb5630
8
public static Area getArea(double robotX, double robotY, double battleFiledWidth, double battleFieldHeight, double widthOffset, double heightOffset) { boolean nearWallXMin = robotX < widthOffset; boolean nearWallXMax = robotX > battleFiledWidth - widthOffset; boolean nearWallYMin = robotY < he...
7b9af77f-4f50-43ef-baa5-220426259d05
8
public static void load(int num) throws IOException { File f = new File(Util.getDataPath() + File.separator + "world" + num + ".jmp"); if (!f.exists()) { System.out.println("Could not find file: " + f.getAbsolutePath()); return; } FileInputStream fis = new FileInputStream(f); byte[] compressed = new by...
efd73f86-c05b-4433-a692-8126e6531230
8
public HomeScreen() { // Set the displayed title of the screen setTitle("TravelSDK Example"); CustomButtonField buttonFlightSearch = new CustomButtonField("Flight search"); buttonFlightSearch.setChangeListener(new FieldChangeListener() { public void fieldChanged(Field field, int context) { if (!...
a9bcb88d-e8e4-4019-b5d9-eee627c4349e
4
public static String removeStylename(String style, String stylename) { StringBuffer buffer = new StringBuffer(); if (style != null) { String[] tokens = style.split(";"); for (int i = 0; i < tokens.length; i++) { if (!tokens[i].equals(stylename)) { buffer.append(tokens[i] + ";"); } ...
f4b00362-533e-4e5c-bff6-1824b0c06caa
4
private void modifyNote(Map<String, Object> jsonrpc2Params) throws Exception { Map<String, Object> params = getParams(jsonrpc2Params, new NullableExtendedParam(Constants.Param.Name.NOTE_ID, false), new NullableExtendedParam(Constants.Param.Name.TEXT, true), new Nu...
c85e18c9-d936-413a-ac8d-c125ccbb67e2
4
public static void validatePassword(String password) throws TechnicalException { if (password == null || password.isEmpty() || password.length() > PASSWORD_SIZE) { throw new TechnicalException(PASSWORD_ERROR_MSG); } String regex = "[\\w]{4,}"; Pattern p = Pattern.compile(rege...
5f29f8b8-3191-4309-8621-69893d7b3a11
5
private int obtenerParametros(String s, ArrayList<Integer> parametros){ String cadAux; int delim1, delim2; while (s.compareTo("")!=0){ delim1=s.indexOf('<'); delim2=s.indexOf('>'); if ((delim1 < delim2)&&(delim1!= -1)&&(delim2!=-1)){ ...
dc54b99d-b285-4897-86c8-50f51e9b92d1
6
private void fillChengWeights() { for (Bookmark data : trainList) { int user = data.getUserID(); int resource = data.getWikiID(); List<Integer> tags = data.getTags(); Map<Integer, Double> tagUserWeights = null; if (user >= userTagWeights.size()) { tagUserWeights = new LinkedHashMap<Integer, Do...
f7f6bac9-d41d-4138-b0af-1cb4eaa07e5d
4
private JPanel getPanCode() { if (panCode == null) { panCode = new JPanel(); panCode.setBorder(BorderFactory.createTitledBorder("Code :")); panCode.setLayout(new BoxLayout(this.panCode,BoxLayout.Y_AXIS)); ButtonGroup group=new ButtonGroup(); for(int i=0;i<=Interface.CODES.values().length;i++) { fin...
9239af63-64e0-4200-96bd-007cadc94c93
8
List<CourseListing> getByCategoryAndType(String selectedCategory, String selectedType) { List<CourseListing> courseListing = new ArrayList<CourseListing>(); try { //Connect to database conn = DriverManager.getConnection(url, userName, password); stmt = conn.create...
92f4871e-6ed3-43b8-8012-550be57be462
6
public int getMachineIndexByName(String machineFileName){ ArrayList machines = getEnvironment().myObjects; if(machines == null) return -1; for(int k = 0; k < machines.size(); k++){ Object current = machines.get(k); if(current instanceof Automaton){ ...
6ecbb523-eb01-47a9-b51f-1f9d8a55cd33
7
public void executaMutacao() { for (int i = 1; i < cromossomos.size(); i++) { int rand1 = 0 + (int) (Math.random() * (cromossomos.size() - 0)); if (cromossomos.get(rand1).best) { continue; } int pontoMutacao = 0 + (int) (Math.random() * (1000 - 0))...
fd0218e4-96ef-4099-b7f9-668ee9c69109
6
void createColorAndFontGroup () { super.createColorAndFontGroup(); TableItem item = new TableItem(colorAndFontTable, SWT.None); item.setText(ControlExample.getResourceString ("Item_Foreground_Color")); item = new TableItem(colorAndFontTable, SWT.None); item.setText(ControlExample.getResourceString ("Item_B...
f50fee02-fc60-4979-80e5-4ae58866dfeb
2
public void pop() throws java.lang.Exception { if (vstack.empty()) throw new Exception( "Internal parser error: pop from empty virtual stack"); /* pop it */ vstack.pop(); /* if we are now empty transfer an element (if there is one) */ if (vstack.empty()) get_from_real();...
df52b421-a508-43f9-9445-3d35050d1bb4
8
private List<MazeCell> getNNodesDiagonal(MazeCell node) { ArrayList<MazeCell> nbrs = new ArrayList<>(); int x = node.getX(); int y = node.getY(); int xmin = x; int xmax = x; int ymin = y; int ymax = y; if (x - 1 >= 0) { xmin = x - 1; }...
b6dfab6d-8aab-43ec-b171-21119e23d873
1
public synchronized void editar(int i) { try { new PalavraChaveView(this, list.get(i)); } catch (Exception e) { } }
2e3d6294-0b22-47f7-83f4-d4fb7dc8c000
9
public void direction() { if (untouchable > 0) { Dolphin dolphin = (Dolphin) getWorld().getObjects(Dolphin.class).get(0); if (dolphin.direction == 0) { setRotation(0); } else if (dolphin.direction == 1) { setRotation(-45); ...
56bf4d60-d341-4ca5-a9ec-c6dfa775d229
6
protected void heapifyDown(int loc) { int max = loc; int leftChild = leftChild(loc); if (leftChild < size()) { double priority = priorities[loc]; double leftChildPriority = priorities[leftChild]; if (leftChildPriority > priority) max = leftChild; int rightChild = rightChild(l...
09b3d351-0fc9-42e8-8215-b39493609b4f
5
protected void processElement(IXMLReader reader, IXMLEntityResolver entityResolver) throws Exception { String str = XMLUtil.read(reader, '%'); char ch = str.charAt(0); if (ch != '!') { XMLUtil.skipTag(reader); return; } ...
93f7298f-b49a-4015-94a3-b3250dcdbb2a
8
private void loadConfig( String filename ) { try{ File file = new File(filename); BufferedReader br = new BufferedReader(new FileReader(file)); String str; while((str = br.readLine()) != null) { if( str != null ) { String item[] = str.split(":"); if( item[0].equals( "port" ) ) ...
2136c535-8ea7-4600-a272-d92a1ab298e2
6
private Collision trace(Scene scene, Ray ray) { Collision nearestCollision = null; for (SceneObject sceneObject : scene.getSceneObjects()) { if (sceneObject.checkIntersectionPossibility(ray)) { Collision collisions[] = sceneObject.trace(ray); if (col...
8e98a104-81d9-419e-87ef-b95f0d2cee0e
0
public static void main(String[] args) { int[][] arr={{1,2,3},{1,2,3},{1,2,3}}; NumMatrix numMatrix=new NumMatrix(arr); System.out.println(numMatrix.getRangeSum(1,1)); System.out.println(numMatrix.getRangeSum(0,1)); System.out.println(numMatrix.sumRegion(1,1,1,1)); }
5a6d0f88-7acc-4c43-aa44-0022a2e432da
6
private void initTradeElement(){ // Cree 5 TradeElement ( des JPanel contenant 2 paire de +/- et des labels indiquant les quantites echange ) for (int i=0;i<5;i++) { switch(i) // Correspondance entier-ressource : 0 = bois ; 1 = mouton ; 2 = ble ; 3 = argile ; 4 = minerai. { ...
82cf11ff-6c2b-4809-8e14-7f2e90bf4a3e
1
public double[] readAllDoubles() { String[] fields = readAllStrings(); double[] vals = new double[fields.length]; for (int i = 0; i < fields.length; i++) vals[i] = Double.parseDouble(fields[i]); return vals; }
bd6b2e7e-7bb4-4ce5-a6ad-0e64cc0282a4
2
private void scanProjectLessFiles() { List<LessFileStatus> lstAddedLfs = new ArrayList<LessFileStatus>(); synchronized (WATCH_LOCK) { if (conf.isRecursive()) recursiveScanDir("", dir, lstAddedLfs); else scanDir(dir, lstAddedLfs); } // - Not synchronized in order to avoid dead locks for (LessFile...
11829d35-dad6-4cfb-8c9b-9333c719ad7c
3
protected void save(Map<String,String> values) throws SQLException { if(isNew()) { Data.create(this, values); return; } int nColumn = values.size(); String[] aPiece = new String[nColumn]; String[] aValue = new String[nColumn]; Iterator<Entry<String,String>> it = values.entrySet().iterator(); f...
0096713f-93c3-4eb9-9180-0e7f246ed0a7
3
public boolean cast (Sorcerer sorcerer, Trigger trigger, Event event) { PlayerInteractEvent interactEvent = (PlayerInteractEvent) event; interactEvent.setCancelled(true); final Location origin; if (trigger.isBlockTriggered()) { origin = interactEvent.getClicke...
8987d593-96eb-4355-bfa3-a6b8cd8dabd6
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Pojo other = (Pojo) obj; if (dateTime == null) { if (other.dateTime != null) return false; } else if (!dateTime.equals(other.dateTime)) ...
654e5eac-137e-448f-8cd1-8216164ba440
3
@Override public List<T> sort(List<T> list) { // Iterate over the list, starting from the first element going to the last element. for (int outer = 1; outer < list.size(); outer++) { // In each iteration, perform another iteration from the very beginning of the list // to the point at which the ou...
66a8a11f-fe64-41f8-96d8-afe03aa47468
7
int decodevs(float[] a, int index, Buffer b, int step, int addmul){ int entry=decode(b); if(entry==-1) return (-1); switch(addmul){ case -1: for(int i=0, o=0; i<dim; i++, o+=step) a[index+o]=valuelist[entry*dim+i]; break; case 0: for(int i=0, o=0; i<dim; i...
faf1bb7c-eec4-419b-9de8-ac622af18377
2
public int[] maxNumber(int[] nums1, int[] nums2, int k) { if(k<=0) return new int[0]; int[] result={}; for(int i=0;i<=k;++i){ int[] a=search(nums1,i); int[] b=search(nums2,k-i); result=max(result,merger(a,b)); } return result; }
5ad0cc9b-f0e2-4841-a9bc-4632aab72f71
6
@Override public Group parse() { if(!this.prepared) { this.prepared = true; StringBuilder sB = new StringBuilder(); sB.append("("); Iterator<Object> elemIterator = this.elems.iterator(); while(elemIterator.hasNext()) { Object eRaw = elemIterator.next(); if(eRaw instanceof Elem) { ...
bfc0d5fd-0a6e-4687-ae44-d5f797c04314
7
public boolean setupBall(double ang) { boolean positivex = (Math.cos(ang) > 0); boolean positivey = (Math.sin(ang) > 0); ball = new Ball(0, 0, ang); ball.update(); boolean b1 = (positivex && ball.X() > 0.01) || (!positivex && ball.X() < -0.01); boolean b2 = (positivey...
caaf1716-a2b4-477d-9edb-43d5b398203d
1
public Set<Key> getKeys() { HashSet<Key> keySet = new HashSet<Key>(); for (ArrayList<Key> keyList : keys.values()) { keySet.addAll(keyList); } return keySet; }
657d0465-3cac-4f9b-8deb-9e6415dd489a
5
private void sendHeader(OutputStream out, long dataLength, int filetype) throws IOException { out.write("HTTP/1.0 200 OK".getBytes()); out.write(endofline); out.write("Content-Length: ".getBytes()); out.write(Long.toString(dataLength).getBytes()); out.write(endofline)...
c1564251-9e80-4e29-9664-43611fef3a05
0
private void init() { GameWorld temp = new SolarSystemLoc(ticker); locations.add(temp); }
13b62e4f-3442-4d37-8195-f908a76b3800
2
public void countStress(Boolean[] stresses) { // Add to observed stresses for(int i = 0; i < stresses.length; i++) { observedStresses[i] += stresses[i] ? 1 : 0; } observedStressCount++; }
e7cc256f-12a5-4949-bf48-151b849db63b
0
public void setB(float b) { this.b = b; }
4453dbe1-28f8-40c6-a1a2-82f580ae5403
8
public static void removeConnections(BeanInstance instance) { Vector instancesToRemoveFor = new Vector(); if (instance.getBean() instanceof MetaBean) { instancesToRemoveFor = ((MetaBean)instance.getBean()).getBeansInSubFlow(); } else { instancesToRemoveFor.add(instance); } ...
1fe71b76-192e-4d0b-8f6f-b5047d9defc1
3
private boolean isBlocked(float x, float y) { boolean blocked = false; float tweakedX = x + 4; float tweakedY = y + 8; beeBoundingRect.setLocation(tweakedX,tweakedY); for(int i = 0; i < map.length; i++){ if(beeBoundingRect.intersects(map[i])){ if(map[i].type !=...
a153fbc8-74b5-4800-9ab7-885c9fd8af8a
1
public static float getOppositeAngleRad(float angle) { if(angle - PI > 0) { return angle - PI; } else { return angle + PI; } }
ed1a4aa2-42cc-4908-89eb-ee01b04a699a
1
@Override public Object readItem() throws Exception { String string = null; try { string = reader.readLine(); } catch (IOException ex) { ex.printStackTrace(); } return string; }
eb7bf4f3-3400-4e6b-a4d4-7a913869932c
9
GrantEntry readGrantEntry( StreamTokenizer st ) throws IOException, InvalidFormatException { String signer = null, codebase = null; Collection<PrincipalEntry> principals = new ArrayList<PrincipalEntry>(); Collection<PermissionEntry> permissions = null; parsing...
12e52bb1-92e3-43fa-ae77-cb6d0faed6a5
3
public Mob nextEnemy(boolean pourVrai,long time) { if(cptMob>=listMobs.size()){System.out.println("NextEnemy-> Plus d'enemy");return null;} if(listMobs.get(cptMob).getSpawnTime()<=time) { Mob m = listMobs.get(cptMob); m.setMovable(true); if(pourVrai)cptMob...
bd66a332-747c-4f52-936a-608aa040027d
5
@Override public void keyPressed(KeyEvent e) { LOGGER.info("KeyEvent " + e.toString()); switch (e.getKeyCode()) { case KeyEvent.VK_RIGHT: cliente.teclado(CoreComando.DIREITA); break; case KeyEvent.VK_LEFT: cliente.teclado(CoreComando.ESQUERDA); break; case KeyEvent.VK_DOWN: cliente.teclado(Cor...
b4c9feee-3993-44ad-91a5-649259b9b452
0
public HexGrid(GUI g) { gui = g; worlds = new ArrayList(); brains = new ArrayList(); }
872d27d7-96c6-4bda-b268-84034376a2da
2
public long inserir(Local local) throws Exception { String sql = "INSERT INTO local(cidade, estado, descricao) VALUES (?, ?, ?)"; long idGerado = 0; try { PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); stmt.setString(1, local.getCidad...
3039f159-283a-4728-8d63-d252f17fb700
0
public void setFill(Color fill) { this.fill = fill; }
506b7bc4-8009-4dab-b305-44bbb7119c40
9
public String getNextComponent(Identifier ident) { if (isOr == AND) { for (int i = 0; i < matchers.length; i++) { String next = matchers[i].getNextComponent(ident); if (next != null && matchesSub(ident, next)) return next; } return null; } // OR case String next = null; for (int i = 0; i...
e2a64fc8-c3c3-49fa-91d4-e26617a2615c
0
@Override public void fatalError(SAXParseException e) { System.out.println("SAXParserException Fatal Error: " + e.getMessage()); this.errorOccurred = true; }
ff80be1c-446f-458a-aac6-053c514bf851
1
public void uimsg(String name, Object... args) { if(name == "log") { log.append((String)args[0]); } else { super.uimsg(name, args); } }
fb02d7fb-a7a9-4659-bdb8-1599fb5bf30c
5
private Value funcCall_rest() throws Exception { Identifier funcName = ident(); ArrayList<Value> args = new ArrayList<Value>(); do { if(scan.sym == Token.openparen) { scan.next(); if(scan.sym == Token.closeparen) { scan.next(); ...
3d3818d1-5f4b-45b6-877f-a1950c791591
9
static final private ArrayList<AbsValueNode> listArg() throws ParseException, CompilationException { Token t; ArrayList<AbsValueNode> result = new ArrayList<AbsValueNode>(); ArrayList<AbsValueNode> value = new ArrayList<AbsValueNode>(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NUMBER: t = ...
effc912b-d931-4c04-bec5-17d13e7aa672
5
protected void performDestroyCallback(){ if (parent == null){ return; } if (!parent.isVisible()){ return; } if (parent.gamestate.gameFinished){ return; //game is over } AIBundle bundle = null; try { bundle = workerThread.get(); } catch (InterruptedException e) { } catch( ExecutionExc...
1cf88c2a-a081-43f6-9272-3b0662212ae4
0
public ArrayRandomAccessor(T[] source) { this._source = source; }
9565b3ec-a30e-4914-ab83-eba5398335ae
5
public static boolean isHTML(String s) { if (isNull(s)) { return false; } if (((s.indexOf("<html>") != -1) || (s.indexOf("<HTML>") != -1)) && ((s.indexOf("</html>") != -1) || (s.indexOf("</HTML>") != -1))) { return true; } return false; }
bec7f8fd-0f66-47fa-9b6f-c1a6ac210138
2
public static String getExtension(File f) { String ext = null; String s = f.getName(); int i = s.lastIndexOf('.'); if (i > 0 && i < s.length() - 1) { ext = s.substring(i+1).toLowerCase(); } return ext; }
284bb517-16f3-46e3-82b8-f4733b0cb63a
2
@Override public void update(float delta) { if (!player.isAlive()) { setCurrentState(new GameOverState(playerScore / 100)); } playerScore += 1; if (playerScore % 500 == 0) { blockSpeed -= 10; } cloud.update(delta); cloud2.update(delta); Resources.runAnim.update(delta); player.update(delta); ...
d057d869-6670-4dac-8a4c-de28caf26ebd
9
@Override public GraphOperation next() { final byte opCode = this.opCodes.get(++opIndex); GraphOperation result = null; if (opCode == 2) { int arg0 = this.arguments.get(++argIndex); return GraphOperation.newCreateRemoveNodeOp(arg0); } else if (opCode >= 1 && opCode <= 6) { ...
17917df2-e4b6-43a9-83dd-db85472c57d1
2
public SurveyCompletionList getSurveyCompletions(String asSurveyId, String asRegId) { String lsParam = ""; if (UtilityMethods.isValidString(asSurveyId)) { lsParam += asSurveyId; } if (UtilityMethods.isValidString(asRegId)) { lsParam += "/" + asRegId; } ...
21633e15-4ecb-4694-a3e4-f76711208657
7
public static GeodeticCoord jauGc2gde ( double a, double f, double xyz[] ) throws JSOFAIllegalParameter { double aeps2, e2, e4t, ec2, ec, b, x, y, z, p2, absz, p, s0, pn, zc, c0, c02, c03, s02, s03, a02, a0, a03, d0, f0, b0, s1, cc, s12, cc2; double phi, ...
97c33a95-5732-476f-877a-7a2b2200d4a5
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; FieldMetadata other = (FieldMetadata) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)...
24dcde98-fad1-40e1-800c-464af743b558
1
@EventHandler(ignoreCancelled = true) public void onPlayerMove(PlayerMoveEvent e) { Dodgeball ab = mm.getPlayerMinigame(e.getPlayer().getName()); if(ab == null) { return; } ab.handlePlayerMove(e); }
f4cd679c-0b80-4302-adff-6867458afaee
8
protected void process() { if(consumer_lock.tryLock()) { try { while(true) { T element=queue.poll(); if(element != null && handler != null) { try { handler.handle(element); ...
83c8bbdf-0bd7-424d-9f43-2a589b8e016e
5
private static int getColor(ColorType c) { switch (c) { case PLAYER: return currentPlayerColor; case WALL: return currentWallColor; case SLOW_WALL: return currentSlowWallColor; case OBJECT: break; case PROJECTILE: break; default: break; } return 0; }
fa88160e-befc-4267-9c63-03216d6bd178
8
public static String encode(String message) { String hdb3stream = message; int index0; index0 = hdb3stream.indexOf("0000"); int index1 = 0; while (index0 != -1) { if ((index0 - index1) % 2 == 1) hdb3stream = hdb3stream.substring(0, index0) + "000V" + hdb3stream.substring(index0 + 4); else ...
0fc9b172-c118-4263-a5db-2d15b6d65cfc
2
@Override public String getProjectName() { if (displayedBugProject == null || isEmpty(displayedIssueLabel.getText())) { return null; } return displayedBugProject; }
be15f439-3707-404e-8508-929d1adf2b41
6
public String mirrored() { Stack<String> stack = new Stack<String>(); StringBuffer sBuff = new StringBuffer(); for (int i=0; i < SIZE1; i++){ if ((i+1)%(H1) == 0) { stack.push(sBuff.toString()); sBuff = new StringBuffer(); ...
4acfd850-c0ac-42e9-86d4-938e350bf7e0
4
@Override public void mouseReleased(MouseEvent mouseEvent) { start = false; if (fromList.isEmpty()) { return; } to = null; for (Planet planet : gameplay.planets) { double distance = Math.sqrt(Math.pow(mouseEvent.getX() - planet.getX(), 2) + ...
ea86ea31-2885-425b-aff1-b8b39dd9db46
9
private void comandoSe() { // <se> ::= β€œse” β€œ(β€œ<exp_logica> ”)” β€œ{β€œ <lista_comandos> β€œ}” <compl_se> // <compl_se> ::= <senao> | β€œ;” // <senao> ::= β€œsenao” β€œ{β€œ <lista_comandos> β€œ}” β€œ;” System.out.println("tΓ΄ no if"); if (!acabouListaTokens()) { nextToken(); if...
fbc88c39-3a4c-4d9b-8045-4ef2037f04f5
4
public int login(String name, String password) { if (!users.containsKey(name)) return -1; if (!users.get(name).getPassword().equals(password)) return -2; Trader t = users.get(name); if (active.contains(t)) return -3; active.add(t); t.openWindow(); if (!t.hasMessages()) t.receiveMessage("Welc...
8f359690-4b0a-4835-9525-c5a89f2651a5
2
public Text render(Text.Foundry f) { if((tcache == null) || (tcache.text != line)) tcache = f.render(line); return(tcache); }
63dc7b4f-6896-49a8-b54a-610f21e6901f
5
public int saveFile(String path, InputStream inputStream, long freeDiskSpace) throws NotEnoughFreeDiskSpaceException { int bytesCount = 0; final File file = new File(path); createFolder(file.getParent()); try { file.createNewFile(); } catch (IOException e) { ...
f06b04c2-f4cc-45c5-88fc-00268fd8534e
1
@SuppressWarnings("rawtypes") public static void quickSort(Comparable[] a, int min, int max){ if(max <= min) return; int j = partition(a, min, max); quickSort(a, min, j - 1); quickSort(a, j + 1, max); }
bb5cd675-3276-43d8-9a4b-60c7c2a8e608
5
static ArrayList<NoSchemaDocument> generateAddresses(int count) { ArrayList<NoSchemaDocument> addresses = new ArrayList<NoSchemaDocument>(); for (int i=0;i<count;i++) { NoSchemaDocument address = new NoSchemaDocument(); address.put("street","One Memorial Drive"); if (...
67f792c4-c43b-4c56-8bd1-2b7f17fd2c8f
7
public boolean tableExists(String tableName) throws Exception { if (!isConnected()) throw new IllegalStateException("Not connected, please connect first!"); if (m_Debug) { System.err.println("Checking if table " + tableName + " exists..."); } DatabaseMetaData dbmd = m_Connection.getMeta...
5d7a4706-e441-4995-aaf2-12d6048539db
3
public void drawSpeelveld(Graphics g) { Graphics2D mazeUI = (Graphics2D) g; mazeUI.setBackground(Color.WHITE); mazeUI.setColor(Color.GRAY); for (int i = 0; i < speelveld.length; i++) { for (int j = 0; j < speelveld[i].length; j++) { if (speelveld[i][j] == Vel...
5e885fd8-e9cb-45b5-b308-8658865703bb
8
private static boolean intersectsLineStrictInternal(Line2D.Double l1, Line2D.Double l2) { if (l1.intersectsLine(l2) == false) { return false; } assert l1.intersectsLine(l2); Point2D.Double l1a = (Point2D.Double) l1.getP1(); Point2D.Double l1b = (Point2D.Double) l1.getP2(); Point2D.Double l2a = (Point2D....
cb24e5dc-1654-4f5d-a2bd-9cf4f28dc8ef
3
private void isCorrect() { File file = new File(dataBaseDirectory); if (file.isFile()) { throw new MultiDataBaseException(dataBaseDirectory + " isn't directory!"); } String[] dirs = file.list(); checkNames(dirs, "dir"); for (int i = 0; i < dirs.length; ++i) {...
26370d8a-0bde-4121-b603-79738029b4ef
9
private synchronized void moveEnts() { float time = 1.0f; //apply constant forces do { float tMin = time; for (int i = 0; i < main.living.size(); i++) { Ball s = main.living.get(i); for (int y = 0;y < main.lines.size();y++) { ObstacleLine l = main...
f6809c4b-937a-4288-9a0a-9f7f3885cdcc
0
public void setServiceID(String serviceID) { ServiceID = serviceID; }
142ec174-ca6c-4c59-8c79-f1bc582ac47e
6
@Override public void run() { if (Updater.this.url != null) { // Obtain the results of the project's file feed if (Updater.this.read()) { if (Updater.this.versionCheck(Updater.this.versionName)) { if ((Updater.this.versionLi...
7f3019d5-e96e-42b3-b8b3-6658c6e7cadb
9
static final boolean method3649(boolean bool, int i, int i_2_, int i_3_) { anInt4010++; if (!Class12.aBoolean194 || !Mobile_Sub1.aBoolean10959) { return false; } if (Class233.anInt2786 < 100) { return false; } if (bool != true) { method3649(true, 77, 66, -67); } int i_4_ = Class240.anIntArrayAr...
f143b13d-31ad-49bf-aa37-a996efc685b4
6
private void addLinkStatement(StatementPrototype sp, ObjectStack propertyStack, Class<?> propertyClass) { Node objRep = propertyStack.getNode(propertyClass); for(ObjectRepresentation rep:propertyStack.getAllRepresentations()) { if(!rep.equals(objRep.getRepresentation()) && ObjectTools.isA(rep.getReprese...
cc6a000d-cfa7-468d-87d9-4a65d02d717e
0
public String getComments() { return comments; }
b9207e2e-f055-4154-8ef5-ee918a61f993
5
public static boolean getCommand() { boolean sentinel = true; Request r; // Should pass try { r = new Request(JSON_TO_PARSE_1); } catch(NullJsonException nj) { return false; } catch(JsonCommandNotFoundException jc) { return false; } String json = r.getCommand(); if(!assertEquals...
efb036dc-07d5-4b59-b8d3-5316191d2667
4
public static boolean dragItem(final Item i, final int slot) { return i != null && (SlotData.getItemId(slot) == i.getId() || MainTabs.INVENTORY.open() && dragChild(i.getWidgetChild(), slot) && new TimedCondition(700) { @Override public boolean isDone() { return i.getId() == SlotData.g...
01859698-c3c7-471f-9364-596fee0a47da
1
public void Imprimir(){ NodosListaProceso aux = PrimerNodo; System.out.println("Nombre del proceso\n__\t__________________\n"); while (aux!=null) { System.out.println(aux.nombreProceso+" "); aux = aux.siguiente; } }
f1ef3265-646d-4b16-895f-a91aadcb4172
4
public String getCardSuit(Card card) { String suit = null; if ("DIAMOND".equals(card.getSuit().toString())) { suit = "d"; } else if ("CLUB".equals(card.getSuit().toString())) { suit = "c"; } else if ("HEART".equals(card...
391cec58-4dfd-452e-9d6d-6d2c917c07e9
1
public void writeTable() { TranslationTable table = new TranslationTable(); basePackage.writeTable(table, false); try { OutputStream out = new FileOutputStream(outTableFile); table.store(out); out.close(); } catch (java.io.IOException ex) { GlobalOptions.err.println("Can't write rename table " ...
ecdb182c-3bf4-4cb2-bea9-9d8cfdcacf0c
0
public Map<String, Object> getProperties() { return properties; }
b205450a-cb0a-4eb8-987e-f1882938ffbe
2
@Override public boolean equals(Object other) { if (other == null) return false; if (other == this) return true; Movie otherMovie = (Movie) other; return this.name.equals(otherMovie.name); }
eda9e8ef-5346-4f78-9704-7a78c8a4ce62
7
public static void keepDirWithinSize(File dir, int size) { if (!dir.isDirectory()) return; File[] files = dir.listFiles(); if (files == null) return; long dirSize = countDirSize(dir); if (dirSize < size) return; Arrays.sort(files, new FileDateComparator()); int...