method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c136fae7-60b4-4458-b7d9-8485eccd6237
4
public void testDajZaposlenika(){ Zaposlenik zaposlenik = new Zaposlenik(); Osoba osoba = new Osoba(); osoba.setImePrezime("TestZaposl TestDaj"); osoba.setAdresa("adr"); osoba.setDatumRodjenja(new Date()); zaposlenik.setOsoba(osoba); zaposlenik.setDrzavljanstvo("BiH"); zaposlenik.setEmail("z...
c70352a4-b17a-4df4-b218-39ceea5ee98f
5
public ArrayList<String> localeInventoryDataFetch(String dataName){ ArrayList<String> dataList = new ArrayList<String>(); for(int x = 0; x < Main.localeInventory.length; x++){ for(int y = 0; y < Main.localeInventory[x].length; y++){ for(int z = 0; z < Main.localeInventory[x][y].length; z++){ if(Main.loc...
3d75bdf7-6b84-441b-b742-0ae06b19b51c
2
public void cargarDirecciones(){ try { String sql = "SELECT * FROM direccion WHERE Clientes_idClientes = ?"; Connection conn = Conexion.GetConnection(); conn.setAutoCommit(false); PreparedStatement ps = conn.prepareStatement(sql); ...
3d19392e-20f2-4bdd-964b-9a7875df39a1
8
public static BFToken getToken(char c) { switch (c) { case '>': return NEXT; case '<': return PREVIOUS; case '+': return PLUS; case '-': return MINUS; case '.': return OUTPUT; case ',': return INPUT; case '[': return BRACKET_LEFT; case ']': return BRACKET_RIGHT; default: r...
c7c5b910-8225-4285-b953-0eb982785bc1
1
public int getTag(int i) throws ClassFormatException { if (i == 0) throw new ClassFormatException("null tag"); return tags[i]; }
38d39729-8914-4148-a21a-4e027f3f0537
9
private int[][] right() {//all numbers will right and combine when possible int[][] egrid = clone2DArray(grid); for (int yIndex = 0; yIndex < 4; yIndex++) { for (int xIndex = 0; xIndex < 3; xIndex++) { if (egrid[yIndex][xIndex + 1] == 0) { for (int a = xIn...
c62c8d86-628b-4460-b0e9-cb991f4313d2
9
public Brain.Move bestMove(Board board, Piece piece, int limitHeight, Brain.Move move) { // Allocate a move object if necessary if (move==null) move = new Brain.Move(); double bestScore = 1e20; int bestX = 0; int bestY = 0; Piece bestPiece = null; Piece c...
fabbcb63-e2de-4c77-b663-9f3d2f645d6c
0
public void testGoodAnswer() { GameMaster master = new GameMaster(generateTargetCombination()); Combination<Colors> attempt = generateAttemptCombination1(); assertEquals(5, master.answer(attempt).getBlackCount()); assertEquals(0, master.answer(attempt).getWhiteCount()); assertEquals(true, maste...
2885ffb0-fd9c-43d1-a45f-d6b40b6b6ad8
5
private static void updatePoss(List<List<List<Integer>>> poss, Board b) { poss.clear(); for (int x = 0; x < 9; x++) { List<List<Integer>> list = new ArrayList<List<Integer>>(); for (int y = 0; y < 9; y++) { List<Integer> list1 = new ArrayList<Integer>(); if (b.get(x, y) != 0) { list1.add(b.get(x,...
9172d4ec-5429-4135-b79f-8b2337ac4abe
7
public static void main(String[] args) { theApp=new Rivet(); SwingUtilities.invokeLater(new Runnable(){public void run(){theApp.createGUI();}}); // Get data from the sound card thread try { // Connected a piped input stream to the piped output stream in the thread theApp.inPipe=new PipedInputStream(theApp...
5d5af90b-40c4-4c24-8f78-01b50fa1aecd
0
public NodePlacer getNodePlacer() { return nodePlacer; }
ea51ae91-d846-4bc1-bd57-342d44f71e25
1
@Override public Object clone() { try { return super.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); // impossible } }
41c79c76-faea-400a-8dcc-49e0391561de
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 fe...
56659a26-dd66-41f0-9cd1-0460c2be4e53
3
public void addPatient(Patient newPatient) { if (head == null) { head = newPatient; return; } Patient aux = head; while (aux.getNext() != null && aux.getNext() != head) { aux = aux.getNext(); } aux.setNext(newPatient); newPatient.setNext(head); }
20893b94-02c1-4f9c-a756-1daff4fc1fe2
7
public void setInstances(Instances inst) { m_Instances = inst; m_ignoreKeyModel.removeAllElements(); String [] attribNames = new String [m_Instances.numAttributes()]; for (int i = 0; i < m_Instances.numAttributes(); i++) { String name = m_Instances.attribute(i).name(); m_ignoreKeyM...
2a85431d-3411-4daf-8fd0-c12165d17691
7
@Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (index1 != null ? index1.hashCode() : 0); result = 31 * result + (index2 != null ? index2.hashCode() : 0); result = 31 * result + (index3 != null ? index3.hashCode() : 0); re...
99440cc1-280b-4fbb-b4ba-4eeb35b5ac83
2
public void park(Car car){ if(rulesManager.isFull()){ System.out.println("Hello Chandan the parking lot is full. You wait until a car exits"); return; } Integer parkingLotNumber = rulesManager.getNearestParkingLot(); ParkingLot parkingLot = new ParkingLot(parkingLotNum...
c605b415-cbaa-4a14-beae-53d2c2c03f63
6
private void loadFile(){ BufferedInputStream bis; try { bis = new BufferedInputStream(new FileInputStream(file)); byte[] data; for(int i : this.pieces.keySet()){ Piece p = pieces.get(i); int offset = 0 - Piece.MAX_BLOCK_LENGTH; data = new byte[p.getLength()]; bis.read(data); //Sy...
88300663-b908-4d44-bcf5-6a6e18f9ed22
5
public int[] getContrast(float factor) { int[] contarr = new int[256]; float slope = factor * 25; if (slope < 1) slope = 1; if (factor < 0) slope = 1 + factor; for (int i = 0; i < 256; i++) { contarr[i] = (int) ((i - 128) * slope + 128); if (contarr[i] < 0) contarr[i] = 0; else if (contarr...
e404a895-2cdd-4261-abdb-39ea7e3c49bf
5
static void bubbleSort(Poker[] pokers){ int len = pokers.length; for (int i = 0; i < len ;i++){ for (int j = i; j < len-1; j++){ if (pokers[j] != null && pokers[j+1] != null && pokers[j].compareTo(pokers[j+1]) == 1){ Poker temp = pokers[j]; ...
61139b22-9912-4f15-b957-b88e79df8945
0
public ARSCFileParser() { }
d75300dd-9046-4ca9-b051-9cbc5103eba9
5
public void dragNDropZoom(double xStartCoord, double yStartCoord, double xEndCoord, double yEndCoord) { final double mapXStartCoord = Math.min(convertMouseXToMap(xStartCoord),convertMouseXToMap(xEndCoord)); final double mapYStartCoord = Math.min(convertMouseYToMap(yStartCoord),convertMouseYToMap(yEndCoord)); fin...
afaafd21-d06b-445f-ad57-d1c41291d821
7
public void update(){ super.update(); if(health <= 0){ World.current.addPlayer(new Player(new Vector2(256 + 8, 256 + 8), null, Main.playerTextures)); World.current.removePlayer(this); MainMenu.open = true; for(Mob e : World.current.mobs){ Enemy en = (Enemy) e; en.clearTarget(); } } ...
aad12827-3404-4588-b38c-2e66cd527924
5
public static void init() { try { SoundSystemConfig.setCodec("ogg",CodecJOgg.class); } catch(SoundSystemException e) { Log.error("Unable to register JOgg codec. .ogg sounds will not work on this machine!"); } try { SoundSystemConfig.setCodec("wav",CodecWav.class); } catch(SoundSystemException e) { Log.er...
3537bb79-0bbc-4382-a173-7dec93e48f04
8
public void handleChangeRequest(int requestValue, int numHalfDollar) { myNumHalfDollar = Math.min(numHalfDollar, MAX_NUM_HALF_DOLLAR); initializeDpState(); DpState bestState = new DpState(); int bestNumCoins = 0; int totalValue = requestValue; int bestNumHalfDollar = 0; double bestMassValue = Double.MAX_V...
8e63d0e4-744f-412c-8f2b-49855e24a3b4
5
public int setShape(Point p, Shape s) { int[] rowsAffected = new int[s.getHeight()]; for (int row = 0; row < s.getWidth(); row++) { for (int col = 0; col < s.getHeight(); col++) { if (s.checkSlot(row, col)) { setSlot(p.y + row, p.x + col, s.getType()); rowsAffected[row] = p.y + row; } } } ...
00ae1073-4b65-47a5-ba99-003d477b9c8e
0
public void setLocation (String l) { location = l; }
82c58c67-ff80-44ca-98fd-79cd6769e6bc
0
public IMessageDao getIMessageDao() { return messageDao; }
8baa0602-6e7c-4c81-a782-53895b2307e6
1
public void agregarCalificacion(Jugador calificador, Partido partido, String comentario, int nota){ if(!partido.getEquiposConfirmados()) throw new EquiposConfirmadosException("El admin no confirmo los equipos, por lo tanto, el partido no se jugo y no se pueden hacer evaluaciones"); Calificacion calificacion= new...
696873d1-1b41-4584-83c7-4d1d5967b6cd
8
private String assemblaMappaGenerale(String mioBuffer, String token) throws InvalidTokenException { Iterator<Cella> itCelle = myLogica.getMappa().iterator(); int i = 0; Cella tempCella = null; Character tipoCella = null; while (itCelle.hasNext()) { do { tempCella = itCelle.next(); tipoCella = null;...
b39b78f1-741f-47c3-8e7c-f8d962e5f4ee
6
private String defaultValue() { String val = ""; switch (this.keyType) { case BOOLEAN: { val = "false"; break; } case DOUBLE: { val = "0"; break; } case FLOAT: { val = "0"; break; } case INT: { val = "0"; break; } case LONG: { val = "0...
f20130e3-ee28-4812-b0bc-80735d7324da
5
private long toMillis() { switch (type) { case SECONDS: return value * 1000; case MINUTES: return value * 60000; case HOURS: return value * 3600 * 1000; case DAYS: return value * 24 * 3600 * 1000; ...
8c5b0104-55e4-4f53-b40b-9b9ffa64b494
3
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D)g; g2d.drawImage(craft.getImage(), craft.getX(), craft.getY(), this); ArrayList b = craft.getBullets(); for (int i = 0; i < b.size(); i++ ) { PlayerBullet m = (PlayerBullet) b.get(i...
334cc8bf-e414-48ce-9425-ce660d0e766d
8
private void processSecondaryOrders(RdpPacket_Localised data, Options option) throws OrderException, RdesktopException { int length = 0; int type = 0; int flags = 0; int next_order = 0; length = data.getLittleEndian16(); flags = data.getLittleEndian16(); type = data.get8(); next_order = data.getPos...
03139a34-f846-4385-944c-a936f483788d
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...
744318c1-a953-41b6-bb5d-0b71ca4de70a
7
public static void runExperiments(int cases, int timesToLoop, boolean cycle, int[] args){ long startTime; long endTime; Random rng = new Random(); int rand1; int rand2; String start; String end; for(int size = args[0]; size <= args[1] ; size += args[2]){ GraphUtil.generateGraphInDotFile("timing1.dot...
8f08c08f-fd6e-4872-983e-be2f2de5414b
5
public boolean collidesWithTanks(java.util.List<Tank> tanks) { for(int i=0; i<tanks.size(); i++) { Tank t = tanks.get(i); if(this != t) { if(this.live && t.isLive() && this.getRect().intersects(t.getRect())) { this.stay(); t.stay(); return true; } } } return false; }
7752d087-9f37-4cb3-9fc3-6029654bfb28
9
public static void incluirItem(Pedido pedido) { String item; String itens = ""; Scanner sc = new Scanner(System.in); System.out.println("Itens para o evento " + pedido.descricao); System.out.println("1 - Projetor"); System.out.println("2 - Computador"); System.out...
fdc8ee36-3622-40bf-8b42-7ff51bc0a5af
5
public static void escape() { switch(Main.Screen) { case "start1": Main.Screen = "start2"; break; case "start2": Main.Screen = "start3"; Main.menu = new Menu(); Main.main.requestFocus(); break; case "start3": Main.Screen = "menu"; Main.modeSelection = new ModeSelector(); break; ...
66819503-4a21-4417-939f-428e647fbf42
3
public boolean detachNext(Linkable paramLinkable) { boolean b = false; if ((paramLinkable instanceof InstructionList)) { InstructionList localInstructionList = (InstructionList)paramLinkable; if ((localInstructionList.getPreviousInstruction() == this) && (this.next == localInstructionList)) ...
4dd837cd-4b6f-4e2e-9bd2-45797c510b81
3
public static void read(String path, Level lvl) { try { //loading background.png byte[] data = ZipReader.load(path,"background.png"); lvl.setBackground(ImageIO.read(new ByteArrayInputStream(data))); } catch (Exception e) { System.out.println("file not found : background"); } try { /...
204495e2-7d37-468f-b7bd-bb129ec5d232
1
public Object getWork() throws Exception { if (getException() != null) { throw getException(); } return super.get(); }
5924fffa-4e00-46dc-bb92-9c478c0e2fd0
6
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); float var7 = 1.0F; float var8 = 1.0F; float var9 = 1.0F; float var10 = 0.0F; float var11 = 0.0F; ...
f64ad699-9249-4391-aa29-b11d41b2f88b
9
public static boolean searchMatrix(int[][] matrix, int target) { if (matrix.length == 0) { return false; } int left = 0; int right = matrix.length - 1; int median = 0; while (right >= left) { median = (right - left) / 2 + left; if (target == matrix[median][0]) { return true; } else if (targ...
a25b1b47-d6e8-4460-ac0b-10c8678cefc6
9
static final void method3538(boolean bool, String string) { anInt7291++; if (string != null) { if (string.startsWith("*")) string = string.substring(1); String string_8_ = Class285_Sub1.unformatUsername(string); if (string_8_ != null) { if (bool != true) method3536(9, 65, -72, 107, null); f...
674b0d43-ff0a-40c4-8cba-1b45fe5057a2
2
private static void readCoordFile(String coordFileName) { EasyReader inFile = new EasyReader(coordFileName); if (inFile.bad()) { JOptionPane.showMessageDialog(null, coordFileName + "not found"); } else { String firstline = inFile.readLine(); // toss the column headings while (!inFile.eof()) { Inte...
1c714e0f-ec25-4a45-bb12-7e51238d66cf
0
public void setManufacturer_part_id(String manufacturer_part_id) { this.manufacturer_part_id = manufacturer_part_id; setDirty(); }
863177e7-8ede-4da7-94ba-bc00559a83c6
6
public void move() { if (this.getLeft() <= 0 && moveInt == 1) { this.setMoveInt(0); x = 1; } else if (this.getRight() >= 500 && moveInt == 2) { this.setMoveInt(0); x = 499 - width; } if (this.getMoveInt() == 1) { this.x -= speed...
21dd1ba1-0d70-4283-9f3a-dbddf7b75d42
6
public void mouseClicked(MouseEvent e) { if (game.isGameIsOver()) return; if (game.getGameMode() == 1) { handleMPClick(e); return; } else { if (game.getTurn() == 1) {//if human turn handleSPHumanClick...
b734306c-c354-4ff0-ad2d-813e85485e85
0
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Transform") public JAXBElement<TransformType> createTransform(TransformType value) { return new JAXBElement<TransformType>(_Transform_QNAME, TransformType.class, null, value); }
97774af7-3bfa-4126-88ac-b8d2daf439d2
0
public final float getZ(){ return getLocalTranslation().getZ(); }
31f5b3d8-5cda-4623-9ff5-980d6fe87a0c
8
public int alphabeta_min(int currentDepth, int alpha, int beta) { if (!cont) return 0; if (currentDepth >= depth || board.legalMoves.isEmpty()) { if (currentDepth==0 && board.winStatus != 2) { return Integer.MAX_VALUE; } int eval = -1*board.eval(weights); evals++; return e...
3921172d-3416-49e0-b000-d6554058a423
0
@XmlElementDecl(namespace = "http://www.rsasecurity.com/rsalabs/pkcs/schemas/pkcs-5v2-0#", name = "PBES2-params") public JAXBElement<PBES2ParameterType> createPBES2Params(PBES2ParameterType value) { return new JAXBElement<PBES2ParameterType>(_PBES2Params_QNAME, PBES2ParameterType.class, null, value); }
96375d24-9e5b-40da-b1b4-e73b1b3b944e
1
private void ReInitRounds() { int i; jjround = 0x80000001; for (i = 1311; i-- > 0;) jjrounds[i] = 0x80000000; }
ff38ec39-5afb-4cee-b6c5-9dee38dec8c4
4
public GUI() { this.setTitle("Angry Tanks"); //Titel instellen muziek = new Muziek(); //Muziek aanmaken //Spel aanmaken try{ spel = new Spel(); } catch(AngryTanksException e){ toonError(e); } //Nimbus L&F instellen for (UIManager...
0b609c2d-8d74-4612-8a1d-4e014ba3f665
3
public Value get(Key key) { Node temp = root; while (temp != null) { int cmp = key.compareTo(temp.key); if (cmp < 0) temp = temp.left; else if (cmp > 0) temp = temp.right; else return temp.value; } ...
1f51c0bd-75ba-45d3-b7dd-70da8930c2b0
1
public List<String> generateLetters(){ List<String> letters = new ArrayList<String>(); for (Dice<String> die : shuffleDice()) { letters.add(die.roll()); } return letters; }
0c92eb02-9189-4f06-a29a-0c7aa8706b57
9
private static void shortestPath(Edge[] edges, int n) { // previous node of our shortest path int[] predecessor = new int[n]; // sum of c along the shortest path int[] distance = new int[n]; // initialisation for (int i = 0; i < n; i++) { predecessor[i] = -1; distance[i] = Integer.MAX_VALUE; } /...
b1b15cb5-b730-4708-a3b3-70f7350626eb
3
public static JSONObject getUserJson(String jsonString) { JSONObject userJsonObject = null; if (jsonString != null && !jsonString.equals("")) { try { JSONArray json = new JSONArray(jsonString); userJsonObject = (JSONObject) json.get(0); } catch (JSONException e) { // e.printStackTrace(); }...
e3ed19da-5a05-4ade-84e8-069bfc1cd90c
5
public void removeTurma(String codigoDisciplina, int numTurma) throws DisciplinaInexistenteException { boolean teste = false; for (Disciplina e : this.disciplina) { if (e.getCodigo().equals(codigoDisciplina)) { for (Turma t : e.getTurmas()) { if (t.getNumero() == numTurma) { e.getTurmas().remo...
2d4644e9-69bd-42c2-944c-8f883d3a8e71
4
public void sendAddUser() throws IOException{ String str = new String("adduser"+ "," + newUsernameFld.getText()+ ","+ newJobFld.getText() + "," + newPasswordFld.getText()); System.out.println(str); InetAddress serverAddr= null; try { serverAddr= InetAddress.getByName(GlobalV.serverIP); } catch...
d22c6864-951e-4ccd-bfac-e1d0e399d325
2
public int getTotalWeight() { if (!items.isEmpty()) { int total = 0; Set<String> keys = items.keySet(); for (String key : keys) { total += this.items.get(key).getWeight(); } return total; } else { return 0; } }
7a1f7220-430c-45d5-bd26-e08d46fcfb97
8
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); while(t-->0){ String s = br.readLine(); ArrayList<Integer> list = new ArrayList<Integer>(); ...
2db2d653-87b3-4fd7-a83d-3b5df3e475d7
9
public void checkArmor(Player player) { // Checks if player is wearing restricted items PlayerInventory inv = player.getInventory(); // We do not have to check on this world. if (plugin.getAPI().isDisabledWorld(player.getLocation().getWorld().getName())) { return; } // Ignore creative? if (plugin.get...
d822d7a4-f6d0-4fcd-a740-cf5b16e53ad1
0
@Override public void mouseDragged(MouseEvent e) { }
49832ce0-92f1-40e8-a698-8855fa333f71
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Graphics other = (Graphics) obj; if (height != other.height) return false; if (id != other.id) return false; if (rotation != other.rota...
3eea17a8-6183-423f-a29e-373170e28e2b
2
public SignatureVisitor visitInterface() { separator = seenInterface ? ", " : isInterface ? " extends " : " implements "; seenInterface = true; startType(); return this; }
d2c22978-58d0-49c7-b5f7-2b1f5e5076b8
5
private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; ...
28529c01-54d8-4525-b445-74e5f7860f6f
0
@Test public void testGetFoodNum() { System.out.println("getFoodCells"); World instance = new World(); instance.generateRandomContestWorld(); int expResult = 0; int result = instance.getFoodNum(); assertEquals(expResult, result); }
5c38c5c2-69f5-4d39-b277-0ca50ec3ebe6
0
@org.junit.Test public void testName() throws Exception { String [] actual = Sorter.loadAndSort(new StringReader("b\na\nc")); String [] exepected = {"a", "b", "c"}; assertArrayEquals(exepected, actual); new Person2("Nik", 28); }
342f1803-5f1b-4fa0-b897-ca2e0db201c0
8
public void addCell(Cell cell) { if (strategy == TableStrategy.DRAW_NONE) { return; } if (strategy == TableStrategy.DRAW_OUTSIDE) { return; } if (strategy == TableStrategy.DRAW_HORIZONTAL || strategy == TableStrategy.DRAW_ALL) { // Hlines for (int c = cell.getMinCol(); c <= cell.getMaxCol(); c++...
525c2670-6cd3-4b00-9644-13299b3c555b
6
private boolean colonyCouldProduce(GoodsType goodsType) { if (goodsType.isBreedable()) { return colony.getGoodsCount(goodsType) >= goodsType.getBreedingNumber(); } if (goodsType.isFarmed()) { for (ColonyTile colonyTile : colony.getColonyTiles()) { ...
57388cb4-029b-470f-989f-de0c26359992
9
public int getWidth (String text) { if (text == null) throw new IllegalArgumentException("text cannot be null."); if (text.length() == 0) return 0; if (displayListCaching) { DisplayList displayList = (DisplayList)displayLists.get(text); if (displayList != null) return displayList.width; } char[] chars...
6158a410-7406-466f-8808-14e8ca627454
4
private void tarkistaVastauksetNappiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tarkistaVastauksetNappiActionPerformed try { if (this.kone.getAktiivinenHarjoitus() != null) { for (int i = 0; i < tehtavaLkm; i++) { this.kone.getAktiivinenHarj...
4c3ea22f-b0fc-4a35-9462-4f8e44989e74
4
private boolean isSelected(int x, int y) { if (y > this.y && y < this.y + height) if (x > this.x && x < this.x + width) return true; return false; }
4bf2df5f-442e-4009-becc-38b01a2f5959
9
@Override protected List<FrameworkMethod> getChildren() { final List<FrameworkMethod> children = super.getChildren(); final Iterator<FrameworkMethod> iterator = children.iterator(); while (iterator.hasNext()) { final FrameworkMethod child = iterator.next(); final Category category = child.getAnnotation(Cat...
1e5438dc-4acd-433e-8fb5-8ba820054f23
9
public String theWinner(int[] cards){ int max = 1<<9; boolean[][] existing = new boolean[max][2]; boolean[][] reachable = new boolean[max][2]; existing[0][0] = reachable[0][0] = true; for(int card : cards){ boolean[][] tmpE = new boolean[max][2]; boolean[]...
6a23dbb6-773d-4e69-a85b-25b4a4735b6a
1
public Boolean update(String query) { /* *TODO Update and execute must be written in Curl! Update must ask if autoCommit */ try { Statement stm = this.con.createStatement(); stm.executeUpdate(query); stm.close(); return true; } catch (SQLException e) { LogHandler.writeStackTrace(log, e, Leve...
25341da7-f386-4b34-a00c-3e4a76b4fa95
1
public static Image loadImage(String path) { URL url = Utilities.class.getClassLoader().getResource(path); Image image = null; try { image = ImageIO.read(url); } catch (IOException e) { System.out.println("Error occurred while loadi...
f0cb185b-f6fb-42c1-aab1-a562e2b4bb2b
0
protected void displayMultipleRunPane(Environment env){ MultipleOutputSimulateAction act = new MultipleOutputSimulateAction((Automaton)myObjects.get(0),env); act.performAction(env); env.getTag(env.getActive()); }
7ef20ca6-3991-4d51-8600-cbc1cca38a31
2
private void handleHTSMsg(HTSMsg msg){ String method = (String) msg.get("method"); if (msg.get("seq") != null) { handleReply(msg, (Long) msg.get("seq")); } else if (method == null){ System.out.println("no seq, no method. Something is wrong. Forgot to send seq?"); } else{ handleServerToClientMethod...
713f31ae-4e34-4be3-9d0f-35f3ce17e747
8
protected boolean setStartDirection() { if (downIsFree && !rightIsFree) { // DOWN free moveDirection = DOWN; checkDirection = RIGHT; } else if (rightIsFree && !upIsFree) { // RIGHT free moveDirection = RIGHT; checkDirection = UP; } ...
d59f656c-bf15-4737-a74a-a4a2b91d7dd6
3
private void assertAscendingDoubles(ReadResponse resp, String field) { Double prev = Double.MIN_VALUE; for (Map<?, ?> rec : resp.getData()) { Double d = (Double) rec.get(field); assertTrue(d >= prev); prev = d; } }
dda7a0e0-5381-46d8-b86c-9a016741b747
8
public BookingWindow(MainWindow mainWindow, Student stu) throws ParseException, InstanceNotFoundException { sdf = new SimpleDateFormat(DATE_FORMAT); this.student = stu; setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 657, 454); contentPane = new JPanel(); contentPane.setBorder(new ...
9dd168ab-be24-48f8-83d9-ccd32758b3fb
5
public static void main(String[] args) { try { boolean force = args.length > 0 && args[0].equals("--force"); Log.init(); Updater updater = new Updater(); UpdatableObject clinicClient = new ClinicClient(); UpdatableObject clientUpdater = new ClientUpda...
a874bb5c-0723-466a-8db3-f751bc7de1ad
0
public int height() { return buffer.length(); }
73064cd6-05ef-499a-8648-04e162f95a82
3
public Polygon getMultipolygon() { final GeometryFactory gf = Helper.getGeometryFactory(); CoordinateSequence shellSequence = gf.getCoordinateSequenceFactory().create(shellCoordinates.toArray(new Coordinate[0])); LinearRing shell = new LinearRing(shellSequence, gf); LinearRing[] holes = new LinearRing[this.hole...
8acd5141-e8d1-48b8-82be-d4dde32be65c
7
private boolean checkCounterParties(int[] rows) { // Step 1: check if each movement has a counterparty // ok, because transactioncode is used // TODO: not use transactioncodes as counterparty, // but as the user for input. JOptionPane.showMessageDialog(this, "TODO: link transactioncode + extra data to counter...
87917b92-5542-4d9c-9a98-df81b13ce6c1
5
private static Map<String, String> convertAttachment(TpURL tpUrl, String[] keys) { if (keys == null || keys.length == 0) { return null; } Map<String, String> attachment = new HashMap<String, String>(); for (String key : keys) { String value = tpUrl.readParam(key); if (value != null && value.length() > ...
e86d308b-05b3-4efa-a444-a8f1fd9cbfda
8
@SuppressWarnings("unchecked") public Object guard(Object aArg, IContext aCtx) throws TypeSpecException { if(!(aArg instanceof List)) throw new TypeSpecException(TypeUtil.msgExpectedOther(getSpecName(), aArg)); final List lListArg = (List) aArg; if(min >= 0 && lListArg.s...
a01cb675-63c8-42b2-905d-10ac56e33090
1
public static void download(String urlString, String destFile) throws Exception { URL url = new URL(urlString); BufferedInputStream in = new BufferedInputStream(url.openStream()); BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(destFile)); byte buffer[] = new byte[BUFFER_SIZE]; int b...
d561cd84-9a0d-4b1c-8b9d-c652619fdf39
5
public void setNetworkStatus(NetworkStatus networkState) { switch ( networkState ) { case CONNECTED: this.status.setText("Now connected"); break; case WAITING_CONNECTION: this.status.setText("Waiting for connection"); br...
1a609d3a-03f9-45bd-9816-66c0537f8057
5
public static void createProfessor() { System.out.println("=== Creation of a professor ==="); System.out.print("Give a name: "); String name = ""; while (name.equals("")) { Scanner scName = new Scanner(System.in); name = scName.nextLine(); } System.out.print("Give a first name: "); String forename =...
3c4fef84-693f-4334-9ba1-e76e471f79c2
0
public double[] getTime(){ return time; }
3c21e1a8-48db-46e1-9488-f331f1d41e8c
4
public boolean intersectsDrawable(Drawable drawable) { boolean condition1 = getX() > drawable.getX() + drawable.getWidth(); boolean condition2 = getX() + getWidth() < drawable.getX(); boolean condition3 = getY() > drawable.getY() + drawable.getHeight(); boolean condition4 = getY() + get...
f624829f-8152-4e36-9913-a55cef2e1d6a
9
public void submitClientQuery(MiniServer player, String query) { String move = UNENTERED_MOVE; boolean clientRecognized = false; if(query.toLowerCase().startsWith("/move") && isInList(player) ) { try { move = query.split(" ")[1]; } catch (Exception e) { move = UNENTERED_MOVE; } } else {...
2e67bf0c-48df-46e3-859c-7b34508f38fe
8
public void compExecTime() { double newExeTime; double newCost; dEval = 0; dTime = 0; dCost = 0; for (int i = 0; i < iClass; i++) { newExeTime = 0; // System.out.print("Cost[" + i + "]"); for (int j = 0; j < iSite; j++) { if (dmAlloc[i][j] != -1) { if (dmAlloc[i][j] < 1) { newExeTime...
f4a7221b-6e37-4d00-b044-fdd460632174
8
public void writeExtData(int type, byte[] data) throws IOException { if (data == null) { writeNil(); } else { int length = data.length; if (length == 1) { // fixext 1 stores an integer and a byte array whose length is 1 // byte // +------+------+------+ // | 0xd4 | type | data | // +---...
0847b13f-506c-41b8-99bc-e0f389596f20
1
public void collide(SolidObject other) { setDestroyed(true); if (!other.isDestroyed()) { other.collide(this); } }
0b9e4a69-3319-465c-adff-c45cf7053526
4
**/ public void mostrarProducto(beansProducto producto){ mostrarDatos(producto); String tab = getLines(1); if(producto.getListaDeOfertas().size() >= 0){ for(beansOferta oferta : producto.getListaDeOfertas()){ int[] fecha = getFechas(oferta); if(fecha[0] <= fecha[1] && fecha[1] <= fecha[2]){ System...