method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
54e6387e-796e-4bee-a027-431515a5d11a
0
public void eatDiamant(Diamant dia) { stomache += dia.getPoints(); dia.setCatched(); }
2eff1520-ff4f-4c68-91b1-80ab693a974c
4
@RequestMapping(value="/BusinessUnitUse.do", method=RequestMethod.POST) public String doActions(@ModelAttribute BusinessUnitUse BusinessUnitUse, BindingResult result, @RequestParam String action, Map<String, Object> map){ BusinessUnitUse BusinessUnitUseResult = new BusinessUnitUse(); switch(action.toLowerCase()){ ...
7cae79d1-8174-44b8-8cc2-ac2974b803a2
6
float nextMove() { if (wiggleCount > 0) { return wiggle(); } if (nextMoveUser != 0) return nextMoveUser; if (targetPoint != null) { return headForTarget(); } if (circuit != null) { return followCircuit(); } if (cloud...
91d3365f-7dd2-4cfe-9fab-381acdc5880a
8
@Override public void step() { SIRAmountManager amountManager = (SIRAmountManager)super.getProcess().getAmountManager(); IndividualBasedModel model = amountManager.getModel(); String sirModelState = model.modelStateString(); double ...
755002d7-99c4-4db3-87b8-0d8edf7c0c86
9
@Override public void createView() { mainWindowFrame = new JFrame(); mainWindowFrame.setTitle("XQuery Tester"); mainWindowFrame.setBounds(100, 100, 1142, 831); mainWindowFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar menuBar = new JMenuBar(); mainWindowFrame.setJMenuBar(menuBar); JMenu...
d62197df-51aa-4cf0-a432-7dfa9dcfcb56
7
public void render() { renderStart = System.nanoTime(); BufferStrategy strat = getBufferStrategy(); if(strat == null) { createBufferStrategy(3); return; } try { sm.getCurrentScreen().clear(); sm.getCurrentScreen().render(); if(loading) loading = false; }catch(NullPointerException e) ...
abcc4bfb-b946-4001-8299-3d14f59521b2
5
public ListNode addTwoNumbers(ListNode l1, ListNode l2) { // Start typing your Java solution below // DO NOT write main() function ListNode l = new ListNode(0); ListNode cur = l; int carry = 0; while (l1 != null || l2 != null) { int a, b; if (l1 == null) { a = 0; } else { a = l1.val; l1...
fba60f2a-32b7-4723-814c-6a3adc5d0b7e
7
public static void main(String[] args) throws IOException { int[][] a = new int[DIM][DIM]; int[][] b = new int[DIM][DIM]; // int[][] c = new int[DIM][DIM]; for (int i = 0; i < DIM; i++) { for (int j = 0; j < DIM; j++) { a[i][j] = i * DIM + j; } } for (int i = 0; i < DIM; i++) { for (int j = 0; j...
7499344f-90dc-44fb-9a41-b593b80709f1
1
private void printLine(int caretRowPosition) { String index="1"+newLine; for(int i=2; i<=(caretRowPosition+1); i++) index+= Integer.toString(i)+newLine; this.setText(index); }
ed39c992-c4e1-4edb-a0fa-265e9137d81b
8
public void finish() throws IOException { if (state != State.INUSE) { throw new IllegalStateException("FileSaver not in use"); } // Ensure both are closed before we try to rename. if (mOutputStream != null) { mOutputStream.close(); } if (mWriter != null) { mWriter.close(); } // Delete the ...
2a02a356-a3d3-4132-a935-f1354ebfa240
8
public void setDouble(double d) { /* Abfangen der Sonderfaelle */ if (d == 0) { this.vorzeichen = false; this.mantisse.setBits(false); this.exponent.setBits(false); return; } if (Double.isInfinite(d)) { this.vorzeichen = (d < 0); this.mantisse.setBits(false); this.exponent.setInt(maxExpone...
7e01c476-45f2-4292-a781-3fb7704679b7
0
public void setMinValue(Double min) { this.minValue = min; }
e0fffbda-dd98-4a11-a68d-4fa457c77354
0
public void setIdDetalle(int idDetalle) { this.idDetalle = idDetalle; }
d4e0daea-acba-478b-a06d-1ea1390428ad
8
public void PrintSetup(Layout setup) { for (int i = setup.getGenMin(); i <= (setup.getGenMax() * 1.5) - 2; i++) { System.out.print(" "); } System.out.println("[" + setup.RoomCount() + "]"); for (int i = setup.getGenMin(); i <= (setup.getGenMax() * 3) + 1; i++) { System.out.print("■"); } System.ou...
1f279531-832d-4627-a1e7-7418f887dd1c
7
protected void getMatchingNames( String part, List found ) { // check our table for( int i=0; i< size(); i++ ) { String name = (String)get(i); if ( name.startsWith( part ) ) found.add( name ); } // Check other tables. /** Unimplemented - need a collection here */ if ( table != null ) table.g...
05bb705e-fff4-4b11-afa7-e3c18f5c4298
4
private void poimiSieni() { if (sijainti.getSieni() == Sieni.PISTESIENI){ pisteet= pisteet+100; sijainti.setSieni(null); } else if (sijainti.getSieni() == Sieni.VOIMASIENI){ voima = voima +10; sijainti.setSieni(null); } else if (si...
49537b44-9a04-4685-8511-1354e375f218
6
protected void scoreFrom(int playerIndex, Hex front, Hex back) { int color = front.getColor(); for (int direction = 0; direction < 6; direction++) { Hex neighbor = front.getNeighbor(direction); if (neighbor != null) { if (neighbor != back) { if (neighbor.getColor() == color) { Hex tempNeighbor ...
776fd137-ddf6-4123-9d2f-47284ac3b65e
4
public static void main(String argv[]) throws Exception { String hostname = argv[0]; Integer port = Integer.parseInt(argv[1]); String filepath = argv[2]; InetAddress IP_ADDRESS = InetAddress.getByName(hostname); DatagramSocket clientSocket = new DatagramSocket(); FileInputStream inFromUser = new FileInput...
2f8e0ad3-0334-41f2-946b-6f782a2cdb8b
9
private boolean isAreaXreducible(int areaType, int area1, int area2, int altArea1, int altArea2, String theVal) { String theValues; int [][] searchArray; if(areaType == ROW) { searchArray = colIndices; } else { searchArray = rowIndices; } for (in...
60f22027-b1bf-4bb0-8bc3-83a313709da6
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...
e9de5fe2-2b18-4bdd-9caf-4b1d51c8ed1d
3
public void render(Graphics g) { if (image != null) { int xPos = backgroundManager.mapToPanelX((int) mapX); int yPos = backgroundManager.mapToPanelY((int) mapY); if(initialYPos == -99999999) { initialYPos = yPos; } if(registry.getGameCo...
f1528edc-3667-4926-8d2e-df371d4ba435
4
private String[] getRightPossibleWords(String origin){ List<String> result=new ArrayList<>(); result.add(origin); for(int i=1;i<origin.length();++i){ if(isPalindrome(origin.substring(origin.length()-i))){ result.add(origin.substring(0,origin.length()-i)); ...
18b942fb-5f90-4d38-9993-373fac545d7c
1
public void setUsertileImageOverlay_Height(int height) { if (height <= 0) { this.usertileImageOverlay_Height = UISizeInits.USERTILE_IMAGEOVERLAY.getHeight(); } else { this.usertileImageOverlay_Height = height; } somethingChanged(); }
1ecb41a1-7188-404c-a630-2fc96ee918fd
2
public int getSize() { /* * maxStack: 2 maxLocals: 2 code: 4 + codeLength exc count: 2 * exceptions: n * 8 attributes: lvt_name: 2 lvt_length: 4 lvt_count: 2 * lvt_entries: n * 10 attributes: lnt_name: 2 lnt_length: 4 lnt_count: * 2 lnt_entries: n * 4 */ int size = 0; if (lvt != null) size += 8 ...
b4d23bc3-9f4a-45da-9b87-f7bc52554f93
0
Status(int requestStatus, String description) { this.requestStatus = requestStatus; this.description = description; }
cf856680-114b-495f-8ba4-be24f979a450
6
public static void main(String[] args) { String account = args[0]; int[] base10mio = new int[3]; base10mio[2] = Integer.parseInt(account.substring( Math.max(0, account.length() - 7))); if (account.length() > 7) { base10mio[1] = Integer.parseInt(account.substring( Math.max(0, acco...
72e64dd8-3595-4b72-af6d-8391288ee277
2
@Override public TestElement createTestElement() { RemoteTestRunner testRunner = new RemoteTestRunner(); modifyTestElement(testRunner); String currentTestId = Utils.getCurrentTestId(); if (currentTestId != null && !currentTestId.isEmpty()) { TestInfoController.start(curr...
63790744-3236-4bf1-bd6f-05f1c76cf551
0
public List<Blog> getBlogList() { return this.blogDelegate.getBlogs(); }
5585216a-5e12-4d98-8223-64f24c0d005f
2
public static void deleteQuiz(Quiz quiz) { // delete from quiz try { String statement = new String("DELETE FROM " + DBTable + " WHERE qid=?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, quiz.quizID); stmt.executeUpdate(); } catch (SQLException e) { e.print...
eede7bb0-ac28-4ed0-97c7-ebb5b35df233
7
private static float maximum(float a, float b, float c, float d) { if (a > b) { if (a > c) { return a > d ? a : d; } else { return c > d ? c : d; } } else if (b > c) { return b > d ? b : d; } else { return c > d ? c : d; } }
66ea2998-89f7-418c-bed4-7647e1a066f9
1
public void parse() throws IOException { for (File inputFile : mInputFiles) { System.out.println(String.format(Locale.US, "Reading input file %s...", inputFile)); InputStreamReader inputStream = new FileReader(inputFile); addWordsFromInputStream(inputFile.length(), inputStrea...
05cdee20-2f33-4299-bc25-d8f43880660c
7
public void redraw() { // Create the bitmap and draw the plot bitmap = new BufferedImage( SIZE_X, SIZE_Y, BufferedImage.TYPE_INT_ARGB ); Graphics2D g2 = (Graphics2D) bitmap.getGraphics(); // draw the background white g2.setColor( Color.white ); g2.fillRect( 0, 0, SIZE_X, SIZE_Y ); g2.setFont( MainAndDownl...
b9fefd76-d68a-4a91-9155-b38927b7f8fa
7
public void actionPerformed(ActionEvent e) { Component[] clist = ckb.list.getComponents(); if(e.getActionCommand().equalsIgnoreCase("Save Portfolio")) { Double weight[] = new Double[clist.length/2]; for (int i = 0; i < clist.length; i++) { if (i%2 == 1) { WeightSlider slide = (WeightSli...
448a54ef-25f7-48a0-9d1a-709b2a651861
9
private String evaluateCountRBondFunction(final String clause) { if (clause == null || clause.equals("")) return null; if (!(model instanceof MolecularModel)) return null; MolecularModel mm = (MolecularModel) model; if (mm.bonds.isEmpty()) return null; int i = clause.indexOf("("); int j = clause.la...
9cb6a2b2-3e6b-4664-86d4-6ccaf891af50
9
public void setMove(Move move) { if (move.isWinningMove()) { if (counterColor.equals(move.getCounterColor())) { statusIsWinner(); } else { statusIsLooser(); } } else if (move.isTimeoutMove()) { if (move.getCounterColor().equ...
11c7cba2-8fca-48fd-a7b6-5ec12798f887
4
private boolean eight_byte_size_ready() { // 8-byte payload length is read. Allocate the buffer // for message body and read the message data into it. final long payload_length = ByteBuffer.wrap(tmpbuf).getLong(); // There has to be at least one byte (the flags) in the message). ...
595be56d-54bd-4ae7-9619-9c2a5ce3561a
2
public ItemHandler(int ID) throws SQLException { this.ID = ID; Inventory = new HashMap<Integer, InventoryItem>(); Grizzly.GrabDatabase().SetQuery("SELECT * FROM server_users_items WHERE user = '" + ID + "'"); if (Grizzly.GrabDatabase().RowCount() > 0) { ResultSet Items = Grizzly.GrabDatabase().Gr...
35d5a5cd-706e-49ac-8daf-2c4e186b0a43
2
public Renderer(Game game, JPanel panel) { if (game == null) throw new IllegalArgumentException("The given game is invalid!"); if (panel == null) throw new IllegalArgumentException("The given panel is invalid!"); this.objectTron = game; this.panel = panel; initImages(); }
68421eec-50af-41da-becd-102614593931
9
void makeMove(BufferedReader in, PrintWriter out) throws IOException { updateNav(); if(bomb_counter > 0) bomb_counter--; String move = moves.poll(); String method = "move in queue"; if(move == null || !moveSafe(move) || enemyCheck()){ moves.clear(); if(canPlaceBombAndEscape(moves)){ move = "BOMB"...
e0bf6347-4f03-4207-b9ca-315e6b053d85
8
public static void setGoalGradMerged(State pState) { // set high values for (int row = 0; row < nbRows; row++) { // for each col for (int col = 0; col < nbCols; col++) { goalGradMerged[row][col] = -1; } } int value; // for each row for (int row = 0; row < nbRows; row++) { // for each col ...
ec8fbba8-a570-4e4d-ac68-278012b72f01
6
public String stripLine(String navigationLine) { String arrow = " <-+-- "; String vertical = " | "; String corner = " +-- "; String navigationLine2 = navigationLine; if (navigationLine2.contains(corner)) navigationLine2 = navigationLine2.replaceAll(" \\+--", "...
b6cad920-90eb-4ccb-b9f1-b44feb04e1a9
6
public void body() { // find out ids for entities that are not part of simulation network // topology, such as GIS, GridSimShutdown and GridStatistics int gisID = GridSim.getGridInfoServiceEntityId(); int statID = GridSim.getGridStatisticsEntityId(); int shutdownID = GridSim....
056f5adb-5053-46e7-a902-ad815e8b6b23
3
public static void LoadAllSripts() { File scripts_dir = new File("scripts"); if (scripts_dir.exists() && scripts_dir.isDirectory()) { String[] files = scripts_dir.list(new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".jbot"); } }); for (int i = 0; i <...
772f0a2d-1ea2-441f-882c-a97806ffade2
0
public SimpleFindFileContentsHandler(String query, String lineEnding) { super(lineEnding); setQuery(query); }
4972ecca-1962-470a-9509-a119f3ee9cad
5
public Object nextEntity(char ampersand) throws JSONException { StringBuffer sb = new StringBuffer(); for (;;) { char c = next(); if (Character.isLetterOrDigit(c) || c == '#') { sb.append(Character.toLowerCase(c)); } else if (c == ';') { ...
8cd82e3f-0b0e-4412-92dd-bd8a3d72af4f
7
public void keyReleased(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_A) { dx = 0; moominCurr= moominl[0]; } if (key == KeyEvent.VK_D) { dx = 0; moominCurr = moomin[0]; } if (key == KeyEvent.VK_W) { ...
137fc362-4a03-4f1d-9be0-31fe004ca486
9
protected DataFlavor getImportFlavor(DataFlavor[] flavors, JTextComponent c) { DataFlavor refFlavor = null; DataFlavor stringFlavor = null; for (int i = 0; i < flavors.length; i++) { String mime = flavors[i].getMimeType(); if (mime.startsWith("text/plain")) { return flavors[i]; ...
45f71237-f2b8-47c2-b53f-fa43defb87df
3
double getAreaInSquareKilometers(int cellId) { if ((cellId < 0) || (cellId >= mesh.countCells())) { return 0; } if (mesh.isPentagon(cellId)) { return getAreaOfHexagonalCellInSquareKilometers() * 5.0 / 6.0; } else { return getAreaOfHexagonalCellInSquare...
2448aa5f-b2a1-43f0-9b35-6587120abed5
1
public HashUtil(String algorithm) { try { md = MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block System.err.println("[HashUtil] Severe: The algorithm "+algorithm+" is not available. Make sure that your JRE provides an implementation of " + algo...
ccd29be5-3808-48e9-88cd-b8d97b121913
6
private static final Object[] decodeInteger(byte[] bencoded_bytes, int offset) throws BencodingException { StringBuffer int_chars = new StringBuffer(); offset++; for(; bencoded_bytes[offset] != (byte)'e' && bencoded_bytes.length > (offset); offset++) { if((bencoded_bytes[...
26bc6faa-1bf0-404f-a901-43aaa4f27c85
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...
47c6867b-63de-4fec-a270-578d033cea38
3
public void actionPerformed(ActionEvent e) { Debug.println("Controller.actionPerformed()"); if (e.getActionCommand().equals("Throw Ball")) { throwBall(); } if (e.getActionCommand().equals("Restart Game")) { ps.doIt(PlayerSelect.SHOW); ps.run(); } if (e.getActionCommand().equals("Quit Game")) { q...
ba647204-cb13-4d3e-bf70-216a317f5a4b
1
public void clearInventory() { for(int i = 0; i < inventory.length;i++) { inventory[i] = Parasite.items.EmptyItem; } }
81074c6e-34ee-47de-852e-3d00141f7c60
4
public static boolean isPreDefinido(Tipo tipo) { switch(tipo){ case INTEIRO: case REAL: case CARACTERE: case BOOLEANO: return true; default: return false; } }
dbb88d62-4bfd-4949-a590-8425b771cb69
4
public static void rectangle(double x, double y, double halfWidth, double halfHeight) { if (halfWidth < 0) throw new RuntimeException("half width can't be negative"); if (halfHeight < 0) throw new RuntimeException("half height can't be negative"); double xs = scaleX(x); double ys = scal...
6747d078-a106-445e-8d04-6d2cde80d00c
2
public static void loadPortals() throws SQLException { ResultSet res = SQLManager.sqlQuery( "SELECT * FROM BungeePortals" ); while ( res.next() ) { String name = res.getString( "portalname" ); String server = res.getString( "server" ); String type = res.getString( "ty...
7081b894-a932-40f0-87c1-3b7b8696a3f2
8
public static void main(String[] args) { if (args.length != 1) { System.out.println("Usage: TransmemStats inputfile.dat"); return; } try { FileInputStream is = new FileInputStream(args[0]); int tmProteinsWithTIE = 0; int tmProteinsWithT = 0; int allProteins = 0; ...
3d27433e-4c71-4cb4-a36a-c8f08eff71d2
9
public void run() { while(isWriter) { int i; int j; synchronized(this) { if(buffIndex == writeIndex) try { wait(); } catch(InterruptedException _ex) { } if(!isWriter) return; j = writeIndex; if(buffIndex >= writeIndex) i = buffIndex - writeIndex; ...
eb7efc6f-537f-4881-b075-64ff21199f99
5
@Override public void putAll(Map<? extends String, ?> m) { for (Map.Entry<? extends String, ?> entry : m.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); this.put(key, value); } }
fd734013-1e87-44a7-b744-82fcc1b00c01
8
public static void setINIValue(File file, String key, String value, String section) throws FileNotFoundException { try{ // Make sure that it is possible to write to the file if(!file.canWrite()){ if(!file.setWritable(true)) throw new Fi...
29a354f5-9d41-42b7-9eda-4915077204c4
2
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { name = (String) in.readObject(); this.setIcon((Icon) in.readObject()); medias = (TreeSet<MediaElement>) in.readObject(); for (MediaElement mediaElement : medias) mediaElement.setParent(this); St...
a24f5d36-7982-41a2-bc59-d79c62a1337c
4
public int getCell(int x, int y) { if (x < 0 || x >= width / cellSize || y < 0 || y >= height / cellSize) return 1; return tiles[(x * cellSize) + (y * cellSize) * width]; }
29ee62ba-601c-475a-804b-6859e00d90cf
5
protected Iterator<Object> getValueIterator(PriorityQueue<KeyValue<Object,Object>> inputQ){ ArrayList<Object> valueList = new ArrayList<Object>(); if(inputQ.isEmpty()) return null; KeyValue<Object, Object> keyValuePair = inputQ.peek(); valueList.add(keyValuePair.getV...
931d1bfe-2722-449d-8c74-2b9f408e225a
3
public static long toLong(Object object) { if (object instanceof Number) { return ((Number) object).longValue(); } try { return Long.valueOf(object.toString()); } catch (NumberFormatException e) { } catch (NullPointerException e) { } retur...
4e349c02-0fca-49cb-892a-8a263d1a5f74
7
private void searchInfoFile(File parent) { for (File child : parent.listFiles()) // In Ordner Infodatei suchen { if (child.isFile()) { if (child.getName().endsWith(".info")&&!child.getName().startsWith("dependencies")) { try { String cont = OP.Textreaders(child); if (!cont.e...
97f547d9-39ff-4d9d-90a6-d7989b6b39ac
7
final void method2095(Component component) { Mixer.Info[] infos = AudioSystem.getMixerInfo(); if (null != infos) { Mixer.Info[] infos_0_ = infos; for (int i = 0; i < infos_0_.length; i++) { Mixer.Info info = infos_0_[i]; if (info != null) { String string = info.getName(); if (null != string ...
92a61870-205e-4986-b82e-5cf29f9d9156
3
private synchronized void updateGridletProcessing() { // Identify MI share for the duration (from last event time) double time = GridSim.clock(); double timeSpan = time - lastUpdateTime_; // if current time is the same or less than the last update time, // then ignore ...
31664ecb-dd6a-48f4-b281-4f22a40ec4bd
5
@Override public void updateOtherPlayerMovement(Player player, ByteVector packet) { if (player.getWalkingDirection() == -1) { if (player.isUpdateRequired()) { packet.writeBits(1, 1); packet.writeBits(2, 0); } else { packet.writeBits(1, 0); } } else { if (player.getRunningDirection() == -1) ...
6851a5ac-f04e-4196-bd3d-52a0d6856d0f
1
public int getPages(int intRegsPerPag, ArrayList<FilterBean> alFilter, HashMap<String, String> hmOrder) throws Exception { int pages; try { oMysql.conexion(enumTipoConexion); pages = oMysql.getPages("alumno", intRegsPerPag, alFilter, hmOrder); oMysql.desconexion(); ...
cbe0273a-26d2-4929-aa32-5caa8e25be96
7
public void movement(int zeroIndex, int direction, GridState current) { // First check that the movement would be valid if (rulesForMovement(zeroIndex, direction)) { // Create a new child based on the current state GridState child = createChild(current.getElements(), zeroIndex, ...
f16ef7d1-cd23-4712-84dd-17b71834add3
0
Chess() { super(11); System.out.println("Chess constructor"); }
7a18a29e-6a7f-4709-9d97-becfffaa0467
3
public boolean equals(Object obj) { if (!(obj instanceof Kim)) { return false; } Kim that = (Kim) obj; if (this == that) { return true; } if (this.hashcode != that.hashcode) { return false; } return java.util.Arrays.equa...
e06dd7d6-edaa-40d5-9b34-d8459f483c13
7
private void drawCircle(int[] bits, int[] circle, int x, int y, int r) { int d = 2*r + 1; int pw = getPanelWidth(); int ph = getPanelHeight(); int xStart = getXnull() + x - r, xCircleStart = 0; int yStart = getYnull() - y - r, yCircleStart = 0; int xStop = xStart + d, x...
74509dfb-23b3-456a-a0f0-4e3949165f41
3
public static Type fromString(String text) { if (text != null) { for (Type b : Type.values()) { if (text.equalsIgnoreCase(b.toString())) { return b; } } } throw new IllegalArgumentException("No enum with name " + text + " found"); }
52975063-a46e-4f13-8abc-46151365a0cc
0
@Override public String getEntityFileName() { return StringUtil.concatenateStrings(this.name, "_", this.id.toString()); }
a4b6b76a-ec3e-4ac1-8abd-6f3d196c3e94
1
public BD(String ruta) { this.ruta = ruta; File bd = new File(this.ruta); if(bd.exists()) this.abrirBD(this.ruta); else this.crearBD(this.ruta); }
9aa73ffb-963f-4a71-9583-d12cd9cf8510
8
public MeasurementData measure(String requestSignature, IHttpTimingDownloader measurementDownloader, IHttpDownloader reportDownloader) { MeasurementData result = new MeasurementData(); List<ReportData> reports = result.getReportData(); for (int i = 0; i < probes.size(); i++) { ReportData reportData = probe...
51851ebd-6adb-40a9-9608-72eac9ecb795
3
private static List<String> calculateParenthesesSteps(int startPoint) { List<String> steps = new ArrayList<>(); for (int i = startPoint; i < workableExpression.length(); i++) { if (workableExpression.charAt(i) == ')') { steps.add(workableExpression.substring(startPoint, i)); // that is the end of this step ...
1f6a1dff-9037-40db-a219-f40335919e27
0
public Serializer(MainWindowModel mainWindowModel, DataModel dataModel) { this.mainWindowModel = mainWindowModel; this.dataModel = dataModel; }
5b7950ca-00ee-4a4d-86f2-253ce624d44a
4
public boolean EhCompativelCom(List<Aula> aulas) { Collections.sort(this.grade, new AulaComparator()); boolean ehCompativel = true; for(Aula aulaIntruso : aulas){ for(Aula minhaAula : this.getGrade()) { if(minhaAula.bateCom(aulaIntruso) || aulaIntr...
21104c59-8e23-401d-8a49-26201afb5a41
9
public int getY(){ if(beingHeld){ return y; } char yChar = getCurrentSquare().charAt(1); switch(yChar){ case '8': return 20; case '7': return 120; case '6': return 220; case '5': return 320; case '4': return 420; case '3': return 520; case '2': return 620; case '1': ...
4e2190b8-b43f-4095-bfbc-c9c1e6c25671
1
public T peek() { int length = size(); if (length == 0) { throw new EmptyStackException(); } return get(length - 1); }
0d250bc4-fa5f-490a-9726-97b02c7ce641
7
@EventHandler public void SkeletonWeakness(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.getZombieConfig().getDouble("Skeleton.We...
92ad4acb-f8a2-4581-82c8-c1e5c9b35af9
5
public void update(){ if(online) Data.launcherFrame.versionCombo.setModel(new DefaultComboBoxModel<String>(versionList)); else Data.launcherFrame.versionCombo.setModel(new DefaultComboBoxModel<String>(new String[]{})); File fi = new File(Data.DEFAULT_DATA_FOLDER + "\\" + getName()); fi.mkdirs(); if(!con...
47d9d5ba-ba7e-4060-a0b7-ae3ead125c6c
2
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try { List<String> args = new ArrayList<>(); args.add("connect"); if (!jFormattedTextField1.getText().equals("")) { args.add(jFormattedTextField1.ge...
19b26d45-6818-489b-b356-882929aab7bb
8
public static String subtask3(CompositeText document, int sentenceIndex) { List<TextComponent> sentences = listOfAllSentences(document); TextComponent theSentence = sentences.get(sentenceIndex); Set<String> words = new TreeSet<String>(); for(TextComponent token : theSentence){ if (token instanceof Token &...
1fc7943b-1e85-453e-8dff-f016bd85e235
2
private void generationLigne() { for (int i= 0; i<taille; i++){ Random rand = new Random(); int nombreAleatoire = rand.nextInt(nbCouleurs); // On met directement nbCouleurs, car on commence à l'indice 0 try { ligne[i] = listeCouleur[nombreAleatoire]; ...
4af29015-ec9d-4725-80b6-d8f454545a16
2
public boolean checkNoPlayerBoundsCollisionNegative(int playerID) { Point2D point = players.get(playerID).getBatPos(); if(point.getX() < maxX+maxX/20 || point.getY() > minY-minY/20)return false; return true; }
d38631de-25dd-4f6c-a6cd-bdc61f86e41d
4
public int compare(PropertiesFile o1, PropertiesFile o2) { if (o1 == null) { return -1; } if (o2 == null) { return +1; } if (o1.getLocale() == null) { return -1; } if (o2.getLocale() == null) { return +1; } return o1.getLocale().toString().compareTo(o2.getLocale().toString()); ...
ce28c928-82c7-4afa-b6cf-1ebb90845c7c
1
@Test ( timeout = 2000 ) public void clientWriteToSocketClosedByServer () throws Exception { Socket[] sockets = connectToServer(); try ( Socket serverSocket = sockets[ 0 ]; Socket clientSocket = sockets[ 1 ] ) { serverSocket.close(); // wait for close to propag...
fd387035-5e25-40cc-bfb3-873cc62b7320
2
private static final NepticalData buildNepticalData(Object data){ if(data == null){ return NepticalData.NULL_DATA; } if(data instanceof NepticalData){ return (NepticalData)data; } return new GenericImmutableData(data); }
6c6b3a61-6237-4856-a075-0549b54b9c5f
3
void setItemBackground () { if (!instance.startup) { textNode1.setBackground (itemBackgroundColor); imageNode1.setBackground (itemBackgroundColor); } /* Set the background button's color to match the background color of the item. */ Color color = itemBackgroundColor; if (color == null) color = textNode1...
7ebb318b-4ffa-4da7-bb5e-c5100b9d38c2
5
public void actionPerformed(ActionEvent e) { // Check which button was pressed switch( e.getActionCommand()){ // Open pattern details window if the pattern datails button was pressed. case "PatternDetails": if (this.details_dialog == null){ try { PreviewImageIcon thumbnail = new PreviewImageI...
9f577bba-af10-46ce-8648-df030204a04e
9
private Set<Resource> getLibraryProjectResources() { final Set<Resource> resources = new HashSet<Resource>(); // Find the library projects final File projectPropertiesFile = new File(mProjectTree.getBaseDirectory(), "project.properties"); if (!projectPropertiesFile.exists()) { ...
0cb5b7cb-c355-4fbf-af74-69169434e227
4
public static BaseAccount createAccount(int accountType, int PIN) { BaseAccount account; switch (accountType) { case CHECKING: { account = new CheckingAccount(2000, "27", PIN, 1, 2.5); break; } case OVERDRAFT: { account = new OverdraftAccount(3000, "23", PIN, 0.05, new DateTime(), 1); break; } case SAVING:...
8a8a3323-01de-4274-b212-b40031d81c45
9
public static WeiboType[] getPublicTypes() { if (null == weiboTypeArray) { List<WeiboType> list = Lists.newArrayList(); if (!Utils.isStringEmpty(OAuthProperty.CONSUMER_KEY_163) && !Utils.isStringEmpty(OAuthProperty.CONSUMER_SECRET_163)) { list.add(T_16...
0cb8c586-084d-4572-a536-8eb28b8ddc10
9
public void CheckIDX_2 (String checkInst, String CheckOper){ int size = 0; for(int i = 0; i < IDX_2.size(); i++) { if(IDX_2.elementAt(i).equals(checkInst)) { machCod.add(mIDX_2.elementAt(i)); //############# Code to make the second step in [IDX2] instructions, changing 'xb ee ff' ####### ...
be4082e6-16d4-4426-8062-2a9337200fdc
2
protected void saveEntity(Object o) { Session session = null; Transaction tx = null; try { session = getSession(); tx = session.beginTransaction(); session.save(o); tx.commit(); } catch (RuntimeException e) { logger.error("Error saving entity "+ o); e.printStackTrace(); } finally { if (...
30fc963b-b141-4dfe-9936-59d427fdd1ec
9
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); init(201); int nSet = 1; while ((line = in.readLine()) != null && line.length() != 0) { int[] data; try { ...
3ced1a9f-0ee6-4bfc-ae54-704dfacda4b4
0
public PeopleAmount getPeopleAmount() { return peopleAmount; }