method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c2dab171-ef9b-42c8-8ffd-d852334a1af6
1
public void creer_messages(CSVFile monFichier) { int i =1; while(!monFichier.getData(i, 0).isEmpty()){ int id = Integer.decode(monFichier.getData(i, 0)); int date = Integer.decode(monFichier.getData(i, 1)); int taille = Integer.decode(monFichier.getData(i, 2)); mess_en_cours = message_en_cours(id, ...
229ec1cb-e39a-4a76-9b22-2671b20e55f6
8
public ArrayList<Financeiro> consultarFinancas(String situacao){ ArrayList<Financeiro> financas = new ArrayList<>(); try { if(situacao.equals("")){ String sql = "SELECT * FROM tb_financeiro"; ConsultarSQL(sql,true); while (rs.nex...
5ace4cf0-b163-4d3b-b9ad-cfa07258a2ae
5
@Override public int altaEmpleado(Empleado empleado) { empleado.setIdEmpleado(-1); EntityManager em = null; EntityManagerFactory ef = null; try { ef = Persistence.createEntityManagerFactory("MerkaSoftPU"); em = ef.createEntityManager(); ...
16655bb2-58ec-411b-8e7c-e7dbbb6a587b
0
@Override public int add(int a, int b) { return a + b; }
2d00e35a-a37a-4939-bfe4-3dd96b57dbf1
6
private boolean r_postlude() { int v_1; int v_2; int v_3; // (, line 455 // not, line 456 { v_1 = cursor; lab0: do { // (, line 456 ...
7dc23f4b-b275-463b-844d-36d8138072fe
5
public static boolean select(CommandSender sender, String[] arg) { if (!(sender instanceof Player)) { sender.sendMessage(ChatColor.GOLD + "[CK] " + ChatColor.RED + "You cannot use that command in the console."); return true; } Player player = (Player)sender; if (player.isOp() || player.hasPermission("co...
05dcfd10-0631-4495-b366-0a310a3230ed
9
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { int var6 = par1World.getBlockMetadata(par2, par3, par4); boolean var7 = false; if (var6 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) { var7 = true; } ...
8412ee18-8cf3-45ec-b43c-8e040ddb0ea5
9
void compress(int init_bits, OutputStream outs) throws IOException { int fcode; int i /* = 0 */; int c; int ent; int disp; int hsize_reg; int hshift; // Set up the globals: g_init_bits - initial number of bits g_init_bits = init_bits; // Set up the necessary values clear_fl...
75168e34-3be5-4a46-82b0-1568219dd40c
5
public void addAddress(HashMap<String, String> adr) { if(adr.containsKey("countryCode")) this.countryCode = adr.get("countryCode"); if(adr.containsKey("state")) this.state = adr.get("state"); if(adr.containsKey("street1")) this.street1 = adr.get("street1"); if(adr.containsKey("street2")) this.street2 = adr.get(...
ced4581a-e077-4d2d-b16d-9d454146462d
5
public Number readPackedNumber() throws IOException { int b = this.read(); if (b < 251) { return b; } else if (b == 251) { return null; } else if (b == 252) { return (long) readInteger(2); } else if (b == 253) { return (long) readIn...
e9988e2b-16da-48a3-99a0-d60c38df39a4
4
public boolean collidesWith(Rect2 other) { // System.out.println("First: 2l:" + other.getLeft() + ", 1r:" + this.getRight()); // System.out.println("Second: 2r:" + other.getRight() + ", 1l:" + this.getLeft()); // System.out.println("Third: 2t:" + other.getTop() + ", 1b:" + this.getBottom()); // ...
0245b75a-c8bb-43f7-9a69-1b0c224e5f9e
7
public Direction getMove(Simulation sim){ valid.clear(); if (sim.getTime() < DrivingRange.BALL_DIST_AVG){ return Direction.DOWN; } // find the max int max = 0; for (int i = 0; i < dirs.length; i++){ int val = getAdjacentBalls(sim, dirs[i]); if (val > max){ max = val; } } // find...
c45e3db9-373e-4ab7-91bb-5a3524f9f8cf
4
public boolean isEncrypted(String statFilePath) { // quick read of metadata to look for MAC; needs improvment try { SAXBuilder builder = new SAXBuilder(); File statFile = new File(statFilePath); Document document = (Document) builder.build(statFile); Elem...
0292d5fb-07d7-4a4d-aba2-071eb333a5f1
5
public static void floyd() { for (int i = 0; i < nodes; i++) dis[i][i] = 0; for (int k = 0; k < nodes; k++) for (int i = 0; i < nodes; i++) for (int j = 0; j < nodes; j++) if (dis[i][j] > dis[i][k] + dis[k][j]) dis[i][j] = dis[i][k] + dis[k][j]; }
a64b6b49-8bd7-43ea-8548-9bef3202d16b
8
@Override public void actionPerformed(ActionEvent e) { try { Thread.sleep(500); } catch(InterruptedException ex) { } switch(e.getActionCommand().charAt(0)) { case 'l': { AreaSelection.enable(); break; } case 's': { ScreenCapture.captureScreen(Util.getGraphicsDevice()); break; }...
19ce8241-1e3c-4e71-a285-137e24f8e578
1
@Override public void draw() { super.draw(); if(text != null) { Text.drawString(text, getBounds().getX(), getBounds().getY(), getTextModifier()); } }
fa436503-e7a7-4a45-99db-dd1ef8215473
8
public int compare(String o1, String o2) { //if (!(o1 instanceof String) || !(o2 instanceof String)) //{ //return 0; //} String s1 = (String)o1; String s2 = (String)o2; int thisMarker = 0; int thatMarker = 0; int s1Length = s1.length(); ...
29839524-ed22-4af2-bd67-3f8cceec4059
0
public Bishop(boolean isWhite, ImageIcon imgIcon) { super(isWhite, imgIcon); this.setIcon(); }
b9415b59-3747-4f1f-94df-f00d30d68c32
3
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked String usernameadd = DescField51.getText(); String passwordadd = DescField55.getText(); String subject1 = (String) jComboBox2.getSelectedItem(); String subject2 = (String) jComboBox3...
57d400c9-9bfd-4b87-85d1-db4d8b7db103
5
public static Connection createConnection() { if (conn == null) { try { Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection(url, login, password); } catch (ClassNotFoundException e) { System.out.println...
b3e4dc8e-5cb1-4a19-a57f-ef0b9311f84b
2
public static void mutePlayer( String target ) throws SQLException { BSPlayer p = getSimilarPlayer( target ); boolean isMuted = isPlayerMuted( target ); if ( p != null ) { if ( isMuted ) { p.setMute( false ); p.sendMessage( Messages.UNMUTED ); ...
900402b5-e0c7-40d2-8f2f-9af11cf4eac0
8
@Override public void actionPerformed(ActionEvent e) { if(e.getSource() == comboBox ){ if(comboBox.getSelectedIndex()!=0){ int room_type_id = 0; room_type_id = roomTypeMap.get(comboBox.getSelectedItem()); RoomRateDataSource rrDS = new RoomRateDataSource(); RoomRate rr = new RoomRate(); ...
afedfdb1-5521-4ab4-b277-3b52e38d2a9a
8
public static void processInput( Camera camera, Controller controller ) { if ( Input.isBindingActive( "unbindMouse" ) ) { Mouse.setGrabbed( false ); } if ( Input.isBindingActive( "bindMouse" ) ) { Mouse.setGrabbed( true ); } if ( Input....
99fd8b49-7823-465f-a29e-4ef47e80e7d1
4
public void loadJars() { //String pathSeperator = System.getProperty("file.separator"); File folder = new File(getApplicationPath() + "plugins"); if (!folder.exists()) folder.mkdir(); for (File f : folder.listFiles()) { System.out.println("Working at file : " + f.getAbsolutePath()); if (f.getName().end...
c3b7a53c-83d2-4817-8248-968624d2df0f
9
public void printTree() { Node root = head.getRight(); if (root == nullNode) { return; } Stack<Node> globalStack = new Stack(); int emptyLeaf = 32; boolean isRowEmpty = false; globalStack.push(root); while (!isRowEmpty) { Stack<No...
68630923-cdd2-4074-9081-26c902b18f66
8
public void loadLunchPrefs() { periodsFS = secondaryDataBase.amountOfPeriods; // getLunchPref boolean[][] lda = new boolean[secondaryDataBase.lunchPrefs.length][secondaryDataBase.lunchPrefs[0].length]; for (int i = 0; i < lda.length; i++) { for (int b = 0; b < lda[0].length; b++) { lda[i][b] = secondary...
57baf33d-1faa-4db1-aa22-ed0dd373473a
8
public static ArrayList<String> getPaymentStatusKickboxing(Member member){ ArrayList<String> paymentDefaults=new ArrayList<String>(); paymentDefaults.add("Payments from "+member.getName()+":"); Calendar c=Calendar.getInstance(); Calendar minusYear=Calendar.getInstance(); minusYear.add(Calendar.YEAR,-1); ...
3fec3bdb-02e9-4e93-9284-28f62912fdf0
6
protected OutputStream streamTopiaryGraphics(File file, String filetypeName, Graphics2DStreamThunk thunk) { Writer writerOut = null; OutputStream streamOut = null; try { // If we are not layed out we need to be if (!layedOut) { layout(); } // Paint onto t...
c11adb92-e110-435e-93c6-84151c4086b7
8
public static void setJuego(String nombre_juego) { Juego.nombre = nombre_juego.toLowerCase(); Vector<Character> mapaDomino = new Vector<Character>(); if (null != Juego.nombre) { switch (Juego.nombre) { case "gato": Juego.filas = 3; ...
1eaef6b7-d294-489f-a8c1-37acc5b5f133
0
@Override public void windowOpened(WindowEvent e) { }
23462afd-2e50-4a13-81b5-fe919c6c7a2f
8
@Override public void keyPressed(KeyEvent event) { Selection selection = mModel.getSelection(); boolean shiftDown = event.isShiftDown(); int index; switch (event.getKeyCode()) { case KeyEvent.VK_LEFT: index = selection.firstSelectedIndex(); while (index >= 0) { mModel.getRowAtIndex(index).setOp...
e4b5f8b6-c756-494f-930b-f8b2a7a4e1f0
9
private boolean pitUnAltered(String data) { System.out.println("pitUnAltered()"); boolean un = false; ///PitObs pit_current = null; avscience.ppc.PitObs pit = new avscience.ppc.PitObs(data); String name = pit.getName(); String ser = pit.getSerial(); System.out.pri...
176bef2d-6c7f-4351-b625-caa4a0390431
1
@Override public void update(T entity) throws DaoException { if (entity.getId() == 0) { throw new DaoException("id = 0, not update!!"); } waitCompete(); getEntities().put(entity.getId(), entity); }
0d13d7fd-babd-4df0-b205-c90d7dfc7cf7
7
public LinearMultivariateRealFunction getObjectiveFunction() { if(objectiveFunction == null) { double[] goodPriceQVector = new double[db.tools.size()]; for(Tool tool : db.tools) { goodPriceQVector[db.toolIndexById.get(tool.getId())] = 0; ...
d8b4f61f-c2fc-4201-8822-d9a9dd23991e
6
public String excecuteCommands(Object object) { String command = null; Scanner inFile = Connect4.getInputFile(); do { try { this.display(); //displays the menu //get input command = inFile.nextLine(); command...
766b6b9f-3f77-46ab-b794-de2b3ff5e48b
4
public synchronized void add(Contact contact) { consecutiveFailures = 0; if (contact.getNodeId().equals(localNode.getNodeId())) { // The local node cannot be added to the route table //throw new IllegalArgumentException("Cannot add the local node to the route table"); return; } NodeId nodeId = co...
e400bab8-49a0-4d49-b418-22a5cd94636c
3
@Override public void caseASeComando(ASeComando node) { inASeComando(node); if(node.getElseParte() != null) { node.getElseParte().apply(this); } { List<PComando> copy = new ArrayList<PComando>(node.getComando()); Collections.reverse(cop...
f1fc25ed-cc23-4fff-ac20-4cb5cf65ac1f
7
static void dradf4(int ido, int l1, float[] cc, float[] ch, float[] wa1, int index1, float[] wa2, int index2, float[] wa3, int index3){ int i, k, t0, t1, t2, t3, t4, t5, t6; float ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4; t0=l1*ido; t1=t0; t4=t1<<1; t2=t1+(t1<<...
a2c587d4-a5d9-44d7-a497-0d093ba4788c
5
private static BitSet buildVersion( String versions, boolean hint ) throws Exception { BitSet bs = new BitSet(); if ( hint ) bs.set( 0 ); String[] parts = versions.split(","); for ( int i=0;i<parts.length;i++ ) { if ( parts[i].indexOf('-') != -1 ) { String[] subParts = parts[i].split("-"); ...
c306c4b6-6dcf-43ae-8765-3d2f01c58b3d
7
public List<String> getImageNames() { ElementIterator it = new ElementIterator(getDocument()); AttributeSet as = null; Element el = null; Enumeration en = null; List<String> list = null; String s = null; Object obj = null; synchronized (getDocument()) { while (it.next() != null) { el = it.current...
10142d92-576e-4f60-b0b9-e59d43418736
8
public static String ciudad(int idCiudad) { switch(idCiudad) { case 1: return "Medellín"; case 2: return "Bogotá"; case 3: return "Calí"; case 4: return "Barranquilla"; case 5: return "Buscaramanga"; case 6: return "Pasto"; case...
f6ac8837-a260-444a-abdb-0d9a392aad27
1
@Override public Label predict(Instance instance) { if (MathUtilities.innerProduct(linearParam, instance) > 0) { return new ClassificationLabel(1); } return new ClassificationLabel(0); }
9282c54a-ba90-4d0c-8625-e388813a115e
1
public TrueFalse(boolean needsAnswer){ prompt = InputHandler.getString("Enter the prompt for your True/False question:"); if (needsAnswer){ setCorrectAnswer(); } }
ede820a8-0ade-4e69-9d8e-d4e002b0cdea
0
public static void TLobby() { currentRoomName = "T-Lobby"; currentRoom = 3; RoomDescription = "As you close the wooden door behind you, you are rushed with a sense of fear from the sound of a " + "shotgun and the intense wind coming from the eastern doorway."; }
22b7809c-f4a3-4c2b-a7c4-7992fcb529a0
4
public void WriteWildyLevel() { checkwildy2(); int oldlevel = WildyLevel; WildyLevel = (((absY - 3520) / 8) + 1); if(inwildy2 && WildyLevel != oldlevel) { outStream.createFrame(208); outStream.writeWordBigEndian_dup(197); sendQuest("Level: "+WildyLevel, 199); sendFrame126(" "+specbar, 180); leftwild = 1; } else ...
e1840af7-dd08-4fd6-bb97-c8280977f172
1
public static void HTMLReports() { FileWriter fstream =null; BufferedWriter out =null; try { fstream = new FileWriter(filename); out = new BufferedWriter(fstream); //String ENVIRONMENT = env;//SeleniumServerTest.ConfigurationMap.getProperty("environment"); //String RELEA...
e53a4f14-25d2-4739-a1c1-0117b1a9dc6e
8
@PUT @Path("/{isbn}") @Timed(name = "update-book") public Response updateBook(@PathParam("isbn") LongParam isbn, @QueryParam("status") String status) { Book book = null; //Update the status if(status!= null || status.equalsIgnoreCase("")) { book = bookRepository.getBookByISBN(isbn.get()); if (book == nu...
6641e11d-a008-4722-9b54-32a04793a589
4
public String currentValue(String sensor_id) throws NotFoundException, IllegalAccessError, NonReadableChannelException, SocketTimeoutException { try { clientSocket.Escribir("GET_VALACT " + sensor_id + '\n'); serverAnswer = clientSocket.Leer(); } catch (IOException e) { throw new SocketTimeoutException(); ...
593c44a0-9112-4631-a4be-5e8a2d6430cc
1
public void remove(int i) { if (i < names.size()) { // Remove from model names.remove(i); finds.remove(i); replaces.remove(i); ignoreCases.remove(i); regExps.remove(i); // Remove from JList ((DefaultListModel) Outliner.findReplace.FIND_REPLACE_LIST.getModel()).removeElementAt(i); } else ...
d54c0e57-7468-4363-9324-1a07a8f87fa3
8
public boolean canFocusOn(MOB officer, MOB criminal) { final CMMsg msg=CMClass.getMsg(officer,criminal,CMMsg.MSG_LOOK,L("<S-NAME> look(s) closely at <T-NAME>.")); if((officer!=null)&&(officer.location()!=null)&&(criminal.location()==officer.location())) { if(!officer.location().okMessage(officer,msg)) ret...
d92db690-9169-45fd-b5d6-c0aa8c99d97a
9
public void move(int delta) { if (this.ennemy) { /*if (this.life < 2) { this.orientationX = Util.getReverseOrientation(this.orientationX); this.orientationY = Util.getReverseOrientation(this.orientationY); }*/ if (this.orientationY == 1) this.y += (int) -(delta * this.speedY) / 2; else if ...
bfe2f0b5-24a9-4448-824b-15bc94bf4392
9
public static String pad(String s) { if (s.length() == 0) return " "; char first = s.charAt(0); char last = s.charAt(s.length()-1); if (first == ' ' && last == ' ') return s; if (first == ' ' && last != ' ') return s + " "; if (first != ' ' && last == ' ') return " "...
472f492b-de50-4a07-9c6f-1db0315f24e7
8
public void checkWin() { for(int i = 0; i < maxPlayers; i++) { boolean win = true; for(Planet p : board) { if(!(p.getOwnerId() == i || p.getOwnerId() == -1)) win = false; } if(win) System.out.println("Someone's in trouble"); for(PendingAttack pa : attackQueue.toArray(new PendingAttack[0])...
f1f99bef-5fd5-408d-b57f-a5616dd8fcf4
0
public void retraitListe(int rangee) { listeMetadonnees.remove(listeMetadonnees.get(rangee)); }
0dcdb61a-4c71-4d8a-9541-a1a78e94c0ca
1
private int score(int[] bowl){ int sum=0; for(int i=0;i<12;i++){ sum+=pref[i]*bowl[i]; } return sum; }
4562815e-b0a6-4c24-bdf2-ccf817ad53e2
4
private void updateRosterList() { availableRosters = 0; if ((rosterListModel == null) || (MainWindow.rosterDB == null)) return; rosterListModel.removeAllElements(); for (Roster r: MainWindow.rosterDB.getRosters()) { if (r.isAvailableAt (targetDay.getTime())) { rosterListModel.addElement( new Ros...
cdd7f984-566c-4e87-b951-0e2504a8bec2
8
public void getGUI(){ //JPanel p3; GroupLayout groupLayout; GroupLayout.ParallelGroup horizontalContentGroup_P; GroupLayout.SequentialGroup verticalGroup_S,horizontalGroup_S; //p3 = new JPanel(); this.setName(Q_ID+""); //p3.setLayout(ne...
6171f3cd-5607-4995-a6c3-bdc525e3ab12
2
@Override public void serialize(LocalDate localDate, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { String isoFormat = localDate.toString(); if(isoFormat == null || isoFormat.isEmpty()) return; jsonGenerator.w...
f695cf10-44f4-447d-947f-f56a5cad555a
5
public static Record getQuizCreatedRecordByXMLElem(XMLElement root) { User user = null; Quiz quiz = null; for (int i = 0; i < root.childList.size(); i++) { XMLElement elem = root.childList.get(i); if (elem.name.equals("user")) { user = User.getUserByUsername(elem.content); } else if (elem.name.equals...
9ef29177-f075-4bd3-bcd7-e5ff91792afc
1
public void getCellData() { Iterator itr = prop.entrySet().iterator(); int i = 0; int j = 0; while (itr.hasNext()) { Entry e = (Entry) itr.next(); cellData[i][j] = e.getKey().toString(); j++; cellData[i][j] = e.getValue().toString(); ...
06f50546-f57f-4f04-a87e-505079596d7e
1
public void applyPreserveRule(IdentifierMatcher preserveRule) { if (loadOnDemand) loadMatchingClasses(preserveRule); super.applyPreserveRule(preserveRule); }
e823761e-a178-477c-b223-ed61491bb283
0
public void setPictureInventoryList(ArrayList<Boolean> pictureInventoryList) { this.pictureInventoryList=pictureInventoryList; }
e36ba83a-c586-495c-9fff-374fd9d8f876
6
public static int getInt(String message, boolean borne) { int nombre; String input; while((input = JOptionPane.showInputDialog(message)) != null) { try { nombre = Integer.parseInt(input); if(borne) { if(nombre >= AMIN && nombre <= ...
6459be7e-e689-40f4-84cc-31667b0ca0a6
5
public void findArticulationPoints() { for (Intersection i : intersections) { i.depth = Double.POSITIVE_INFINITY; } this.articulationPoints = new HashSet<Intersection>(); Intersection start = intersections.get(0); start.depth = 0; int numSubtrees = 0; ArrayList<Intersection> neighbours = getNeighbour...
037b3864-b1ab-4d89-bfc0-cc2dff73b10d
7
private boolean checkValidFeedbackInput(String feedback){ if (feedback.length() != 2) { return false; } int CL = (Integer)this.state.get(CODELENGTH); int b = feedback.charAt(0) - '0'; int w = feedback.charAt(1) -'0'; if (!(b <= CL && b >= 0) || !(w <= CL && w >= 0) || !(b+w <=CL && b+w >= ...
c26568d8-863e-4262-bcee-b9d41e762004
2
public ArrayList<String> getTablespaces(){ ArrayList<String> ts=new ArrayList(); for(int i=0;i<tablespaceT.getRowCount();i++){ boolean check = (boolean)tablespaceT.getValueAt(i, 1); if(check){ ts.add((String)tablespaceT.getValueAt(i, 0)); } } ...
76eccaf4-8a7f-447e-88f6-48702cea0c34
4
public void loadCreatureSprites() { Image[][] images = new Image[360][]; // load left-facing images images[0] = new Image[] { getSmallerImage(loadImage("2ship1.png"), .5f), getSmallerImage(loadImage("2ship2.png"), .5f), getSmallerImage(loadImage("2ship3.png"), .5f...
a75687fe-2ec3-4cb3-853e-c57b7e5511c6
1
public void showHand(){ for (int i=0;i<hand.size();i++) System.out.println(hand.get(i).getFQN()); }
783cc5f9-0527-481d-a618-03c17b38b1a3
7
@Before public void setUp() throws Exception { xmlPageFile = new File("c:/junit/page.xml"); if (!xmlPageFile.exists()) throw new Exception("Page XML file not found: "+ xmlPageFile.getPath()); largeXmlPageFile = new File("c:/junit/largePage.xml"); if (!largeXmlPageFile.exists()) throw new Exception("Pa...
443d7b5f-71eb-4c1e-acd7-79c67002f693
8
public void placePiece(int t, int x, int y){ if (isEmpty(x,y) && t == 1) { jMan = new JMan(x,y,JManApp.rand(0,2)); board[x][y] = jMan; } else if (isEmpty(x,y) && t == 0) { Block block = new Block(x,y,Color.WHITE); board [x][y] = block; } ...
671d1feb-862a-45a3-a63d-71958dbc61d2
9
private void checkGameOver() { int x,y; boolean gameOver = false; Snake snake = model.getSnake(); ArrayList<SnakeSegment> tempSnake = snake.getSegments(); x = tempSnake.get(0).getX(); y = tempSnake.get(0).getY(); //Checks whether or not the head of the snake has crashed in //to its own body for(Snake...
e3e90e04-e4a2-4cf0-9c53-06c3f0737729
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...
dcefce12-238f-41c8-861c-22c5e31e022a
8
public static void main(String[] args) { if (args.length == 0) { try { LauncherImpl.launchApplication(SuperMarioPaint.class, SplashScreen.class, args); } catch (Exception e) { e.printStackTrace(); } } else if (ar...
569ae334-d594-4d2d-a5c5-1a5e1c39856b
8
private void actualizeTable() { _lastUsedPreferences.addPreferenceChangeListener( new PreferenceChangeListener() { public void preferenceChange(PreferenceChangeEvent evt) { // Knoten hinzugefügt -> Zeile in der Tabelle hinzufügen! if(evt.getKey().equals("node") && !evt.getNewValue().equals("")) {...
5c638ff1-0166-433c-a6e4-986f304ebca2
7
public int edmons_karp(int s, int t) { int u, e; mf = 0; this.s = s; Arrays.fill(p, -1); while (true) { f = 0; Queue<Integer> q = new LinkedList<Integer>(); int[] dist = new int[V]; Arrays.fill(dist, INF); dist[s] = 0; q.offer(s); Arrays.fill(p, -1); while (!q.isEmpty())...
3cca370a-e948-4bb5-a61d-60544dfada28
6
@Override public boolean equals(Object o) { if (!(o != null && o instanceof Spatial)) return false; Spatial s = (Spatial) o; return s.x == x && s.y == y && s.height == height && s.width == width && s.rotation == rotation; }
abe876a1-fccb-4203-bd5c-d2b012c30c30
6
public Date getServerDate(int port){ Date date = null; if(port == LOGIN_PORT || port == CHAT_PORT){ try { String serverAddress = (port == LOGIN_PORT ? SERVER_ADDRESS_LOGIN : SERVER_ADDRESS_CHAT); Socket socket = new Socket(serverAddress, port); socket.setSoTimeout(TIMEOUT); OutputStream...
5ebfb1fd-f0bd-4864-b394-68f8a6e0d2bd
0
public static BeerResponse createBeerResponse(Beer delegate) { return new BeerResponse(delegate); }
0fa2d27d-feec-4c07-b37f-facbd735015f
3
void updateActiveHighlight() { boolean active = UIUtilities.getSelfOrAncestorOfType(KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner(), DockContainer.class) == this; if (mActive != active) { mActive = active; mHeader.repaint(); if (mActive) { Dockable dockable = getCurrentDo...
327dcbcc-bc8f-42ee-b22d-f5bd2f7bc333
4
@Override public void run() { try { if (debug) Gpr.debug("Running thread"); connect(); if (debug) Gpr.debug("Thread finished"); } catch (Throwable t) { if (debug) t.printStackTrace();; // Do nothing if it fails } }
e3e590b1-e784-46b1-908f-326635868a2f
1
public CouldNotOpenSocketToServerException(SocketException e) { super("Could not open socket to server" + (e == null ? "." : "--" + e.getMessage())); wrappedException = e; }
ad64e645-4e91-488a-9d99-f9bca22e1c13
6
public SpecialDeck(Hand hand) { deck = new Vector<Card>(); // initialize the empty vector for (int x = 0; x < suites.length;x++) for(int y =2;y < values.length;y++){ Card tempcard = new Card(suites[x],values[y]); int addit = 0; for (int i = 0; i < hand.size(...
3c8e239f-69f2-4f23-9080-801408699a62
2
private String parseList (@SuppressWarnings("rawtypes") List l) { if (l.isEmpty()) { return ""; } else { StringBuilder s = new StringBuilder(); for (Object o : l) s.append (", ").append (firstLetterUppercase (o.toString())); return s.substring (2); } }
9cfcfffc-2fac-4923-8f4a-002359b58df8
4
private Material loadMaterial(String textureFile, ColorRGBA diffuse, ColorRGBA ambient, ColorRGBA specular, float shininess) { Material mat = new Material(assetManager, PHONG_SHADER); mat.setBoolean("UseMaterialColors", true); mat.setTexture("DiffuseMap", assetManager.loadTexture("Textures/" + ...
863c30a2-23d9-4e3a-a416-26717272312a
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; OamEntry other = (OamEntry) obj; if (!Arrays.equals(data, other.data)) return false; return true; }
0dc12e46-1398-4c71-9c46-2debb2a8f38f
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...
7a30709a-3db6-486b-b523-09d877f7765d
8
public int getValue() { int status = 0; status |= (negative ? 0x80 : 0); status |= (overflow ? 0x40 : 0); status |= (direct_page ? 0x20 : 0); status |= (break_flag ? 0x10 : 0); status |= (half_carry ? 0x8 : 0); status |= (indirect_master ? 0x4 : 0); status |= (zero ? 0x2 : 0); status |= (carry ? 0x1 :...
400ca241-a2b3-4846-a5db-d2c76a64e35f
1
public void testSetYears() { MutablePeriod test = new MutablePeriod(1, 2, 3, 4, 5, 6, 7, 8); test.setYears(10); assertEquals(10, test.getYears()); test = new MutablePeriod(1, 2, 3, 4, 5, 6, 7, 8); test.setYears(-10); assertEquals(-10, test.getYears()); ...
81caa202-a31a-403b-80a6-ff340d3d2ef8
2
public static Combinaison parseCombinaison(String combinaisonADecouper) { Pion[] pions = new Pion[combinaisonADecouper.length()]; for(int numeroDuPion = 0; numeroDuPion < combinaisonADecouper.length() ; numeroDuPion++) { Couleur couleur = Couleur.parseCouleur(combinaisonADecouper.charAt(numeroDuPion)); ...
3a80c927-7c6e-435a-8d3e-928984eb0c94
0
public static void main(String[] args) { // TODO code application logic here Main sms = new Main(); sms.display(); }
90ffe85e-e981-475f-b8e8-62f12826f35b
8
private void checkForSnakeCollisions() { //TODO Refactoring Snake snakeOne = snakes.get(0); Snake snakeTwo = snakes.get(1); boolean collisionSnakeOneWithItself; boolean collisionSnakeOneWithSnakeTwo; boolean collisionSnakeTwoWithItself; boolean collisionSnakeTwoWithSnakeOne; SnakePiece headOne = sna...
22e23be7-7dc1-4d46-be4e-0145c344ffd1
5
@SuppressWarnings("unchecked") public void setUpBeforeClass() throws Exception { // settings String ChromeDriverPath = "driver\\chromedriver.exe"; String application_url = ""; String browser = ""; //框架开始前先读取测试用例并生成XML格式用例 ReadExcel re = new ReadExcel(); re.readExcel(); CreateXML.generateXmlFile(); ...
85e24b29-9f2c-4679-b354-800beba20c5e
4
@Test public void testDijkstra() { for (int i = 100; i < 4000; i+= 100) { Graph g = RandomGraph.quick(i); System.out.print("|V| = " + g.getVertices().getSize() + " |E| = " + g.getEdges().getSize() + ": "); double startTime; double endTime; dou...
32988c01-cbcc-4557-8ff2-d63bd7fcd35e
1
public ChatServerThread(Socket socket, UserAccount account, ChatServerChatRoom chatRoom, ChatServerMain chatServer){ user = account; this.chatRoom = chatRoom; this.chatServer = chatServer; /* Create the I/O variables */ try { this.out = new PrintWriter(socket.getOut...
cf22d397-40bd-4655-bd1c-973641876bb9
3
private void submitGridlet(int id, long submitTime, int runTime, int numProc) { // create the gridlet int len = runTime * rating_; // calculate a job length for each PE Gridlet gl = new Gridlet(id, len, size_, size_, GridSim.isTraceEnabled()); gl.setUserID( super.get_id() ); /...
4f71ef58-bbf1-44e3-9651-e89ee3aa8433
2
public void setActifJoueur(int numeroJoueur) { // activation du clignotement clignotementJoueur.stop(); ActionListener[] vieuClignotement = clignotementJoueur.getActionListeners(); if(vieuClignotement != null) { for(int i=0;i<vieuClignotement.length;i++) { clignotementJoueur.removeActionListener(vieuC...
81f80191-116c-40a3-bf0a-79fb218a9d39
9
public boolean coupAutoris(Action a, Joueur j) { String tmp = (String) a.getAction(); StringTokenizer st = new StringTokenizer(tmp); int count = 0; int coord[] = new int[6]; while (st.hasMoreTokens()) { coord[count] = Integer.parseInt(st.nextToken()); count++; } int x, y, z, i, j1, k; x = coord[0]...
afce2b9b-4256-4493-97af-7ad3b45c026a
1
private Map<String, Object> getModelData(String logformat){ Map<String, Object> map = new HashMap<String, Object>(); JSONObject model = getModel(logformat); try{ JSONArray itemList = model.getJSONArray("items"); String format = model.getString("format"); map.put("items", itemList); map.put("format"...
bbf8b454-1aff-45c2-a487-95d7c8477d11
9
public static void getTechnicalMatureRateData(IndicatorParam param) { try { System.out.println("getTechnicalMatureRateData"); IndicatorData data = new IndicatorData(); data.indicatorType = param.indicatorType; System.out.println(param.keyWord); Hits hits = LuceneHelper.search(param.keyWord); Map<St...
c95517db-a998-463f-92bf-e76b09dd9e46
1
public static boolean GetMouseUp(int mouseButton) { return !GetMouse(mouseButton) && m_lastMouse[mouseButton]; }