method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
77244e7a-8262-4404-8388-aa276f6cb48c
1
private static void sendToAllBots(IBomber[] bombers, String status) throws IOException { for (IBomber iBomber : bombers) { iBomber.sayToBomberman(status); } System.out.print(status); }
a8a30573-c78a-493e-835b-fc7156154a4b
3
public Point[] getInnerCorners() { Point[] corners = new Point[4]; switch(orientation) { case X_AXIS: corners[0] = center .add(new Point(0, INNER_SIZE, INNER_SIZE, 1)); corners[1] = center.add(new Point(0, INNER_SIZE, -INNER_SIZE, 1)); corners[2] = center.add(new Point(0, -INNER_SIZE, -INNER_SI...
1335195f-1566-46ff-91b7-9f4597be9eec
9
public String calcQueueTurns(City citySelected) { int[] t = citySelected.quickEval(); //Division by zero errors if (t[0] == 0 && citySelected.queueFood > 0) { return new String("No food production, will not finish."); } else if (t[2] == 0 && citySelected.queueMetal > 0) { return new String("No meta...
ad52cc5b-b4c3-4b7c-b3f4-a1065dfe0a27
0
public static void main(String[] args) { }
27312755-5d7b-4508-867a-2beadb1aeb0b
7
public static boolean isAnagram1(String text1, String text2) { if (text1 == null || text2 == null) return false; if (text1.isEmpty() || text2.isEmpty()) return false; String text1Lower = text1.toLowerCase(); String text2Lower = text2.toLowerCase(); String text1WithoutSpaces = t...
184e7517-e8fd-472f-a39a-01a3cc58d9b8
7
@Override public void run() { BlockingDeque<I> queue = entry.getQueue(); while (!stop) { I in = null; if (queue.size()>0) { in = entry.getQueue().removeLast(); } if (in != null) { if (in.getPilot().isExtinguisher()) { stop(); break; } DataVector<O> output = process(in); It...
45bd7925-660a-4f56-9a83-df17de971e40
6
public Map<K, V> read(JsonReader in) throws IOException { JsonToken peek = in.peek(); if (peek == JsonToken.NULL) { in.nextNull(); return null; } Map<K, V> map = constructor.construct(); if (peek == JsonToken.BEGIN_ARRAY) { in.beginArray(); while (in.hasNe...
9b682a92-898c-4de9-9a16-110c676db67c
6
public String toString() { String out = ""; out = out + " Encoding: " + encoding + "\n"; out = out + " Zero: " + zero[0] + ", " + zero[1] + "\n"; out = out + " One: " + one[0] + ", " + one[1] + "\n"; if (header != null) { if (header[0] != 0) out = out + " Header: " + header[0] + ", " + header[1]...
58f70744-592a-43f2-bd58-efa5bdba7c72
1
public IntBuffer getSound(String res) { if(!buffers.containsKey(res)) { loadSound(res); } return buffers.get(res); }
baa9f818-8f94-4bfe-b483-9ac77c32a795
4
void parseGenotypes() { if (isCompressedGenotypes()) { uncompressGenotypes(); } else { vcfGenotypes = new ArrayList<VcfGenotype>(); // No genotype string? => Nothing to do if (genotypeFieldsStr == null) return; // Split genotypes and parse them genotypeFields = genotypeFieldsStr.split("\t"); ...
01ca08d9-eb1a-4c0c-a5b3-33f6a6949006
0
public Stock(String identifier, String name, int inventory, float price) { this.identifier = identifier; this.name = name; this.inventory = inventory; this.price = price; }
20810e78-e9be-4b50-be69-ad21ae29b7ad
0
public static void main(String[] args) { new BlankFinal(); new BlankFinal(47); }
5867ff90-ff16-4157-8961-6043bf729d6a
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!(affected instanceof MOB)) return true; final MOB mob=(MOB)affected; // when this spell is on a MOBs Affected list, // it should consistantly prevent the mob // from trying to do ANYTHING except sleep if((msg.amISou...
fea6a4d1-8356-44bf-aeea-1a824c2e1bb0
2
private CategorieMotClef findCategoryFromString(String categorieMotClef) { for (CategorieMotClef c : categories) { if (c.getNom().equals(categorieMotClef)) { return c; } } throw new IllegalArgumentException("Etonnant : la catégorie de mot clef n'existe pas !"); }
2ffed8e2-7200-468d-952f-ff91937779cc
8
public static ProtocolMessage fromBytes(ByteBuffer input){ byte mtype = input.get(); switch (MessageType.fromByte(mtype)) { case SEND_MESSAGE: return SendMessageRequest.fromBytes(input); case CONNECTION_REQUEST: return ConnectionRequest.fromBytes(input); ...
acc08b6c-3ee9-44fe-acc1-2546b564bd52
4
public void updateCollisionPairs(double timeStep) { clearCollisionPairs(); for (int i = 0; i < rigidBodies.size(); i++) { RigidBody rigidBody = rigidBodies.get(i); Vector3d predictedPosition = new Vector3d(); Quat4d predictedRotation = new Quat4d(); rigidBody.predictCollisionPosition(timeStep, predicte...
a8e2233e-55f9-419b-b9e9-845e92f84ec3
9
public Geometry patch(int m, int n, double basisMatrix[][], double data[]) { // TO MAKE NORMALS CORRECT AROUND THE EDGES, ALLOCATE EXTRA VERTICES... newRectangularMesh(m + 2, n + 2); // ...BUT DON'T ATTACH THOSE EXTRA VERTICES TO ANY FACES. faces = new int[m * n][4]; for (int k = 1; k ...
2664a04f-8814-4a74-be8b-c33a34de6554
8
private void findFile(byte dirTxt){ JFileChooser fc = new JFileChooser(); fc.setApproveButtonText("Set"); Game g = GameFactory.getGameFromID(games[selectedTab]); String path; if(dirTxt == EXE_DIR){ fc.setFileFilter(new ExeFileFilter()); ...
bae005c3-551b-4b66-bd80-8e623d51bc4b
8
public void processEvent(AWTEvent paramAWTEvent) { MouseEvent localMouseEvent1 = null; int i = 0; super.processEvent(paramAWTEvent); if (paramAWTEvent.getID() == 505) { this.exitedlast = true; } else if (paramAWTEvent.getID() == 504) { localMouseEvent1 = (MouseEvent)paramAWTE...
4bb3d136-f296-42b5-9bb1-dc624a79f766
8
private void deleteCase5(LinkSetNode n) { if (n == n.parent.left && nodeColor(n.sibling()) == NodeColor.BLACK && nodeColor(n.sibling().left) == NodeColor.RED && nodeColor(n.sibling().right) == NodeColor.BLACK) { n.sibling().color = NodeColor.RED; ...
6f265bd3-7a74-4361-b028-4ac05a0de3f3
3
public List<Funcionario> listAll() { Connection con = null; PreparedStatement pstm = null; ResultSet rs = null; List<Funcionario> funcionarios = new ArrayList<>(); try { con = ConnectionFactory.getConnection(); pstm = con.prepareStatement(LIST); ...
b3f35738-e152-4c3e-97b5-50a86047c436
1
public void tick(){ // add time if ticking if(ticking){ millisecondsExpired++; } }
94b858e2-5279-4279-b6be-2dc7026c3241
7
private void loadDataFromFESVoOnly(int[] dataDimension, int xLRef, int yLRef, int lod, int firstSlice, int lastSlice) { // [TEST] get starting time: long startTime = System.currentTimeMillis(); // for every (s,t) in the texture buffer, // load data from FESVo: f...
11641a35-6c1d-408b-b27a-0766208ac2da
3
public static List<Download> parseDownloadListObject(Object result) throws InvalidRpcDataException { List<Download> list = null; if (result instanceof Object[]) { Object[] objects = (Object[]) result; list = new ArrayList<Download>(objects.length); for (Object obj...
4d0f2e35-fb3f-4b76-ad44-ed335bf49e53
3
public void run(){ while(true){ try { sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } if (continuar){ contadorParcial++; contadorTotal++; lblTiempo.setText(""+contadorParcial/60+":"+contadorParcial%60); lblTotal.setText(""+contadorTotal/60+":"+contadorTotal%6...
7fa08c39-41c1-48cf-9fd2-d11e0cfa81e0
1
public void useDynamite() { if(dynamite >= 1) { notifyPropertyChangeListeners(new PropertyChangeEvent(this, "dynamite", dynamite, --dynamite)); } }
e3e45b55-ad4b-4165-9af4-dfc7bcb91d6a
2
public final int readCompactLength() { int b = readU8(); int result = b & 0x7F; if ((b & 0x80) != 0) { b = readU8(); result |= (b & 0x7F) << 7; if ((b & 0x80) != 0) { b = readU8(); result |= (b & 0xFF) << 14; } } return result; }
dc733daa-bb1b-4d01-b352-5111adede0ce
6
@Override protected void writeChildren(XMLStreamWriter out) throws XMLStreamException { super.writeChildren(out); // Using a copy of the objects defensively against races. for (AIObject aio : new ArrayList<AIObject>(aiObjects.values())) { if (!aio.checkIntegrity()) { ...
232753f7-f030-4623-8328-9c47c4d58063
3
public static String createExtensionMatcher(String extension) { StringBuilder builder = new StringBuilder(); if (Platform.isMacintosh() || Platform.isWindows()) { builder.append("(?i)"); //$NON-NLS-1$ } builder.append("^.*\\"); //$NON-NLS-1$ if (!extension.startsWith(".")) { //$NON-NLS-1$ builder.appen...
046ec809-468c-4eb2-966a-a24ca430a650
6
public static boolean isPrime(int n) { if (n <= 3) { return n >= 2; } else if (n % 2 == 0 || n % 3 == 0) { return false; } else { for (int i = 5; i < (Math.sqrt(n) + 1); i += 6) { if (n % i == 0 || n % (i + 2) == 0) { return...
ba4aead9-868f-458d-9aee-c1420784fc12
8
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new FileReader(args[0])); String s; int x = -1, y = -1; while ((s = br.readLine()) != null) { x = s.indexOf('C'); if (x > -1) { if (y == -1) { y = x; } s = s.replace("C", y == x ? "|" : y...
90538374-1094-4fbb-8b4f-c9e71ce4b285
5
public int getPrecedence() { if(this instanceof AddOp) { return 1; } else if(this instanceof SubOp) { return 1; } else if(this instanceof MulOp) { return 2; } else if(this instanceof DivOp) { return 2; } else if(this instanceof Equa...
84b00f92-081e-4808-a052-00aad0f8b3b2
5
@Override public void paint(Graphics g) { /* Affiche les différentes images */ g.drawImage (imgAccueil, 0, 0, this); g.drawImage (imgAllSeries, 0, 101, this); g.drawImage (imgMySeries, 0, 202, this); g.drawImage (imgCalendrier, 0, 303, this); g.drawImage (imgProfil, 0, 4...
7c6f4d19-ec87-401f-87df-b11c3c71a681
2
public double[] subarray_as_radians_phase_of_Phasor(int start, int end){ if(end>=this.length)throw new IllegalArgumentException("end, " + end + ", is greater than the highest index, " + (this.length-1)); Phasor[] pp = this.getArray_as_Phasor(); double[] phaser = new double[end-start+1]; ...
22539dc7-5ac9-46b1-a9f0-5fd8fdf7df5f
5
public void removeSuccessor(Jump jump) { SuccessorInfo destInfo = (SuccessorInfo) successors .get(jump.destination); Jump prev = null; Jump destJumps = destInfo.jumps; while (destJumps != jump && destJumps != null) { prev = destJumps; destJumps = destJumps.next; } if (destJumps == null) throw n...
e026c90d-9823-4b38-86fe-dc0e00ad9235
7
@Override public void drawGui() { for (final Place place : this.board.places) { if (place instanceof PlaceProperty) { this.drawProperty((PlaceProperty) place); } else if (place instanceof PlaceStation) { this.drawStation((PlaceStation) place); } else if (place instanceof PlaceUtility)...
bbbe4fcb-7268-43cc-8f39-ab42a2c105f6
0
public List<TestBean> findAll() { return jdbcTemplate.query("select * from test", new ParameterizedRowMapper<TestBean>() { @Override public TestBean mapRow(ResultSet rs, int rownum) throws SQLException { TestBean result = new TestBean(); result.setId(rs.getInt(1)); result.setN...
053ea31a-8daf-4573-8a97-332c1dc99821
0
public boolean doDownload() { return this.download; }
a4577fa7-c302-45bd-afcc-333eae394456
2
protected void threadStarted() { // wait for the SoundManager constructor to finish synchronized (this) { try { wait(); } catch (InterruptedException ex) { } } // use a short, 100ms (1/10th sec) buffer for filters that // chang...
4896bce7-ead2-4cc8-9e4e-72911103332a
7
@Override public void init() { /* 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://download.o...
c5bb97c3-d41c-49d0-8ad0-b9ba8927f471
4
public Cube doAlgorithm(String s) { if (s.startsWith(",")) s = s.substring(1); if (s.endsWith(",")) s = s.substring(0, s.length() - 1); String[] sA = s.split(","); for (String sL : sA) { if (sL.length() > 0) turn(Turn.valueOf(sL)); } return this; }
f14fce52-63f1-42f5-ae6f-e33d423c9ad5
2
public void updateScene() throws IOException { //Не используется Model.getIntance().empty(); EForm current = null; for(EForm f : EForm.values()) if(f.getScene().equals(getScene())) current = f; current.setScene(new Scene(FXMLLoader.load(getClass().getResource...
516c8760-7aa6-4c52-9a87-7be6c0aefb00
1
public Button(JButton button) { this.button = button; button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (clickHandler != null) clickHandler.run(); } }); }
1a2806d0-2843-40dc-b7fe-0e303789138a
6
public void damageDetection () { if (character.equals("P1")) { P2AttackArea getHit = (P2AttackArea)getOneIntersectingObject(P2AttackArea.class); if (getHit != null) { hurt = true; hitpoint-= getHit.damageDealt(); if ...
1415618e-f081-4af9-b87d-ccb2d03debd0
0
public static Properties GetMessageTypes_Properties(){ return messagetypes_properties; }
3a525c19-47df-47a5-81c2-50daaeae930b
3
public Object resetEdge(Object edge) { mxGeometry geo = model.getGeometry(edge); if (geo != null) { // Resets the control points List<mxPoint> points = geo.getPoints(); if (points != null && !points.isEmpty()) { geo = (mxGeometry) geo.clone(); geo.setPoints(null); model.setGeometry(edge...
6dc17547-2ef0-4327-949b-3756a3fc902e
3
public static void initBloomFilter() { try { if (filterFile.exists()) { //如果存在则读入整个对象流 ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filterFile)); filter = (BloomFilter) ois.readObject(); SimpleDateFormat format = new SimpleDateF...
d04e0fc9-c80a-41e4-b07c-7e04a159547a
6
public int bufferLeft(int ori) { int buff = 0; int width = getTiles()[0].length == 9 ? 3 : 4; // get width (3 or 4) of piece width = getTiles()[0].length == 4 ? 2 : width; for(int j = 0; j < width; ++j){ boolean tmp = true; for(int i = 0; i < width; ++i){ if(tiles[ori][i*width+j]){ tmp = false; ...
22b403aa-976c-4d8c-989e-35ec6b6f4de0
8
public final void setCurrentScreen(GuiScreen var1) { if(!(this.currentScreen instanceof ErrorScreen)) { if(this.currentScreen != null) { this.currentScreen.onClose(); } if(var1 == null && this.player.health <= 0) { var1 = new GameOverScreen(); } this.currentScreen = (GuiScreen)var1; if(var...
9250364d-f009-437f-ba95-7393013b89d9
9
public void first() { if (first) { if (y / 64 + 1 <= 127 && world.tiles[x / 64][y / 64 + 1] instanceof Stone) down = true; if (y / 64 - 1 >= 1 && world.tiles[x / 64][y / 64 - 1] instanceof Stone) up = true; if (x / 64 + 1 <= 127 && world.tiles[x / 64 + 1][y / 64] instanceof Stone) right = true; ...
2ccb953a-f8d5-4445-a16a-4608301e18df
1
public Question randomQuestion() { if (getRandomIsPriority()) { Operator operatorLeft = getRandomOperator(); Operator operatorRight = getRandomOperator(operatorLeft); return new PriorityQuestion(operatorLeft, operatorRight); } else { return new Associativi...
6f286774-e1b4-43e9-aa92-82c3672ae809
2
private SystemState readSystem( InputStream in, String systemId ) throws IOException { SystemState system = new SystemState( systemId ); int capacity = readInt(in); // Normally systems are 28 bytes, but if not present on the // ship, capacity will be zero, and the system will only // occupy the 4 bytes that ...
6967b04e-cf94-4516-ac2a-285bc903bf96
0
@Override public String getDesc() { return "Sanctuary"; }
bc396e28-f8de-477a-8566-6901c18a2f4b
4
private boolean updateLangProb(double[] prob, String word, double alpha) { if (word == null || !wordLangProbMap.containsKey(word)) return false; double[] langProbMap = wordLangProbMap.get(word); if (verbose) System.out.println(word + "(" + unicodeEncode(word) + "):" + langProbMap.toString()); ...
75788957-afa0-472a-807f-a1da6adcd8b6
3
public String toIPV4(){ int i=3; String result=""; int num=getNum(); while(true){ int temp = num%256; if(i<0) break; if(i==3) result = String.valueOf(num%256); else result = String.valueOf(num...
6d15121b-5155-4075-b625-e26b16535b8f
5
private boolean incrementSequence() { synchronized( sequenceQueueLock ) { // Is there a queue, and if so, is there anything in it: if( sequenceQueue != null && sequenceQueue.size() > 0 ) { // grab the next filename/URL from the queue: ...
886fff06-9e10-4460-99dc-030e6a46618c
8
public static void extractFromHTML(String theURL) throws URISyntaxException, ParserException, IOException { URL url = new URL("file:" + theURL); URLConnection con = url.openConnection(); Pattern p = Pattern.compile("text/html;\\s+charset=([^\\s]+)\\s*"); Matcher m = p.matcher...
ce99ebde-6d57-42cd-99f5-70dcd97e89a9
8
@Override public Entities asEnum() { if (this.isFrozen()) { return Entities.SNOWMAN; } if (this.team == Team.RED) { if (this.d == Direction.NORTH) { return Entities.REDPLAYER_N; } else if (this.d== Direction.EAST) { return Entities.REDPLAYER_E; } else if (this.d == Direction.SOUTH) { retu...
c4e7e220-86ea-413e-a9aa-8d76c12a21d9
4
public void decryptFile() { try { if (_cryptPath.isEmpty()) { Logger.addMessage("Select file to decrypt."); return; } Path fileOrg = Paths.get(_path); Path fileCopy = Paths.get(_path + ".tmp"); Files.copy(fileOrg, fileCo...
ec0d9956-a2f4-4ae4-ba7d-5c33493e72c1
7
private Node composeNode(Node parent, Object index) { recursiveNodes.add(parent); if (parser.checkEvent(Event.ID.Alias)) { AliasEvent event = (AliasEvent) parser.getEvent(); String anchor = event.getAnchor(); if (!anchors.containsKey(anchor)) { throw n...
7ca0884b-248b-433a-b1ea-7cf5e0a5046d
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Chip chip = (Chip) o; if (degreeIndegration != chip.degreeIndegration) return false; if (gainCoefficient != chip.gainCoefficient) return false;...
60b73c25-0e20-4618-9c45-ba0fcfe683c8
6
@Override public void log(int level, String category, String message, Throwable ex) { logger.log(level, category, message, ex); int color = 0xffffff; if(level == Log.LEVEL_ERROR) { color = 0xff0000; if(ex != null) { StackTraceElement[] trace = ex.getStackTrace(); for(StackTraceElement e : tra...
6a4281e4-da24-40ca-a383-ca3b6f70c32a
5
@Override public void undo() { // Shorthand JoeTree tree = parent.getTree(); OutlineLayoutManager layout = tree.getDocument().panel.layout; tree.setSelectedNodesParent(parent); // Replace Everything for (int i = 0, limit = primitives.size(); i < limit; i++) { primitives.get(i).undo(); } // Fi...
10fb5c39-44c7-4e8e-a181-4b32a5492e5d
2
public int conectar() { try { Class.forName(driver); } catch (ClassNotFoundException e) { System.out.println("No se pudo cargal el driver :-( " + driver); return -1; } try { con = DriverManager.getConnection(url, userDB, passDB); } ...
52ab016b-1183-4171-a763-c12de1767d0f
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...
db4d2bde-660d-4b40-a53d-b72d94c35dbf
9
private final void method548(byte[] bs, int[] is, int[] is_36_, int i, int i_37_, int i_38_, int i_39_, int i_40_, int i_41_, int i_42_, int i_43_, int i_44_, int i_45_, aa var_aa, int i_46_, int i_47_) { aa_Sub1 var_aa_Sub1 = (aa_Sub1) var_aa; int[] is_48_ = var_aa_Sub1.anIntArray5487; int[] is_49_ = var_aa_Sub1...
bbed3898-b143-4b82-8d6f-6d7686c419de
7
private int transformarDia(String dia) { String fecha = dia.toLowerCase(); if ("domingo".equals(fecha)) { return 1; } if ("lunes".equals(fecha)) { return 2; } if ("martes".equals(fecha)) { return 3; } if ("miercoles".equ...
f326b64c-9956-439d-88ac-8cf12ad8954d
2
public ArrayList<Product> getAlleBrandstoffenDB() { ArrayList<Product> alleBrandstoffenDB = new ArrayList<Product>(); try { this.leesDatabase(); statement = con.createStatement(); rs = statement.executeQuery("SELECT * FROM voorraad where type='1'"); while (rs.next()) { int id = rs.getInt("id"); ...
6c3f5995-1d8d-4b8a-b2aa-b38d4d1843b9
7
private void paintLeftBorder(Graphics g, int x, int y, int width, int height, Color color) { g.setColor(color); // Top Line if (!afterHighlighted || tabSpacing) g.drawLine(x, y, x + width - 1, y); // Left Line if (drawTopLine) g.drawLine(x, y, x, y + height - 1); /...
d13fd05d-27e7-4130-8ae5-882bc0a5deda
8
private void createMenus() { jMenuBar1 = new javax.swing.JMenuBar(); fileMenu = new SFMenu(); importMenuItem = new SFMenuItem(); quitMenuItem = new SFMenuItem(); editMenu = new javax.swing.JMenu(); displaysMenu = new JMenu("Displays"); editMenu.getPopupMe...
acb5f14a-9fb4-4f27-93cc-8421b60348b1
5
public static void main(String[] args) { try { myURL=InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { System.out.println("Unknown Host :" + e.toString()); System.exit(1); } try { serverSocket = new ServerSocket(4000); ...
4b7149a4-7096-4410-9bb3-b2d6c00b7c62
1
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + capacity; result = prime * result + dataTransferRate; result = prime * result + ((type == null) ? 0 : type.hashCode()); return result; }
acd796d3-0ebc-450a-a7ee-558a722899fd
0
private static void marshal() throws JAXBException, PropertyException { /* * AtomicValidator<Employee> validator1 = new * AtomicValidator<Employee>(); validator1.setField("field1"); * validator1.setValue("3"); validator1.setOperator(new * UnaryLogicalNotOperator<Boolean>()); * * AtomicValidator<Emp...
a2f28d7b-4e1e-43c0-8f1c-d8092c86439b
4
private void checkEnemies() { /* GameActor a = getOwningActor(); PhysicsComponent pc = (PhysicsComponent)a.getComponent("PhysicsComponent"); WeaponsComponent wc = (WeaponsComponent)a.getComponent("WeaponsComponent"); float cx = pc.getX(); float cy = pc.getY(); ...
004825e8-d52e-4865-855c-163268ea74a8
6
public void collectPartition() throws UnknownHostException, IOException, InterruptedException, ClassNotFoundException { for (PartitionEntry taskEntry : this.task.getEntries()) { String localFileName = this.task.localReducerFileNameWrapper(taskEntry.getTID()); File localFile = new File(localFileName); ...
b56d5fbd-5a06-46a7-be1b-5b5e9856e92a
1
@Test public void addVecToSet_test() { try{ double [][]mat= {{1.0,2.0}, {3.0,1.0}}; double []vec= {1.0,2.0,3.0,1.0}; double[][]result = Vector.addVecToSet(mat, vec); double exp[][]={{2.0,3.0}, {5.0,3.0}}; Assert.assertArrayEquals(exp, result); } catch (Exception e) { // TODO Auto-gen...
6a6b5f8e-ffcb-4623-a955-ca6b32453add
4
@Override public int hashCode() { int hash = 0; hash += (name != null ? name.hashCode() : 0); hash += (type != null ? type.hashCode() : 0); hash += (modelName != null ? modelName.hashCode() : 0); hash += (vendor != null ? vendor.hashCode() : 0); return hash; }
f7238d7a-c2e1-4c62-ad7a-2b9b7d120eb8
7
public static void make() { try { SceneObject spinner = SceneEntities.getNearest(Variables.SPINNING_WHEEL_ID); if (spinner != null) { spinAll(); } else { SceneObject stairs = SceneEntities.getNearest(Variables.STAIRS_DOWN_ID); i...
a47322db-2c93-4500-a52b-d76376501bfb
4
public boolean hasOptionArg() { String s = peek(); if(s.isEmpty()) { return false; } else { return s.length() > 3 && s.charAt(0) == '-' && s.charAt(1) == '-' && Character.isLetter(s.charAt(2)); } }
dbb6d515-19e3-4d16-a588-0574cb84332b
5
protected void submitButtonActionPerformed(ActionEvent evt) { ProfileInformation myProfileInfo = new ProfileInformation(); String authorFirstName = firstNameField.getText(); String authorLastName = lastNameField.getText(); String profession = professionField.getText(); authorFirstName = authorFirstNa...
42bc0666-52d4-4062-99c7-2d7010f446b8
0
public VueTag() { TableModel dataModel = new AbstractTableModel() { public int getColumnCount() { return 1; } public int getRowCount() { return 11; } public Object getValueAt(int row, int col) { return new Integer(row * col); } }; JTable tableTag = new JTable(dataModel); tableTa...
2ef165a0-d29f-4ee9-9ca7-dcd7a9ff4d79
4
private void presente(ArrayList<Cellule> a){ // Regarde si la cellule est déjà présente dans une liste de cellule boolean present = true; for (int i =0 ; i<a.size() ; i++){ for (int j = 0 ; j < this.al.ressource.size() ; j++){ if (a.get(i).coord == this.al.ressource.get(j).coord ){ present = false;...
d25caf64-2a94-4e8c-ab68-4b892691166d
0
public int getRap_num() { return rap_num; }
685cfae9-0bb2-4ef3-87f7-12168e4a0a6e
9
* @param xxx * @param yyy * @param zzz * @param blockOffset * @param blockId */ public void renderEndPortalFrame(int textureId, int xxx, int yyy, int zzz, int blockOffset, BlockType block, int tex_offset) { float x = xxx + this.x*16; float z = zzz + this.z*16; float y = yyy; float side_height = .8125...
d56be8d7-fd22-4b54-a336-9c52d07b180a
7
@Override public void run(){ int speed = 1; for(int i = 0; i < 19 + (mReel.getX()/110)*19; i++){ try { Thread.sleep(speed); //mReel.setLocation(mReel.getX(), mReel.getY() - 10); for(int animIndex = 0; animIndex < mStorage.length; animIndex+...
113fd072-aa3f-49ed-9c59-f4295ab2f90d
3
public void tick(){ for(Entity e : getEntities()){ e.tick(); } for(Tile t : Tile.tiles){ if(t == null){ break; } t.tick(); } }
2004f7e5-0dc3-4b35-9c42-7d7edfc5feed
2
private int getNumberOfValues(int val) { int num = 0; for (int i = 0; i < 5; i++) { if (hand[i].getValue() == val) { num += 1; } } return num; }
01f29223-dd58-43b9-b868-3bcf93f54ed7
7
public int maximalRectangle(char[][] matrix) { // Start typing your Java solution below // DO NOT write main() function int m = matrix.length;// length int n = m == 0 ? 0 : matrix[0].length; // width int max = 0; // pre-compute the matrix int[][] newMatrix = new int[m][n]; for (int i = 0; i < m; i++) { ...
5ced8720-8c48-496b-a23c-8c7846b80b59
2
public static void main(String[] args) { ExecutorService exec = Executors.newCachedThreadPool(); AtomicityTest at = new AtomicityTest(); exec.execute(at); while(true) { int val = at.getValue(); if (val % 2 != 0) { System.out.println(val); ...
01030d16-974e-43d1-af53-6940a03c6a29
1
private void printlnError(Object o) { if (errorLogWriter != null) { errorLogWriter.println(o); } }
6b2ee03e-a6ad-4a3e-a15a-12f253fd8fbc
6
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked //Pega o nome da pasta selecionada e retira a última '/' String caminho = XMLTreePanel.getCaminhoSelecionado(false); caminho = caminho.substring(0, caminho.length() - 1); String nome_...
7a298e85-37df-4692-b286-ff91ea7a9f0f
8
public String wrapper(String content) { if (content == null) return ""; String spanStart = "<span style=\"background-color: yellow;\">"; String spanEnd = "</span>"; String result = content; String keyWord = this.keyWord.toLowerCase(); int position = 0; while(true) { if (position >= result.length()) ...
ef8c38d5-a1a9-402c-82d5-cd0f99816bc0
2
private void moreFood(){ synchronized(envi.lock_food){ food_count = envi.getFood().size(); int count = 0; while(count < 5){ envi.addFood(); food_count++; count++; if(food_count == food_needed){ break; } } } }
ceb97cd7-bae0-416f-99df-7b91eff60e07
6
@Override public void handleBeforeOp(int currentAddress, OpCode opCode, int opData, CPUState s) { if(currentAddress == 0x242) s.loadedBank = 0x1; if(currentAddress == 0x2dc9) s.loadedBank = 0x1; if(currentAddress == 0x2e1a) s.loadedBank = 0x1; if(currentAddress == 0x351b) s.loadedBank = 0x9; if(c...
6b37f506-aafc-4977-9899-8a5083e83273
4
public Integer getScore(ScoreType scoreType) throws UnexpectedTypeException { if (scoreType == ScoreType.FIRST) { return ball[0]; } if (scoreType == ScoreType.SECOND) { return ball[1]; } if (scoreType == ScoreType.THIRD) { if (!isFinalFrame()) { throw new UnexpectedTypeException(); } retu...
ab767c76-4960-448c-b111-92b36d9d3960
0
public FootprintScheduler(int numRounds) { this.numRounds = numRounds; desiredSlots = new boolean[numSlots]; Arrays.fill(desiredSlots, true); chosenSlots = new boolean[numSlots]; random = new Random(); refreshFootprints(); }
189a6e90-0868-49fc-bbe7-a20f4a156ee3
2
@Override public void Handle(byte[] message, Server server, IOClient player) { Player p; if (player instanceof Player) p = (Player)player; else return; try { byte[] name = new byte[message.length - 1]; System.arraycopy(message, 1, name, 0, name.length); String m = new String(name, "US-ASCII").tr...
0ea62859-79db-42db-a79c-ae025c12a8b9
9
private boolean aggregate(char entryCharacter, char exitCharacter, boolean prefix) { if (c != entryCharacter) return false; nextCharacter(); skipWhiteSpace(); if (c == exitCharacter) { nextCharacter(); return true; } for(;;) { ...
74c9e5a8-fc01-4d00-a375-fe75ca67d17f
3
public Polynomial nthDerivative(int n){ Polynomial dnydxn; if(n>this.deg){ dnydxn = new Polynomial(0.0); } else{ dnydxn = new Polynomial(this.deg-n); double[] nc = new double[this.deg...
f1d21efe-f75f-4d51-a145-7f6c6c9cfe9c
6
public String toString() { String sign, strIm, strRe; double absIm = Math.abs(im); if (im < 0) sign = " - "; else sign = " + "; if (re % 1 == 0 && im % 1 == 0) { strRe = Integer.toString((int) re); strIm = Integer.toString((int) absIm); } else if (re % 1 == 0) { strRe = Integer.toString((int...