method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e585a14e-4598-490c-90b0-c32e2f2dc18b
0
@Test public void testGetSaldo() { System.out.println("getSaldo"); Cuenta instance = new Cuenta(); float expResult = 0.0F; float result = instance.getSaldo(); assertEquals(expResult, result, 0.0); // TODO review the generated test code and remove the default call to f...
30e65095-7fb1-412a-9e38-55ddf6fecafe
8
private void checkKeyboardInput(Input input,GameContainer gc) { if(input.isKeyPressed(Keyboard.KEY_1)){ drawInventorySelector2X = (gc.getWidth()/2 - OutventoryWidth/2); drawInventorySelector2 = true; } if(input.isKeyPressed(Keyboard.KEY_2)){ drawInventorySelector2X = (gc.getWidth()/2 - OutventoryWidth/...
42d50d65-028e-47aa-8e01-a155c2b16e18
4
public boolean isFinished() { boolean finished = true; for (int i = 0; finished && i < squares.length; i++) { for (int h = 0; h < squares[1].length; h++) { if (squares[i][h] == null) { finished = false; break; } } } return finished; }
87762a99-3a40-4ecb-b93c-dc8c1bee4c70
1
public synchronized void dropBomb(TimerTask dt) { System.out.println("bomb dropped"); synchronized (this) { if (bombsAllowance == 0) { return; } bombsDeployed++; bombsAllowance--; new Timer().schedule(dt, this.detonationDelay); ...
6a61baed-3935-4889-b9cd-b4628609e8b6
7
@SuppressWarnings("unchecked") @Override public <K> Map<K, E> toResultMap(ResultSet resultSet, boolean sorted) throws ResultMapException { Map<K,E> resultMap = null; if( sorted ) { resultMap = new TreeMap<K,E>(); } else { resultMap = new HashMap<K,E>(); } if(resultSet == null) { return resultMap; ...
a4007c2e-4272-4923-bf91-372bf5d85fff
7
private boolean compatibleWithHand(Board b, String word, PosibleWord pw) { List<Character> handCopy = new ArrayList<Character>(letters); int i = pw.i; int j = pw.j; for (int index = 0; index<word.length(); index++) { Character c = word.charAt(index); if (b.charAt(i, j) != c) { if (!handCopy.remove(c))...
27ecd83a-1cab-4c25-bb8a-ee107d848d77
3
private ProvinceType provinceTypeFor(int provinceId) { if(seaProvinceIds.contains(provinceId)) return ProvinceType.SEA; if(lakeProvinceIds.contains(provinceId)) return ProvinceType.LAKE; if(wastelandProvinceIds.contains(provinceId)) return ProvinceType.WASTELA...
fecd9aba-ac28-4bfa-b77f-1bb5106ffc61
0
public boolean hasAltitude() { return !Double.isNaN(altitude); }
8076634a-d5f1-4b3d-91ce-f4e40555e550
3
public boolean removeEdgeTile(int x, int y) { for (int i = 0; i < edgeTiles.size(); i++) { Tile t = edgeTiles.get(i); if (t.getX() == x && t.getY() == y) { edgeTiles.remove(i); return true; } } return false; }
0524a60f-e531-4c60-a68e-2a8323b8305d
4
@Override protected boolean parseCliValue() { boolean status = false; for (String allowedValue : allowedValues) { if (allowedValue.equals(cliValue)) { status = true; value = cliValue; } } if (!status) { errorMessa...
ae433f02-a86c-4b48-8643-bae265bb25be
5
protected void init() { grid = new Object[HEIGHT][WIDTH]; for (int i = 0; i < WIDTH; i++) { for (int j = 0; j < HEIGHT; j++) { grid[j][i] = null; } } // add the droid grid[(int) mDroid.getY()][(int) mDroid.getX()] = mDroid; // add ...
9d5134a3-d7f3-4ee3-8483-b98da71571d0
2
public boolean containsPortal(final Location check){ if(check.getBlock().equals(one.getBlock()) || check.getBlock().equals(one.getBlock())) return true; else return false; }
75a60abd-a751-498b-8ad0-b2cdedaeb2cc
1
public String getData(String artistName) throws IOException { File eventFile = FileUtil.getEventsFile(artistName); if(!eventFile.exists()) { return ""; } String data = readFile(eventFile); return data; }
3edb6675-aabd-405e-8017-c2b18caa2357
8
@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { if(!mob.isMonster()) { if((commands!=null) &&(commands.size()>1) &&(commands.get(1).toUpperCase().equals("OFF"))) { final Command C=CMClass.getCommand("NOANSI"); if(C!=null) { ...
d6637bf2-ac04-46c7-a969-6ec263715b6a
2
static double det(double[][] A){ double det = 0; if(A.length == 1){ det = A[0][0]; }else{ for(int i = 0; i < A.length; i++){ det += Math.pow(-1,i)*det(minor(A,i,0))*A[i][0]; } } return det; }
dd976c59-6219-4551-a4c6-28a6f64a0281
1
public ItemType getItemType(String name) { if (itemTypes.containsKey(name)) { return (ItemType) itemTypes.get(name); } return null; }
2ded2040-cfc4-4d55-9a54-4446eed7dc73
3
private static RoutingTable createLocalRT(Host host, Case CASE) throws UnknownHostException { // the following are stored in the LOCAL host RoutingTable localRT = new RoutingTable(); localRT.setLocalhost(host); if (CASE.compareTo(Case.BOOTSTRAP_1) == 0) { return localRT; ...
2ec8fa7c-b7c2-4a2d-950a-0061d925a184
3
public static boolean libraryCompatible() { if (AL.isCreated()) { return true; } try { AL.create(); } catch (java.lang.Exception e) { return false; } try { AL.destroy(); } catch (java.lang.Exception e) { } ...
b6bda050-23ad-4b25-bda2-b81857fcd6bb
4
@Test public void test() { int[][] array = new int[M][N]; int row = M; boolean isUp = true; for (int i = 0; i < N; i++) { if (isUp) { array[--row][i] = i + 1; if (row == 0) { isUp = false; } } else { array[++row][i] = i + 1; if (row == M - 1) { isUp = true; } } } ...
a5735afd-ad5c-4869-b4dc-9de5e039bab5
7
public List<AcidSequence> parseChunk() { ArrayList<AcidSequence> list = new ArrayList<AcidSequence>(); // Begin with an initial sequence // TODO: assumes file is not empty AcidSequence sequence = new AcidSequence(); // While the file is not finished and we have not reached the // total number of sequenc...
e99d1c5d-8505-470d-836c-f39a35d26cda
8
private void handleInferenceInitializationResult(CycList data) { if (data.size() != 3) { throw new RuntimeException("Got wrong number of arguments " + "from inference result (expected 3): " + data); } Object problemStoreObj = data.get(1); Object inferenceObj = data.get(2); if ((problemStoreObj...
ff29f9c2-ae0b-47d5-a58a-53dd8f3f49a6
0
public void setEmployeeId(int employeeId) { this.employeeId = employeeId; }
ba664ace-da2f-4da8-a9ab-887c030fbe40
2
public boolean test(GoogleDocs googleDocs) { try { this.getUserMetadata(googleDocs); return true; } catch (ApiException e) { return false; } catch (ServiceException e) { return false; } }
17d5ef7c-fa86-4db4-92ba-4d215f04b4b7
4
public static boolean useItemTeleport(IClientContext ctx, String destination, int tries, int... ids) { if (itemTeleport(ctx, ctx.combatBar.select().id(ids).poll(), destination, tries)) { return true; } if (ctx.hud.opened(Hud.Window.WORN_EQUIPMENT)) { return itemTeleport(ctx, ctx.equipment.select().id(ids)....
c3049f28-d47c-49cd-89b3-357dd389ae84
3
public int getLow(int symbol) { if (symbol < 0 || symbol >= frequencies.length) throw new IllegalArgumentException("Symbol out of range"); if (cumulative == null) initCumulative(); return cumulative[symbol]; }
d3b419b8-885b-4e20-ae0d-cbb889401cb1
0
public void setFunNombres(String funNombres) { this.funNombres = funNombres; }
5167b6e1-3f7b-4aba-ac40-e7438ce91de1
4
protected Method getMethod(Object obj, String methodname, Class[] params) { Class<?> type = obj.getClass(); while (type != null) { try { Method method = type.getDeclaredMethod(methodname, params); if (method != null) { return method; } } catch (Exception e) { // ignore ...
f87a2866-4d92-4acf-afb3-19c9427910ae
1
public static void main(String[] args) throws IOException { ByteArrayOutputStream f = new ByteArrayOutputStream(); String str = "hello world welcome"; byte[] buffer = str.getBytes(); f.write(buffer); byte[] result = f.toByteArray(); for(int i = 0; i < result.length; i ++ ) { System.ou...
24774448-8179-4434-b7b2-ce0095043a2a
1
public void diminuirDebito(String nomeCliente, double valor)throws ExceptionGerentePessoa{ Cliente c = getCliente(nomeCliente); if(valor<=c.getDebito()){ c.diminuirDebito(valor); }else{ throw new ExceptionPessoa("Tentativa de diminuir d��bito acima do valor existente"); } ...
1e48551f-b482-49ce-b016-be7bcc91eb3b
2
public void playAudio() { // add file chooser JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(audioFile); // JLabel resultLabel = new JLabel(""); int returnVal = chooser.showOpenDialog(chooser); // retrieve chosen file if (returnVal == JFileChooser.APPROVE_OPTION) { // create t...
a8ccd744-08ca-4d44-8b25-14803e5ef7a5
9
public int checkDataType(String str){ int res = -1; char[] c = new char[]{'0','1','2','3','4','5','6','7','8','9'}; char[] str_array = str.toCharArray(); char symbol; boolean numberOcurrence = false; boolean letterOcurrence = false; int size = str_array....
a46969fb-5fcb-4d75-82db-58956ab9f160
3
public void printArray(Node array[]){ for (Node item: array){ String output = item.toPlainTextString(); output = output.trim(); Node c = item.getFirstChild(); while( c!=null ) { if( c instanceof Div ) { output += "\t \t" + ((Div) c).g...
5810e69f-3bdf-4248-a53c-b3aa968953bf
7
static private int jjMoveStringLiteralDfa9_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(7, old0, 0L); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(8, active0, 0L); return 9; } switch(curChar) { ...
e688fcc1-d9f6-4b5d-b39f-3aed63c6e069
5
@Test public void testServerSetQueueTimeoutDisconnectIndividualHashEx() { LOGGER.log(Level.INFO, "----- STARTING TEST testServerSetQueueTimeoutDisconnectIndividualHashEx -----"); boolean exception_other = false; String client_hash = ""; try { server2.setUseMessageQueues(t...
e325bd20-888c-443f-a317-1e65c0d57408
1
public void mouseReleased(MouseEvent me) { if (gameOn == true) { myImages.set(0, doodleRImg); } }
3bf6e68b-2086-4494-814e-c158fbe3df57
2
public void AllStateCharCollapse(int inTarget){ int inRole = CharacterCollapse(inTarget); Iterator<GameState> i = AllStates.iterator(); while(i.hasNext()){ GameState a = i.next(); if(a.SurviveCollapse(inTarget, inRole)){ // do nothing, state is allowed. } else { i.remove(); } } }
6d8a4b3a-1cf2-486a-a9f0-ca4ea4a83ebc
7
public int findMagicIndex(int a[], int start, int end) { if (end < start) { return -1; } else if (end == start && a[start] == start) { return start; } else if (end == start && a[start] != start) { return -1; } else { int mid = ((end - star...
67e3e4bb-72a6-4ad4-b6c9-bb0ee920b0c8
9
public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException { if(! (dwgObj instanceof DwgBlockHeader)) throw new RuntimeException("DwgBlockHeaderReader15 solo puede leer DwgBlockControl"); DwgBlockHeader hdr = (DwgBlockHeader) dwgObj; int bitP...
c0926d35-3d9d-4615-8de5-e8ae1448dd40
7
@Override public void run() { long lastTime = System.nanoTime(); long currTime = 0; double nsPerTick = 1000000000D/(double)ticksPerSecond; double delta = 0; while(running) { currTime = System.nanoTime(); delta += (currTime-lastTime)/nsPerTic...
ebc38d8c-101b-4566-8464-d95847dda577
9
public static int uniquePathsWithObstacles(int[][] obstacleGrid) { if(obstacleGrid.length == 0 || obstacleGrid[0].length == 0) { return 0; } int m = obstacleGrid.length; int n = obstacleGrid[0].length; //automatically initialized to 0 int[] rs = new int[n]; ...
07ba1d30-d9a6-4017-8646-e2992f8b65a2
8
public static byte[] decode( byte[] base64Data ) { // handle the edge case, so we don't have to worry about it later if(base64Data.length == 0) { return new byte[0]; } int numberQuadruple = base64Data.length/FOURBYTE; byte decodedData[] = null; byte b1=0...
71f1ea6a-f6b5-44d0-af0f-890cbc11a75b
1
public PathNode(Point location, PathNode parent, int addg) { this.location = location; this.parent = parent; if (parent != null) { gscore = addg + parent.getGscore(); } }
df488ba9-52e9-42f6-9d20-c73cc64b2e36
2
private void fillTypesOfEdges() { Vector<String> names = new Vector<String>(); names.addAll(Global.getImplementations("nodes/edges")); // default + current project if(!names.contains(Configuration.getEdgeTypeShortName())) { names.add(Configuration.getEdgeTypeShortName()); } typeOfEdges.removeAllItems(); ...
7861e631-5e4f-485b-b35b-f63b69393732
4
public void keyReleased(KeyEvent e) { // if we're waiting for an "any key" typed then we don't // want to do anything with just a "released" if (game.isWaitingForKeyPress()) { return; } if (e.getKeyCode() == KeyEvent.VK_LEFT) { game.setLeftPressed(false); } if (e.getKeyCode() == KeyEvent.VK_RIGH...
10a0ee43-16cf-4948-b7ff-bcacf535ef91
6
public BmgPanelPracticeFirst(final BmgFrame fen, String name) { //Some settings this.filename = name; int nb = 10; String color = "red"; //Label at first JPanel panFirst = new JPanel(); panFirst.setPreferredSize(new Dimension(fen.width, fen.height / nb)); ...
c9078320-ba6b-4342-8dd8-8df0e51dc04f
3
public static <T> void loopGenerator(Generator<T> gen, int timeToWait) { int mapsCreated = 0; while (true) { // generate and show a map Map map = gen.generateMap(1); if (timeToWait > 0) { System.out.println(map.toString()); } mapsCreated++; System.out.println("Map nr.: " + mapsCreated); tr...
96a4eeab-adba-4a5b-8eaa-faf663022672
8
protected void flushDB() { if (graphDb == null) return; Transaction t = graphDb.beginTx(); try { GlobalGraphOperations op = GlobalGraphOperations.at(graphDb); for (Node n : op.getAllNodes()) { String nodeId = getNodeId(n); sendNodeAdded(sourceId, nodeId); for (String key : n.getPropertyKe...
7836c8e8-beac-400c-bef9-6b350f15d71d
7
private static void initializeTable(String schemaFile) { Connection conn; // load the H2 Driver try { Class.forName("org.h2.Driver"); } catch (ClassNotFoundException e) { System.err.println("Unable to load H2 driver"); e.printStackTrace(); // croak System.exit(1); } // credentials do not rea...
ca650dc0-21e5-46d2-b739-2b4b1169ed32
3
public static void main(String[] args) throws IOException { if (args.length != 2) { System.err .println("Incorrect Syntax. Correct: java Client <host name> <port number>"); System.exit(1); } Client client = new Client(); client.assignVariables(args[0], Integer.parseInt(args[1])); while (true) { ...
363383e2-bfeb-4f8d-a6dc-85525af01170
3
private void updateClientID(final long newClientID, final long oldClientID) { logger.info("registered ClientID is $" + newClientID); String titlePreFix = ""; if (ServerStarter.isClientServer()) { titlePreFix = "#### SERVER #### "; } GameEngine.getInstance().setTitle(titlePreFix + "netproto Client $" + ne...
dcbcd5d6-ca31-446d-97d9-c79f2e97aef1
3
private void jButtonSourcePreviousActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSourcePreviousActionPerformed try{ MultiSyntaxDocument syntax = new MultiSyntaxDocument(); if(sourceCurrentPosition==0 ){ JOptionPane optionPane = new ...
6cf2a226-9e7e-4b57-a702-1d5ed431debf
2
public void playerScore(int id, int score) { if (id == myID) { myScoreField.setText(myName + " = " + score); } else { theirScoreField.setText(theirName + " = " + score); } //If someones score is 0 nobody has won, clear the win field //This is done because the players have no way to know when ...
27ec926e-25a6-4e2d-8faa-7cc21f09c2a6
2
Schedule generateRandomSchedule(int x, int y, int i, int j){ Schedule s = new Schedule(new RoomScheme[x][y]); for(int k=0; k<x; k++){ for(int m=0; m<y; m++){ s.schedule[k][m] = generateRandomScheme(i, j, d.subject); } } return s; }
5a267fd9-6af6-41e0-90f9-db23ddab80c2
6
private static String getPath(BufferedReader in) throws IOException { String line = in.readLine(); String path = ""; // extract class from GET line if (line.startsWith("GET /")) { line = line.substring(5, line.length()-1).trim(); int index = line...
113758a2-f179-4caf-b89e-7221b414566b
7
public EigenvalueDecomposition(Matrix Arg) { double[][] A = Arg.getArray(); n = Arg.getColumnDimension(); V = new double[n][n]; d = new double[n]; e = new double[n]; issymmetric = true; for (int j = 0; (j < n) & issymmetric; j++) { for (int i = 0; (i < n) & issymmetric; i++) { ...
6b3fb4d7-9049-4d34-af36-af3f7a12ce25
5
public BigPacket(byte source, byte destination, byte hops, byte sequencenr, byte[] data, Boolean ack, Boolean routing, Boolean keepalive, Boolean more) { packet = new byte[data.length + HEADER_LENGTH]; System.arraycopy(data, 0, packet, HEADER_LENGTH, data.length); packet[0] = source; packet[1] = dest...
1e09e9d0-b1fd-47d6-9754-b3c081e1962f
0
public void setValue(String value) { this.value = value; }
71ff8f79-0d04-4208-862e-354f671b5caf
9
private Color getColor(double power) { int color = (int)(power*10); switch(color){ case 0: return new Color(0xFFFFCC); case 1: return new Color(0xFFFF99); case 2: return new Color(0xFFFF66); case 3: ...
c74896e1-7ba8-4427-a930-5dd85d0a007d
4
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Vertex vertex = (Vertex) o; if (!value.equals(vertex.value)) return false; return true; }
49d830ca-a8ca-45fe-8920-cff3578f4ea3
3
@Override public Object getValue() { String value=""; Object value1=this.getParent().queryBestResult(this.part1); Object value2=this.getParent().queryBestResult(this.part2); if(value1!=null) { value=value1.toString(); } if(value2!=null) { if(value.length()>1) { value += this.separator; } va...
5dc74a42-f85a-4388-ab32-b70d760c0ad0
8
@Override public final Action choose(Robots.BLU actor, Set<Action> options) { // Here we assume that we will always see the same // actor. This will be true of many models, including // this one, but not always. // On the first call, our state will not be initialized // so we initialize it here once and use...
1e3d32c9-56c0-4126-b3c7-6037e374bfde
8
public void userLeave (String nick) { // System.out.println("APP: leave " + nick ); if (extApp != null) { if (user.containsKey(nick)) { extApp.userLeave(nick); if (debugChannel != null) { IRCMessage m2 = new IRCMessage(); m2.command = "PRIVMSG"; m2.numPar...
27ae8514-10a9-412e-869d-79ded2b5fcaa
5
@Override public void start() throws MusicPlayerException { this.mLock.lock(); try { if ( this.mStreamPlayerRunnable == null ) { throw new IllegalStateException( this + " has not been initialized yet!" ); } if ( !this.mStreamPlayerRunnable.isStopped() && this.mStreamPlayerRunnab...
a85b93fe-17e9-47e8-b749-51cf5b53d299
3
public void run() { Graphics g = getGraphics(); int rColor, gColor, bColor; int x, y, width, height, dx, dy; while(true) { if(dm != null) { x = (int)((dm.width + 1) * Math.random()); y = (int)((dm.height + 1) * Math.random()); dx = (int)((x + 50) * Math.random(...
a73fbe5a-8ba1-4f08-b3ce-b752861d79ae
1
public boolean compa(String a){ boolean b= true; String txt= a.replaceAll(" ", ""); if(txt.length()==0){ b=false; error.setText("Los campos marcados con asteriscos son obligatorios"); } return b; }
92d53984-c704-4177-888a-a699357e36d6
1
private static void createDecimalParameters() { decimalArray = new Decimal[PARAMETERS]; for (int i = 0; i < PARAMETERS; i++) { Decimal decimal = Decimal.valueOf(i * 10.1); decimalArray[i] = decimal; } }
22871518-28b3-4691-b424-66ff798011d1
7
private String doMultiply(String n1, String n2) { int[] a1 = new int[n1.length()]; int[] a2 = new int[n2.length()]; for (int i =0;i< n1.length(); i++) { a1[i] = n1.charAt(n1.length() - i -1) - '0'; } for (int i = 0; i< n2.length(); i++){ a2[i] = n2.charAt(n2.length() - i -1) - '0'; } int[] rst = ...
9c1efff9-88fd-40b8-b790-0954141ba748
9
public void draw(Graphics g) { setBbox(point1, point2, circleSize); setVoltageColor(g, volts[0]); drawThickLine(g, point1, lead1); g.setColor(needsHighlight() ? selectColor : Color.gray); setPowerColor(g, false); int xc = point2.x; int yc = point2.y; drawT...
4ef24536-d809-4c28-8c63-945edcf15124
7
public void selectY() { int e = yElm == null ? -1 : sim.locateElm(yElm); int firstE = e; while (true) { for (e++; e < sim.elmListSize(); e++) { CircuitElm ce = sim.getElm(e); if ((ce instanceof OutputElm || ce instanceof ProbeElm) ...
f344a163-115c-466b-896b-179cfa695b7f
1
public String getSymbol() { String currentChar; String expr = getCurrentExpression(); if (expr.length() > 1) { currentChar = expr.substring(0, 1); } else { currentChar = expr; } return currentChar; }
76985042-186e-44fc-9d17-a259f1b8bd49
8
@Override public List<Command<Ui>> convert() throws CannotConvertModelException { List<Command<Ui>> commands = new ArrayList<Command<Ui>>(); ImmutableLinearObjfunc objfunc = this.model.getObjfunc(); ImmutableSolution solution = this.model.getCurrentSolution(); List<ImmutableSolution> solutionHistory ...
ff04a476-e85f-48d1-ae7e-714f98b8a465
1
@Override public void focusLost(FocusEvent e) { if (isVisible()) { focus.requestFocusInWindow(); } }
6a8380e4-5a42-49ba-adf6-ad02ad242e70
4
public List<Integer> getIntegerListFromString(String xArg) { if (xArg == null || xArg.equalsIgnoreCase("")) return null; List<Integer> d = new ArrayList<Integer>(); char[] c = xArg.toCharArray(); int lastPos = 0; for (int i = 0; i < c.length; i++) { if (c[i] == ',') { d.add(Integer.value...
08562b36-fe50-442b-8897-56a065e6df09
0
@Override public BufferedImage draw() { BufferedImage image = new BufferedImage(Chunk.getPixelLength(), Chunk.getPixelLength(), BufferedImage.TYPE_INT_ARGB); Graphics2D gI = image.createGraphics(); return image; }
a65f1f5e-d09a-4a48-b041-167e2b72510a
5
public ExtDecimal plus() { if (type == Type.NUMBER) { return new ExtDecimal(content.plus()); } else if (type == Type.POSITIVEZERO) { return new ExtDecimal(Type.POSITIVEZERO); } else if (type == Type.NEGATIVEZERO) { return new ExtDecimal(Type.NEGATIVEZERO); ...
d544697f-277a-422f-b274-d4bcf6669370
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=prof...
35606748-4d8f-4a19-9f10-7eeffaf576cb
4
public int hashCode() { int lHashCode = 0; if ( this._nome != null ) { lHashCode += this._nome.hashCode(); } if ( this._username != null ) { lHashCode += this._username.hashCode(); } if ( this._password != null ) { lHashCode += this._password.hashCode(); } if ( lHashCode == 0 ) { lHashCode =...
1003f8d9-2cb9-4168-9cbd-f72385fdc88e
4
private static GridResourceWithFailure createGridResource(String name, double baud_rate, double delay, int MTU, int totalPE, int totalMachine, int rating, String sched_alg) { // Here are the steps needed to create a Grid resource: // 1. We need to crea...
8e428c75-3ca5-47ba-9c67-35d440a2c44f
9
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
47716d81-f608-4051-b381-9cb37f21b265
4
@Override public void actionPerformed(ActionEvent e) { value--; if(value %((int) MAX) == 0 && value != (int) (MAX * filled)) try { Thread.sleep(5000); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } if(value > 0) repaint(); }
f9d8d90b-53d9-4e6c-8fdb-9a1f3f5ad5cb
8
public static void applyToxicSpikes(Team team) { Pokemon poke = team.getActivePokemon(); if (poke.isType(Type.POISON) && !poke.getAbility().equals(Ability.LEVITATE) && !poke.isType(Type.FLYING)) { team.removeToxicSpikes(); } else if (team.hasToxicSpikes() && !poke.isType(Type.STEEL) && !poke.isType(Typ...
2df6e813-d244-49b5-874f-9cb7f5259269
7
public synchronized void paint (Graphics g) { Dimension d=getSize(); if (I==null || I.getWidth(this)!=d.width || I.getHeight(this)!=d.height) { I=createImage(W=d.width,H=d.height); if (I==null) return; IG=I.getGraphics(); init(); } dopaint(IG); g.drawImage(I,0,0,W,H,this); double vp...
bbc34142-ccd1-4049-a0ed-4eb55c43505a
1
@Override public T get(S key) { if (tr.containsKey(key)) { Node n = ls.remove(tr.get(key)); ls.add(n); return n.value; } else { // not found return null; } }
b82f53e7-cf10-44bf-8e39-52b242056ca2
5
public void run(){ try { while(true){ byte[] data = new byte[1024]; DatagramPacket packet = new DatagramPacket(data, data.length); ds.receive(packet); String content = new String(packet.getData()).trim(); if(content.startsWith("user/")){ p = new Player(content.split("user/")[1], 100, 1, 1,...
27a4b8fb-63a0-496c-a9e6-c66cf7b077c7
3
public static void main(String [] args){ long max =0; long n =600851475143L; long[] factors = getFactors(n); for(long i: factors){ if(isPrime(i) && i > max){ max = i; } } System.out.println("Max prime factor of " + n + " is: " + max); }
9f6774d0-1428-44a7-8567-d445e36c6769
9
public static void main(String[] args) throws Exception { // TODO code application logic here Set<Integer> set = new Set(); System.out.println("Выберите действие"); System.out.println("1 - добавить элемент"); System.out.println("2 - удалить элемент"); System.out.println("...
4bc34881-6a50-4637-bac9-0ae5c56d8344
1
public List<Double> getSkewnessList() { List<Double> result= new ArrayList<Double>(); double[] values= this.getSkewnessArray(); for (int i= 0; i< values.length; ++i) { result.add(Double.valueOf(values[i])); } return result; }
004bc77b-59a7-4c7b-9881-c8af7456f6bf
7
public static Object funcall (java.lang.reflect.Method x, Stella_Object y, Object [] z) { // Wrapped to catch and transform errors. try { return x.invoke(y,z); } catch (IllegalAccessException e) { if (y == null) { throw (StellaException) StellaException.newStellaException("Illegal Java Acc...
47d5091b-60fe-4a5f-8cb7-e13595ebb671
1
private void removeForceFieldConnection(ForceFieldConnection forceFieldConnection) { if (forceFieldConnection == null) throw new IllegalArgumentException("The given forceFieldConnection is invalid!"); forceFieldConnections.remove(forceFieldConnection); }
63d296a7-216f-447b-8559-3c7420ca369c
7
public static void makeCompactGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout)pa...
0bdab127-3b57-41b0-ab9f-fe04369567e8
0
@Override public void keyReleased(KeyEvent e) { keys[e.getKeyCode()] = false; }
d467130d-9182-48fb-aa41-bee9161414b9
1
public void AddUniform(String uniform) { int uniformLocation = glGetUniformLocation(program, uniform); if (uniformLocation == -1) { System.err.println("Could not find uniform: " + uniform); new Exception().printStackTrace(); System.exit(-1); } uniforms.put(uniform, uniformLocation); }
aed66a02-364c-40f3-a6e6-d64fa2e6a06e
1
public boolean close() { try { wdg().cbtn.click(); return true; } catch (Exception ex) { return false; } }
ab439156-f865-4042-a0f8-736efa3480c9
4
private void cpu1() { switch (this.getGeneratoreRouting().getNextRoute()) { case IO: if (this.getIo().isFree()) { this.getIo().setFree(false); this.getIo().setJob(this.getCpu1().getJob()); this.getCpu1().setJob(null); ...
dd7cc486-7e83-4821-98b4-5a038161decd
7
private void bottomStroke(Location loc, int size){ // If Size == 0 we are done. // If Invalid, we can't move down any further anyway, so stop. if(size == 0 || !grid.isValid(loc)) return; Actor tmp = null; int r = loc.getRow(); int c = loc.getCol(); for(int i = 0; i < size; i++){ Location rightLoc...
20306cd8-b754-4e4a-8166-9199f93341ad
4
public void handle(Request request, Response response) { // Reject non-announce requests if (!Tracker.ANNOUNCE_URL.equals(request.getPath().toString())) { response.setCode(404); response.setText("Not Found"); return; } OutputStream body = null; try { body = response.getOutputStream(); this.pro...
0ae5b388-abb8-4978-a887-d835789833ae
8
public String getName() { switch( error ) { case NULL: return "#NULL!"; case DIV0: return "#DIV/0!"; case VALUE: return "#VALUE!"; case REF: return "#REF!"; case NAME: return "#NAME?"; case NUM: return "#NUM!"; case NA: return "#N/A"; case CIR_ERR: return "#C...
16bdb86f-d4c6-46bf-9860-e925beab3f1c
6
private void douglasPeuckerSimplificationRoutine(Point[] bpoints, int j, int k, boolean[] pointMarker){ if (k <= j + 1)return; // there is nothing to simplify // check for adequate approximation by segment S from v[j] to v[k] int farthesti = j; // ind...
3cfa1c0c-51e2-4706-a827-ef732019b9a6
3
public void startFadeOut() { if(gamePlayList != null) { if(this == gamePlayList.getNextSong(false) && !gamePlayList.getStopping()) { stopFadeOut(); } gamePlayList.startFadeOut(); } }
76734688-5fc3-4edc-b29b-cda886874732
2
public void loadPathLocation(String pathLocation) { file = new File(pathLocation); if (!file.exists()) { System.out.println("File or Directory not found. Path not Loaded"); try { System.out.println("Put boards in " + new java.io.File(".").getCanonicalPath() + "/SudokuBoards/"); } catch (IOException ...