method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b1a613e8-4f3e-4552-b27e-abd6d5dd95ab
1
private void testCode(String code, int... expectedOutput) { runner.run(code); final String output = baos.toString(); assertEquals(expectedOutput.length, output.length()); for (int i = 0; i < output.length(); i++) { assertEquals(expectedOutput[i], output.charAt(i)); ...
ed8f0944-c137-4da8-95f8-6a2dce0b494a
6
public static String stringPattern(String value){ String pattern = ""; for (int i = 1; i < Math.sqrt(value.length());i++){ StringBuilder strFirst = new StringBuilder(""); StringBuilder strSecond = new StringBuilder(""); StringBuilder strThird = new StringBuilder("")...
a0c8a192-b427-451c-98c3-684a441e04d1
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...
9fd184cb-feb7-429a-909c-ab7e1722c1a8
8
public Object getRemoteInterface(String nomEJB) throws ServicesLocatorException { // Le nom JNDI pour la récupération du service distant (stub du // composant EJB) est de la forme : // java:global/<nom projet EAR>/<nom sous-projet EJB>/<nom bean session EJB>!<nom complet avec package de l'interface remote du b...
68d0e4d9-3c0f-4421-be31-6cbe5856126e
3
@FXML public void action(ActionEvent event) { if(event.getSource().equals(buttonOk)) { String hpass = Hash.md5(editPass.getText()); if(editLogin.getText().equals("Компьютер")) Model.getIntance().getFirstUser().empty(); else Model.getIntance().g...
13adb593-8c91-4f7f-b0d3-338947b94f5f
6
public RandomListNode copyRandomList(RandomListNode head) { if (head ==null){ return null; } RandomListNode temp = head; while (temp!=null){ RandomListNode copy = new RandomListNode(temp.label); RandomListNode nextNode = temp.next; temp.nex...
444a3347-7c89-4e24-8602-6fa35cecdf4b
2
public void wechsleSpieler(Spieler s) { System.out.println("spieler wechseln"); if(s.fraktion.equals(spieler1.fraktion)) aktuellerSpieler = spieler2; else if (s.fraktion.equals(spieler2.fraktion)) aktuellerSpieler = spieler1; frame.getBeendenButton().doClick(); }
6f7133f3-51d1-4828-8c88-bce80a99027f
0
public void setRoomId(String roomId) { this.roomId.add(roomId); }
31b85df7-d89c-4583-b20b-d6f307b5204c
4
private void handleNetworkCommand(String[] args) throws IOException { if (pfactory.hasGameNetwork()) { if (args[0].equalsIgnoreCase("start")) { pfactory.sendStartGamePacket(Strategy.Standard, 1); } else if (args[0].equalsIgnoreCase("play")) { handlePlayCom...
a6807363-75ba-40df-9110-ac95e2caab43
3
public List<Utr> findUtrs(Marker marker) { List<Utr> utrs = new LinkedList<Utr>(); // Is it in UTR instead of CDS? for (Utr utr : utrs) if (utr.intersects(marker)) utrs.add(utr); return utrs.isEmpty() ? null : utrs; }
caaae46c-e21c-48f8-b8c0-5303c7392973
8
public Capabilities getCapabilities() { Capabilities result; Capabilities classes; Iterator iter; Capability capab; if (getFilter() == null) result = super.getCapabilities(); else result = getFilter().getCapabilities(); // only nominal and numeric classes allowed cla...
727c51ba-295e-4908-9ad9-00e893582f42
3
public int addTile(Tile t) { if (t.getId() < 0) t.setId(tiles.size()); if (tileDimensions.width < t.getWidth()) tileDimensions.width = t.getWidth(); if (tileDimensions.height < t.getHeight()) tileDimensions.height = t.getHeight(); tiles.add(t); ...
7830c99f-b2d6-4ccf-b512-f089d288e3c9
7
public Reply sendCommand(Command cmd) throws IOException { if (getConnectionStatusLock() == CSL_DIRECT_CALL) setConnectionStatus(BUSY); controlBuffer.clear(); //for the command PASS hide the password in created logfile if (cmd.getCommand().equals(Command.PASS)){ ...
f242085c-50b0-4551-8b45-faec130b8ac6
0
public static void question9a() { /* QUESTION PANEL SETUP */ questionLabel.setText("Which of these below do you like the most?"); questionNumberLabel.setText("9a"); /* ANSWERS PANEL SETUP */ //resetting radioButton1.setSelected(false); ...
92fbf9fd-d4b9-46c8-977f-5db46c3d4ef5
1
public void pota() { if (padre != null) padre.rimuoviFiglio(posFiglio); }
bc2ea5e3-9917-477c-b522-7b129fae2d75
6
private void addVertices(ArrayList<Vertex> vertices, int i, int j, float offset, boolean y, boolean z, boolean x, float[] texCoords) { if(x && z) { vertices.add(new Vertex(new Vector3f(i * SPOT_WIDTH, offset * SPOT_HEIGHT, j * SPOT_LENGTH), new Vector...
834ed6fc-9c92-49a7-9ba0-3e09b676af45
5
private void parseValue(String line, int lineNum) { // skip a comment line if (line.startsWith(COMMENT)) { return; } String[] sp = line.split("\\s+"); // split the fields based on a space int len = 0; // length of a string int index = 0; // the index of an array // che...
a2b7e2a8-e65a-4564-bc27-655ab153316a
1
private void close() throws BITalinoException { try { socket.close(); } catch (Exception e) { throw new BITalinoException(BITalinoErrorTypes.BT_DEVICE_NOT_CONNECTED); } finally { socket = null; } }
31a11310-14ad-41fb-8490-a4713a709d76
7
private void removeFullLines() { int numFullLines = 0; for (int i = BoardHeight - 1; i >= 0; --i) { boolean lineIsFull = true; for (int j = 0; j < BoardWidth; ++j) { if (shapeAt(j, i) == Tetrominoes.NoShape) { lineIsFull = false; ...
9ec0d5a0-1b47-4786-9ff8-d6de366091ee
9
@Override public void handleGameEvent(GameEvent e) { switch(e.type){ case COLLISION: break; case PLAYER_JUMP: System.out.println("Player jump"); break; case PLAYER_MOVE_DOWN: System.out.println("Player down")...
ada00c68-53df-4cdc-b7b9-1d1a79096072
0
public void updateUI(World w, Gameplay g) { hexgrid.updateGrid(w, g); }
7cf4a1b3-731f-4910-bb6d-a426751730d3
8
public double weightedStandardDeviation_as_double() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } boolean holdW = Stat.weightingOptionS; if (weightingReset) { if (weightingOptionI) { ...
4ebfa9dc-6f12-4030-aacb-35bc33b4a3b1
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...
44354092-518b-4400-bf09-73a1f280c078
3
public int linearRegAngleLookback( int optInTimePeriod ) { if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) ) optInTimePeriod = 14; else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) ) return -1; return optInTimePeriod-1; }
035b521e-d286-4094-ab5f-e84fa9b3b08e
2
public static void decodeFileToFile(String infile, String outfile) throws java.io.IOException { byte[] decoded = Base64.decodeFromFile(infile); java.io.OutputStream out = null; try { out = new java.io.BufferedOutputStream( new java.io.FileOutputStream(outfile)); out.write(decoded); } // end try ...
2469236c-6bb2-4739-8c27-c19cb5b015fc
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...
cf8baf8d-34da-4a92-b73c-ed2332d02df6
9
public String readChunk() throws IOException { StringWriter writer = new StringWriter(); int ich; int lastich = -1; for (ich = this.nextChar(); ich != -1; ich = this.nextChar()) { char ch = (char)ich; if (ch == ChunkDelimeter && lastich != -1) { ich = this.nextChar(); if (ich == -1 || ...
39f21957-aa46-43e1-a9d6-7609925ff1aa
8
public static void main(String[] args) { int max = 0; //all vertical for (int x = 0; x <= 16; x++) { for (int y = 0; y <= 19; y++) { int[][] coords = {{x,y},{x+1,y},{x+2,y},{x+3,y}}; max = Math.max(max, product(coords)); } } //all horizontal for (int x = 0; x <= 19; x++) { for (int y = 0; ...
09f708bb-b41e-44c4-b8b2-fb4cb78e727c
4
@Override public void paint(Graphics g) { if (state == GameState.Running) { g.drawImage(background, bg1.getBgX(), bg1.getBgY(), this); g.drawImage(background, bg2.getBgX(), bg2.getBgY(), this); paintTiles(g); ArrayList projectiles = robot.getProjectiles(); for (int i = 0; i < projectiles.size(); i++) ...
8dc7629c-2e27-4c3f-b32a-fe6ce865151e
4
public synchronized void poll() { // If relative, return only the delta movements, // otherwise return the current position... if (isRelative()) { mousePos = new Point(dx, dy); } else { mousePos = new Point(currentPos); } // Since we have polled, need to reset the delta // so the values do not accum...
f89d18b6-16f8-4631-a39f-78222a83946e
1
private File writeDotSourceToFile(String str) throws java.io.IOException { File temp; try { temp = File.createTempFile("graph_", ".dot.tmp", new File(GraphViz.TEMP_DIR)); FileWriter fout = new FileWriter(temp); fout.write(str); fout.close(); } catch (Except...
df2b3957-bac5-41e8-9a20-43209549b31f
6
private MBox createBox(int posX, int posY, char c) throws MazeException { MBox retour = new EBox(posX, posY); if (c == 'W') retour = new WBox(posX, posY); else if (c == 'E') { //variable deja initialise } else if (c == 'A') { if (grid.indexOf(new ABox(0, 0)) != -1) throw new MazeException("Deja une ca...
054fb2d7-596d-4395-b109-9420eb7e7161
7
public void pickUp(String object, ArrayList<String> inv) { if (object.equalsIgnoreCase("floor")) { System.out.println("You can't pick up the floor...\n"); } else if (object.equalsIgnoreCase("wall") || object.equalsIgnoreCase("walls")) { System.out.println("You can't pick up the w...
8753d250-e67e-4391-97c0-14c7cde70f0a
0
public String getTelefon2() { return telefon2; }
5e885a99-94a0-41fc-a7b6-4ed5cc0660bb
4
@Override public boolean equals(Object that) { if (this == that) { return true; } if (that == null) { return false; } if (getClass() != that.getClass()) { return false; } if (id != null) { return id.equals(((Player) that).id); } return super.equals(that); }
b7efcbf5-6cd8-45c3-a821-d82f9e67c685
3
private int jjMoveStringLiteralDfa14_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjMoveNfa_0(0, 13); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 13); } switch(curChar) { case 49: return jjMoveStringLiter...
befe9a83-86f8-4c37-a750-828bd19726f7
5
public Behaviour getNextStep() { if (! configured()) return null ; if (stage == STAGE_GET_SEED) { final Action collects = new Action( actor, nursery, this, "actionCollectSeed", Action.LOOK, "Collecting seed" ) ; return collects ; } if (stage == STAGE_PLANTING) {...
0fd2f248-404a-4a94-81a9-3d11dab0eaa7
4
public static HashMap<String, Object> parseMap(StringBuffer buf, int[] idx) { idx[0]++; HashMap<String, Object> into = new HashMap<String, Object>(); while (true) { skipSpace(buf, idx); if (idx[0] >= buf.length()) { System.err.println("Unexpected end"); return into; } if (buf.charAt(idx[0]) ==...
146ee5da-edd6-41b2-ae56-d82abcbbebc2
8
private boolean placeFire(int x, int y, position pos) { boolean firePlaced = true; ItemList items = field.getItems(x, y); ItemList itCopy = new ItemList(); itCopy.addAll(items); for (Item i : itCopy) { if (i instanceof Player) { Player p = (Player) i; p.die(); firePlaced = true; } else if (...
bca34bb7-6fa9-47e1-8f34-6aff33c28a78
5
public void draw(GOut og) { GOut g = og.reclip(tlo, wsz); Coord bgc = new Coord(); for (bgc.y = 3; bgc.y < wsz.y - 6; bgc.y += bg.sz().y) { for (bgc.x = 3; bgc.x < wsz.x - 6; bgc.x += bg.sz().x) g.image(bg, bgc, new Coord(3, 3), wsz.add(new Coord(-6, -6))); } cdraw(og.reclip(xlate(Coord.z, true), sz));...
8d6bcb15-ae58-4d3f-9110-6b40905fcec3
8
public final void parse(String options){ this.reset(); selectorFormat = options.replaceAll("\\s+", ""); String trimmed; if(selectorFormat.charAt(1)==this.bracketsOpen&& selectorFormat.charAt(selectorFormat.length()-1)==this.bracketsClose){ if(selectorFormat.ch...
3133c2f7-ae56-4bfb-a6f9-8a6f64c29040
6
@Override public boolean test(String value) { // TODO Auto-generated method stub if(value == null || value.length() == 0) return false; try { int sal = Integer.parseInt(value); if ((sal >= 500 && sal <= 20500)||sal==0){ return true; } } catch (Exception e) { // TODO: handle exception return ...
bf9cd8b0-f327-431c-84b3-0504b6bacef7
2
public void startLocalMultiplayerGame() { if (this.isActive) { if (JOptionPane.showConfirmDialog(null, "Are you sure?", "Restart game", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { this.endGame(); this.startGame(); } } else { this.startGame(); } }
daef1ca6-5cad-4eef-9b2c-76932e19ac1c
3
@Override public int compareTo(SingleCounter that) { final int BEFORE = -1; final int EQUAL = 0; final int AFTER = 1; // TODO Auto-generated method stub if (this == that) return EQUAL; if (this.value < that.value) return AFTER; if (this.value > that.value) return BEFORE; return EQUAL; }
bd8474ac-1091-41bc-b258-f68b6bc6f7f6
1
@Test(expected=BusinessException.class) public void partidoSinIniciarNoPuedeGenerarEquipos() { for (int i = 0; i < 3; i++) { inscribir(partidoPocosJugadores, new Jugador()); } partidoPocosJugadores.generarEquipos(); }
11d9406e-6162-4de8-af8d-a58ca9595c95
2
private static void addFocusArrowListener(JComponent jc) { /** * Check to see if someone already added this kind of listener: */ KeyListener[] listeners = jc.getKeyListeners(); for (KeyListener listener : listeners) { if (listener instanceof FocusArrowListener) { ...
1ceedce9-9d48-4181-9aea-08e93b4460da
0
@Override public StateModule getState() { return state; }
c826563e-6b62-4904-a457-679a4d8be3e4
9
public DbConfig(String dbName) throws IOException { dbProperties = new Properties(); String userHomeProperties = System.getProperty("user.home")+"/."+DB_PROPERTIES; try { if (new File(userHomeProperties).exists()) { dbProperties.load(new FileInputStream(userHomeProper...
e74050da-66b5-40d9-9e04-dbe8bfe9f00a
8
private synchronized void sendScreenSegment(int x, int y, int w, int h) { if(maxSend != -1) { if(w * h > maxSend) { int totalSent = 0; while(totalSent < h) { int h1 = maxSend / w; if(h1 == 0) h1 = 1; ...
f002c735-383b-421f-8f4a-48e44c11f5f5
3
public static boolean inBank() { int x = Players.getLocal().getLocation().getX(); int y = Players.getLocal().getLocation().getY(); return x >= 3250 && y >= 3419 && x <= 3257 && y <= 3423; }
9e72fcc4-8d3d-4b4c-964f-6c7f9ebc80bb
8
public int checkBoundary(Vector3f playerPos) { int max = -1; if(playerPos.x > maxX) { if(Math.abs(maxX - playerPos.x) > max) { max = 90; } } if(playerPos.x <= minX) { if(Math.abs(minX - playerPos.x) > max...
7b7b5344-3554-4e3c-9f37-fa68afb6aa30
8
public void processQueries(String strInputFilePath, String strOutputFilePath) throws IOException { oBufferedReader = new BufferedReader(new FileReader(strInputFilePath)); oBufferedWriter = new BufferedWriter(new FileWriter(strOutputFilePath)); calcuateTFIDF(oBufferedReader); oBufferedReader.close(); oBuff...
442f744c-904c-4e3d-8048-5d34133a7b17
6
private JTreeNode<T> getCurrentNode(JTreeNode<T> root, T insertValue) { if (root.getLeftNode() == null && root.getRightNode() == null) return root; if (root.getValue().compareTo(insertValue) > 0 && root.getLeftNode() != null) return getCurrentNode(root.getLeftNode(), insertValue); if ((root.getValue(...
f96e6065-9050-4c54-8c7b-57e73b57aa56
3
@Override public void display() { System.out.print("Forecast: "); if (currentPressure > lastPressure) { System.out.println("Improving weather on the way!"); } else if (currentPressure == lastPressure) { System.out.println("More of the same"); } else if...
6d71dde8-9abe-42ac-90fa-3fec7324df47
6
public static int getDeltaY(int dir) { if(dir == UP || dir == UP_LEFT || dir == UP_RIGHT) return -1; if(dir == DOWN || dir == DOWN_LEFT || dir == DOWN_RIGHT) return 1; return 0; }
557306f4-1059-429b-abb5-de4e23ff08ed
5
@SuppressWarnings("serial") private void initGUI() { try { setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.setSize(1003, 532); setExtendedState(java.awt.Frame.MAXIMIZED_BOTH); { jMenuBar1 = new JMenuBar(); setJMenuBar(jMenuBar1); { menuFile = new JMenu(); jMenuBar1.a...
71bdfae4-41e5-41ba-9234-afdc5c13f13f
5
public void initializeAnnotationComponents(ArrayList<Annotation> annotations){ if (this.annotations == null && annotations != null){ this.annotations = new ArrayList<AnnotationComponent>(annotations.size()); AnnotationComponentImpl comp; for (Annotation annotation : annotati...
0aa5aa3e-db71-4d56-9bb7-50618e8cf36a
1
@Override public List<? extends DefaultModel> getObj(final String campo) { return null; }
bac8c40f-0c18-4c99-aa00-387eed95fcd4
1
public void useThreadSleep() { System.out.println("-------------Use Thread.sleep()------------"); System.out.println("Sleep for 5 seconds."); try { Thread.sleep(5000); System.out.println("woke up."); } catch (InterruptedException e) { e.printStackTrace(); } }
d55e092f-b601-43b8-ab43-b7e94afddd1d
2
@Override public void run() { CountDownLatch latch = new CountDownLatch(1); while(autoLog) { try { latch.await(logInterval, TimeUnit.SECONDS); saveLogs(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
28667796-c3da-456c-92e6-c2199af675fd
6
public Document createDocument(final List<Student> students) { Document doc = null; try { final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(true); final DocumentBuilder db = dbf.newDocumentBuilder(); doc = db.newDocument(); final Element root = doc.createElem...
74aee9d1-04a9-466d-86ec-7d2c9750fecd
7
private void saveAdditionalSeats(JButton[] button, int flightID, int numberOfSeats, int methodChecker, int customerID) { int seats = 0; String nameOfSeats = new String(); for(int i = 0; i<button.length; i++) { //Checks if the button is clicked and also if it wasnt booked to ...
6f6a959f-e85c-4658-bcb2-45f91fdfb2e7
3
private static Patient getPatient(Patient bean, PreparedStatement stmt, ResultSet rs, int numOfObject) throws SQLException{ if(bean.getPid()!=0) stmt.setInt(1, bean.getPid()); else if(bean.getPhone()!=null){ stmt.setString(1, bean.getFirstName()); stmt.setString(2, bean.getLastName()); stmt.setString...
ab8a4f80-b288-484d-af73-50b924c93c54
5
public static boolean isPrime(long x){ long max = (long)Math.sqrt(x); if( x == 2){ return true; } if (x % 2 == 0) { return false; } if (x <= 1) { return false; } for( long i = 3L; i <= max; i+=2 ) { if( x % i ==0) { return false; } } return true; }
eda1e0e5-0655-4a66-9fa9-2de990091af2
2
void delete(){ thread=null; try{ if(ss!=null)ss.close(); ss=null; } catch(Exception e){ } }
49367e79-9be2-45f2-ba44-9146b6582c9b
1
public int getTag(int i) throws ClassFormatException { if (i == 0) throw new ClassFormatException("null tag"); return tags[i]; }
46bb7b44-89b0-4f8e-9247-3fd4c9205be9
2
public void deleteUnselected() { for (Integer opp : list.keySet()) { if (!list.get(opp).selected()) { list.remove(opp); } } }
9b9aa02e-37c5-424f-962b-f3ba4e6a9d1b
6
@EventHandler public void WolfNausea(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.getWolfConfig().getDouble("Wolf.Nausea.DodgeCh...
cb4dfa50-09f9-4b7b-8ab7-7835552f840c
2
public void bufferSave(GraphNode child){ int i=0; while(!buffer.get(i).equals(child)){ i++; } int k=0; int[] temp = new int[buffer.size() - i]; while(i<buffer.size()){ temp[k] = buffer.get(i).getNodeIndex(); k++; i++; } cycles.add(temp); }
8f0c6473-3844-43c7-a8b9-9f4af6073b4a
1
private int getMin(int a, int b) { return b < a? b: a; }
5ef871ff-e19b-4fd0-96c0-a1e34d7e3e9e
1
public String toString() { try { return this.toJSON().toString(4); } catch (JSONException e) { return "Error"; } }
c922cb1c-f175-4b7b-aa96-c13b608b87ae
6
private String getPath(String text, int id) { if (text.equals(IN) || text.equals(OUT)) if (id == 0) return LOW_PATH; else return HIGH_PATH; for (int i = 0; i < COMPONENTS.getLength(); i++) { if (COMPONENTS.get(i).equals(text)) ...
9f6006ad-09fd-4da4-8fba-e406033907e8
9
private void readBlocks(RandomAccessFile data) throws IOException { boolean readNext = true; while (readNext) { int mapX = data.readUnsignedShort(); int mapY = data.readUnsignedShort(); short musicIndex = data.readShort(); short ambienceIndex = data.readShort(); short mapIconIndex = data.readShort()...
cf710742-facb-439e-b9fc-702908b4f276
9
public void append_blank() { if(isReadOnly()) return; addreccount(); try { fdbf.seek( recordpos() ); } catch (IOException e) {} writeChars(0,1," "); // not deleted for(int i=0;i<fcount;i++) { field y = Field[i]; if(y.ftype=='0') writeNumber(0,y.fsize, 0 ); //write binary 0 if(y.ftype=='I') writ...
04c996ac-0a30-4fb8-90c5-9181ab25259c
8
public synchronized void processOutput(ByteBuffer buffer) throws SSLException { if (buffer.hasRemaining()) { do { SSLEngineResult result = mEngine.wrap(buffer, mOutboundData); switch (result.getHandshakeStatus()) { case NEED_TASK: runSSLTasks(); break; case NEED_UNWRAP: // Shoul...
fecb5ac2-742d-4934-8070-b0e4a8f97e78
3
private Item get(final Item key) { Item i = items[key.hashCode % items.length]; while (i != null && (i.type != key.type || !key.isEqualTo(i))) { i = i.next; } return i; }
97df4fc8-0e9f-411b-b686-3ad241fd8a31
2
public static void openStaticSWTDemo(IDemo demo) throws Exception{ Settings.getInstance().setHardwareAccelerated(true); Chart chart = demo.getChart(); Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Bridge.adapt(shell, (Component) chart.getCanvas()); ...
00ab088b-5291-4a79-a356-0c08785bf6b5
1
public static void main(String[] args) { try { AppGameContainer app = new AppGameContainer(new Application("The Saga of the Owl King v" + VERSION)); app.setDisplayMode(WIDTH, HEIGHT, false); app.setTargetFrameRate(FPS); app.setShowFPS(true); app.start(...
b7ac0fea-2ce1-4f94-a6d7-c333b766c2fe
0
public TuringMachine getInnerTM(){ return myInnerTuringMachine; }
f641728a-e9e4-453e-87b0-5f98f13e2d89
8
public static void test(PersistedQueueManager queueManager) throws Exception { processed.set(0); // create an ArmyAudit that just show to standard output ArmyAudit armyAudit = new SystemOutAudit(); //ArmyAudit armyAudit = new NegligentAuditor(); // create an Army to make machin...
aa62bde3-1e66-48ff-831c-9bf20dc416be
3
public void deleteAllItemToArticle(List<Integer> idAllItemsInArticle) { Session session = HibernateUtil.getSessionFactory().openSession(); try { session.beginTransaction().begin(); for(Integer id:idAllItemsInArticle){ Article itemDelete = (Article) session.get(Art...
ced366d0-48d1-49d8-8567-6f89ed485433
6
private void setPath(Point start) { int counter = 0; path.add(start); Point goal = mainPath.get(counter); counter++; int currentXPos = start.getX(); int currentYPos = start.getY(); while(true) { while (goal.getX() != currentXPos || goal.getY() != currentYP...
f97a1dc0-9d49-44ad-ab52-eb3320bc6e51
2
static int [] shift(int arr[]){ int lastElement=arr[(arr.length-1)]; for (int count=(arr.length-1);count>0;count--){ arr[count]=arr[count-1]; } if(arr.length>=1) arr[0]=lastElement; return arr; }
d178dfb3-acfc-4128-83c5-f8f05d16bffe
8
public void actionPerformed(ActionEvent evt) { if (evt.getSource() == browseButton) { if (browseFile() && recording) startRecording(); } else if (evt.getSource() == recordButton) { if (!recording) { startRecording(); } else { stopRecording(); fnameField.setText(nextNewFilename(fnam...
0f345c64-1591-4567-83cb-bda68c321493
2
public boolean hasAttribute(String name) { for (int i = 0; i < attributes.length; i++) if (name.equals(attributes[i].name)) return true; return false; }
b3d128d6-091f-443a-86a2-a4a5851eec8a
2
public static void main(String[] args) { jlap test = new jlap(); if (args.length != 1) { test.showUsage(); System.exit(0); } else { try { test.play(args[0]); } catch (Exception ex) { System.err.println(ex.getMessage()); System.e...
14dc8d99-3572-45e1-9dac-d8498bcddc4e
0
public NonRuleBasedDamagerRepairer(TextAttribute defaultTextAttribute) { fDefaultTextAttribute = defaultTextAttribute; }
8dd6f050-47ac-458a-bdd7-651343780799
1
@Override public boolean registerUser(String username, String password, String email, String firstName, String lastName) { // Declare a local boolean to be returned by this method, where false // means that registration has been unsuccessful // (i.e. given username already exists) and true that an user has be...
5ac0065a-90f4-4ddc-97dc-50797068a8da
4
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Date date = (Date) o; return day == date.day && inaccurateTime.equals(date.inaccurateTime); }
8fe999b8-21f6-45db-b69f-37209d05d164
4
@Override public void run() { ArrayList<Navire> naviresArrives; int compteur = 0; int sleep = 200; while(Partie._tempsCourant <= Partie._tempsFin) { if(compteur%Partie._tempsTour == 0) { incrementerTemps(compteur); ...
3554d749-5bcb-4198-bd18-2234628fa005
3
public static boolean HasPermission(Player p, String permission) { if(p == null) return true; if(p.hasPermission(permission)) return true; if(PermissionsEx.getPermissionManager().has(p, permission)) return true; return false; }
a20b34b6-77b5-4f6b-a033-7e134fccfcae
3
private void buildTree(FAT32Directory rootElement) { DefaultMutableTreeNode top = createNodes(rootElement); jTree = new JTree(top); ImageIcon leafIcon = new ImageIcon(this.getClass().getResource(leafIconPath)); ImageIcon openIcon = new ImageIcon(this.getClass().getResource(openI...
a61aa0bd-349b-4fe7-a074-81d76c7714ff
0
public void setSaleId(int saleId) { this.saleId = saleId; }
b9017cc9-7799-49c9-8369-d3e756dcc13e
4
public void setFieldValue(_Fields field, Object value) { switch (field) { case WHAT: if (value == null) { unsetWhat(); } else { setWhat((Integer)value); } break; case WHY: if (value == null) { unsetWhy(); } else { setWhy((String)value); ...
c3cd91ea-f47c-4a5e-ba4d-4addb05abcc1
9
public static Geometry newObj(String data) { n_v = n_f = 0; StringTokenizer st = new StringTokenizer(data, "\n"); while (st.hasMoreTokens()) { String s = st.nextToken(); if (s.length() > 1) if (s.charAt(0) == 'v' && s.charAt(1) == ' ') n_v++; e...
08d0f3f4-2e27-45c9-bcdd-9646165f08ae
8
public static void encounter(ArrayList<Person> Group1,ArrayList<Person> Group2 ) { ///////////////////This is for zombie vs person////////////////////// if(isZombieGroup(Group1) && !isZombieGroup(Group2)) { zombieVsPerson(Group1,Group2); } ///////////////////This is for person vs pe...
8e309309-89c6-4a1b-84cc-e7e65e70930a
3
public static void main(String[] args) { // TODO code application logic here MySQLCli mysqlCli = new MySQLCli("//localhost/smsapp", "root", ""); if (mysqlCli.connect()) { System.out.println("Connected to database smsapp"); Refresh R=new Refresh(mysqlCli); try { int NumberAd...
e29adfce-4a34-4bdb-94f2-56c4b7793538
4
public FileInputAsChar(String pathName){ this.pathName = pathName; int posSlash = pathName.indexOf("//"); int posBackSlash = pathName.indexOf("\\"); if(posSlash!=-1 || posBackSlash!=-1){ File file = new File(this.pathName); ...
346bbcf5-b9e1-4702-a8a8-ef86db9689c8
0
public void setConstant (double constant) { this.constant = constant; }
687e8208-97c0-4719-a091-67caa0a500b5
3
@Override public void addPosition(Position position) throws SQLException { Connection dbConnection = null; java.sql.Statement statement = null; try { dbConnection = PSQL.getConnection(); statement = dbConnection.createStatement(); String addPosition = "insert into position(id_position, name, sallary) v...