method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c37ee08d-e560-4d65-9df5-5fd02fc01198
3
private void remplirTournee(List<NoeudItineraire> noeuds) { int indexNoeuds = 0; //Entrepot List<Troncon> tronconsEntrepot = plan.getCheminlePlusCourt(noeuds.get(indexNoeuds).adresse,noeuds.get(indexNoeuds+1).adresse); indexNoeuds++; Trajet trajetEntrepot = new Trajet(tronconsEntrepot); entrepot.setTrajet(t...
e4896883-35a6-4d29-8d95-63338db73d43
8
@Test public void testWriteWriteDeadlock() throws Exception { System.out.println("testWriteWriteDeadlock constructing deadlock:"); LockGrabber lg1Write0 = startGrabber(tid1, p0, Permissions.READ_WRITE); LockGrabber lg2Write1 = startGrabber(tid2, p1, Permissions.READ_WRITE); // allow initial write lock...
f96ecc95-54ab-42ac-869f-c548702ca6a1
3
private void appendRow(StringBuilder sb, Puzzle p, int r) { sb.append("|"); for (int c = 0; c < p.getSide(); c++) { if (c > 0 && c % p.getBoxSize() == 0) { sb.append(" |"); } sb.append(" "); sb.append(p.getValue(c + r * p.getSide())); } sb.append(" |\n"); }
63a15984-0ee7-4d05-9999-64547dbb2fd5
9
@Override public boolean fill() throws IOException { boolean changed = false; BufferedReader reader = new BufferedReader(new FileReader(filePath)); while (reader.ready()) { String line = reader.readLine(); if (line == null) { break; } ...
5e1a197b-92d1-4376-98fd-50154b6bf4c5
7
@Override public Block.ExitStatus evaluate(IdentifierMap values) { for (int i = 0; i < conditions.size(); i++) { Value conditionValue = conditions.get(i).evaluate(values); if (conditionValue instanceof BooleanValue) { if (conditionValue == BooleanValue.TRUE) { if (blocks.get(i) == null) ...
9bf7a875-4583-4b0a-a67e-8f97acfe8d77
8
public FTPFile parse(String serverString, String parentDirectory) throws ParseException { if(serverString.charAt(0) != '+') throw new ParseException("Not an EPLF LIST response (no '+' on line start)",0); serverString = serverString.substring(1); StringTokenizer st = new StringTokenizer(serverString,","); ...
63d2b0d0-ab19-4ed9-b234-1f15d4af246e
0
public AlgorithmIdentifierType createAlgorithmIdentifierType() { return new AlgorithmIdentifierType(); }
bd12bce7-709d-47e8-8e7a-991e8fd92cfd
3
private boolean endOfTerms(String ch, int i) { boolean end = true; char tabChar[] = ch.toCharArray(); for (int j = i + 1; j < ch.length(); j++) { if (tabChar[j] == '1' || tabChar[j] == '0') { end = false; break; } } return end; }
9f022c9b-39fe-4b3c-9429-35575a1809eb
7
public void CheckChatHistory(String currentUser) { String path = "resources/"; String files; File folder = new File(path); File[] listOfFiles = folder.listFiles(); //list all the files for (int i = 0; i < listOfFiles.length; i++) { //check if it ...
cf69f2e7-4af3-4631-a705-e274d3bd07c2
6
public boolean checkCollision(BallModel ball) { if (ball.getPosX() + ball.getDiameter()/2 > this.getPaddleX() && ball.getPosX() + ball.getDiameter()/2 < this.getPaddleX() + this.getPaddleWidth() && ball.getPosY() > this.getPaddleY() && ball.getPosY() < this.getPaddleY() + this.getPaddleHeight()) ...
07960d44-69c4-458e-b3bd-57429c10dbff
7
private Object select(PreparedStatement st, Class ret) throws SQLException { ResultSet result = st.executeQuery(); boolean castToArray = false; if (ret.isArray()) { ret = ret.getComponentType(); castToArray = true; } Mapper retMapper = Mapper.Registry.get(...
499d24d8-73c5-4de7-8fe1-5e052fb05546
9
private void checkEvictionOrder(boolean lifo) throws Exception { SimpleFactory<Integer> factory = new SimpleFactory<Integer>(); GenericKeyedObjectPool<Integer, String> pool = new GenericKeyedObjectPool<Integer, String>(factory); pool.setNumTestsPerEvictionRun(2); pool.setMinEvictableIdle...
dd04356e-ce7f-4d62-988d-bb2b80ab7605
8
public String toString(){ String toRet="\n"; toRet+= ("\n 0 1 2 3 4\t 0 1 2 3 4"); for (int row = 0; row < 5; row++) { String rowStr = row + " "; for (int col = 0; col < 5; col++) { rowStr += board[row][col] + " "; } rowStr += "\t" + row + " "; for (int col = 0; col < 5; col++) { switch (...
d0d0f18a-980a-4ac7-be8c-61d1cea0ac2c
5
protected void engineSetMode(String modeName) throws NoSuchAlgorithmException { if (modeName.length() >= 3 && modeName.substring(0, 3).equalsIgnoreCase("CFB")) { if (modeName.length() > 3) { try { int bs = Integer.parseInt(modeName.substring(3)); attr...
bf9b3115-f5f2-4c75-84ca-a7562daced21
1
public Integer[] nextIntegerArray() throws Exception { String[] line = reader.readLine().trim().split(" "); Integer[] out = new Integer[line.length]; for (int i = 0; i < line.length; i++) { out[i] = Integer.valueOf(line[i]); } return out; ...
94f7e012-a7cd-4c3f-b7d9-8be199967e1c
0
public static int startsWith(String text, String match) { return StringTools.startsWith(text, match); }
a4442f01-97e2-496d-8f0d-c1e28816ec5b
9
public void selectedChanged(GameContext context, String message) { if (context.getSelectedTower() == null) { return; } URL imageURL = this.getClass().getClassLoader().getResource("com/creeptd/client/resources/panel"); // show SelectTowerInfoPanel if (message.equals("t...
ad74a18c-7e17-44fd-a2e5-ce4a3545e8ca
2
public FlowBlock getNextFlowBlock(StructuredBlock subBlock) { for (int i = 0; i < caseBlocks.length - 1; i++) { if (subBlock == caseBlocks[i]) { return null; } } return getNextFlowBlock(); }
9d43991b-b5cd-42a8-bc60-27116a642704
5
public void shoot() { if(btmr < -10) { int dir; int bx; if(player) if(wrld.p2.x < x) dir = 0; else dir = 1; else if(wrld.p1.x < x) dir = 0; else dir = 1; if(dir == 0) bx = -13; else bx = 13; wrld.bullets.add(new Bullet(x+bx, y, dir)); btmr = 50; } }
57035cb0-0488-437d-a43e-69830ed8b0df
8
private void pivot(int p, int q) { // everything but row p and column q for (int i = 0; i <= M; i++) for (int j = 0; j <= M + N; j++) if (i != p && j != q) a[i][j] -= a[p][j] * a[i][q] / a[p][q]; // zero out column q for (int i = 0; i <= M; i++) if (i != p) a[i][q] = 0.0; // scale row p ...
f86efbd6-fddf-4b6d-aec9-4e80896c3545
1
public static String getScrollBarUIClassName() { // Code switches on the platform and returns the appropriate // platform specific classname or else the default. if (isWindows()) { return "com.organic.maynard.outliner.MetalScrollBarUI"; } else { return "com.organic.maynard.outliner.BasicScrollBarUI"; } ...
4d72097d-c87a-4245-bd23-7c1c8a153d62
4
private Instruction readInstruction(java.util.Scanner in) { Instruction inst = Instruction.ERROR; String instString = ""; //Start scanner System.out.print("Please enter a command: "); instString = in.nextLine(); instString = instString.toUpperCase(); if (instString.equals("MAKE A MOVE")) { instString...
c465b9d3-3ed6-4945-aa33-68ed6ecf8782
6
public void validate_update(String dataBaseName, String tableName, ArrayList<Field> entries, Field entry) { boolean flag = true; if (check_dataBase(dataBaseName)) { if (check_table(dataBaseName, tableName)) { for (Field element : entries) { if (!check_type(dataBaseName, tableName, element.g...
49f1359d-bfac-40e7-be81-94e77fd96e3d
2
public String getSerial (int language) { try { int id = getSerialStringId (); if (id > 0) return dev.getString (id, language); } catch (IOException e) { } return null; }
57c00314-aa07-442b-afb5-48867e5e57ca
7
public var_type unaryMinus() throws SyntaxError{ var_type v = new var_type(); if(v_type==keyword.ARRAY){ sntx_err("Math operations on pointers have not been implemented"); } if(isNumber()){ if(v_type == keyword.DOUBLE){ v.v_type = keyword.DOUBLE; v.value = -value.doubleValue(); } else if(...
29fee441-33dc-45be-ab76-4f743e7381f1
6
public List<Map<String, Object>> findMoreResult(String sql, List<Object> params) throws SQLException { List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); int index = 1; pstmt = connection.prepareStatement(sql); if (params != null && !params.isEmpty()) { for (int i = 0; i < params.size(...
8c6ec837-077b-4913-a72b-a5f00c2c5736
4
public static boolean isTestPlanEmpty() { boolean isTestPlanEmpty = true; @SuppressWarnings("deprecation") JMeterTreeModel jMeterTreeModel = new JMeterTreeModel(new Object());// Create non-GUI version to avoid headless problems if (JMeter.isNonGUI()) { try { ...
2970fcf5-4f96-4a93-bd68-e3ffc7c31311
5
public void searchLinkAndAddToList(String str, String site) { String tmp; str = str.replace(" ", ""); int start = str.indexOf("<a"); if(start >= 0){ start = str.indexOf("href=\""); if(start >= 0){ str = str.substring(start+6, str.length()); start = str.indexOf("\""); tmp = str; if(start >=...
41cdd360-9cce-4f32-89df-61a699d1e7c6
0
public void setCap(int cap) { this.cap = cap; }
a05b42b4-faac-44fe-8e1a-1b41757c273d
7
public boolean setInitializer(Expression expr) { if (constant != null) return constant.equals(expr); /* * This should check for isFinal(), but sadly, sometimes jikes doesn't * make a val$ field final. I don't know when, or why, so I currently * ignore isFinal. */ if (isSynthetic && (fieldName....
f2db0ae6-1fec-45f8-964c-7fe17914f795
8
public static void backupWorld() { if(System.getProperty("os.name").contains("Windows")) { System.err.println("[WARNING] The /backup command is unimplemented under Windows systems."); return; } try { if(!(new File("backups")).isDirectory()) Runtime.getRuntime().exec("mkdir backups"); } catch(Exception e) ...
801819be-3e7c-470a-ab92-b8a481144193
6
public void findVertexCover() { //throw new RuntimeException("You have to implement it yourself..."); //The following code skeleton may be used, but not necessarily. //settings int populationSize = 200; //??? int iterations = 1000; //??? //best chromosome Chro...
aea386cf-43db-4e58-bc89-853ae7440675
3
private void setcmp(Comparator<Buddy> cmp) { bcmp = cmp; String val = ""; if (cmp == alphacmp) val = "alpha"; if (cmp == groupcmp) val = "group"; if (cmp == statuscmp) val = "status"; Utils.setpref("buddysort", val); synchronized (buddies) { Collections.sort(buddies, bcmp); } }
cb6f66b6-dbbe-456a-bd89-4578284aa0d6
9
private void testAbstractMethods(ByteMatcher matcher) { // test methods from abstract superclass assertEquals("length is one", 1, matcher.length()); assertEquals("matcher for position 0 is this", matcher, matcher.getMatcherForPosition(0)); try { matcher.getMatcherForPositio...
f7a40a48-156d-436b-bede-abe06b46f5a1
1
@Override public List<Integer> update(Criteria beans, Criteria criteria, GenericUpdateQuery updateGeneric, Connection conn) throws DaoQueryException { List paramList1 = new ArrayList<>(); List paramList2 = new ArrayList<>(); StringBuilder sb = new StringBuilder(UPDATE_QUERY); String ...
de891fab-2aab-4056-b376-96adb1a099c6
6
public JsonObject save() { try { JsonValue v = JsonValue.readFrom(text.getText()); if(v.isObject()) { JsonObject o = JsonObject.readFrom(text.getText()); ArrayList<String> names = new ArrayList<String>(); names.addAll(loaded.names()); for(String s: names)loaded.remove(s); for(Member m:...
bf64c835-e2e5-4aad-b18c-2c50174c048e
0
public void stop() { isRunning = false; }
04b5903a-6630-4e52-a25c-3ed7470b3086
0
public void setFieldLineIndex(int fieldLineIndex) { this.fieldLineIndex = fieldLineIndex; }
7bbb9680-65a9-438d-bf7b-823ee59d103d
0
@Override public String getGUITreeComponentID() {return this.id;}
1ce08e7d-557d-4c32-8afd-dfebcab53183
2
public CopyMonitorStarter(String quellPfad, List<String> targetPfade, HashMap<String, Boolean> parameters) { this.quellPfad = quellPfad; this.targetPfade = targetPfade; this.parameters = parameters; try { copyMonitor = new CopyMonitor(quellPfad, targetPfade,parameters); logger.info("creating source"); ...
03bb4422-3e36-4fe2-8a7e-6e3b2607bb41
0
public JTextField getOutput() { return output; }
27483180-b3e5-4fb4-8407-8b89dd69284a
1
public static void reset() { try { prefs.clear(); } catch (BackingStoreException e) { e.printStackTrace(); } }
49a76316-3c97-4ba5-8369-1addd8400e49
4
@Override public void createElection(String name, String typeID, User owner) { // Check if there is another election with the same name and typeID // and if yes, return false Collection<Election> col = electionMap.values(); Iterator<Election> it = col.iterator(); while (it.hasNext()) { DnDElection el = (D...
f2b6180b-41f5-49c0-a084-7fdbc76c6fba
7
public boolean onCommand(CommandSender commandSender, Command command, String label, String[] args) { HashMap<String, Integer> commandList = new HashMap<String, Integer>(); commandList.put("buy", 0); commandList.put("donate", 1); commandList.put("purchase", 2); commandList.put("store", 3); commandList....
273331b7-3b2e-44ff-befa-072952257b6c
4
private void draw() { if (pane != null) { coords = block.getCoords(); if (pane.insertAt().x != -1) { for (Point p : coords) { pane.cell(maxFall.y + p.y, location.x + p.x).Shadow(); } } for (Point p : coords) { pane.cell(location.y + p.y, location.x + p.x).Block(block.getName()); } } ...
c0d63c76-90a0-4036-befd-ac470709239b
9
public void readPropertyFile(File file){ DocumentBuilderFactory factory; DocumentBuilder builder; Document doc; try { System.out.println("学校のニュース取得開始"); factory = DocumentBuilderFactory.newInstance(); builder = factory.newDocumentBuilder(); doc = builder.parse(file); } catch(ParserConfigurationEx...
7699ffc7-d263-4b8f-870e-71726ba8b8d5
8
public String typeToString(DataType type){ switch(type){ case FLOAT: return "double"; // insalmo is looking for 'double' not 'float' in Experiment.Setup // eventually, all references to FLOAT here and in the metaprojectdata should be replaced case STRING: return "string"; case INFILENAME: case OUTFI...
65e09853-6280-49aa-8961-dcb34bd4a250
2
public double getKiihtyvyys1X() { double res = 0; if(getNappaimenTila(VASEN1)){ res -= KIIHTYVYYS; } if(getNappaimenTila(OIKEA1)){ res += KIIHTYVYYS; } return res; }
19105669-b7e8-4fb3-8f35-9e0368302c2b
9
@SuppressWarnings("unchecked") private List<Object> processDirectives() { yamlVersion = null; tagHandles = new HashMap<String, String>(); while (scanner.checkToken(Token.ID.Directive)) { DirectiveToken token = (DirectiveToken) scanner.getToken(); if (token.getName().e...
b1a1b9f5-8bdb-41f2-8917-7c5aeb5ce2f9
1
public static BufferedImage loadFace(String spriteFilename) { try { return ImageIO.read(new File("Resources/Faces/" + spriteFilename)); } catch (IOException e) { System.out.println("File not found"); e.printStackTrace(); } return null; }
ba6d8a1e-600b-474b-a5d7-fad996aeb0fc
7
public AudioSample(final File file) throws Exception { try { this.audioInputStream = AudioSystem .getAudioInputStream(new BufferedInputStream( new FileInputStream(file))); this.format = this.audioInputStream.getFormat(); // Support only mono and stereo audio files. if (this.getNumberOfChanne...
504e3c59-fdc0-4130-9576-4976dcf164d1
8
public static void aggiungiPedine(int n, int b) { // aggiunge le pedine appena mangiate alla griglia menuItem2.setEnabled(true); for (int i=0, x=0; i<4 && x<b; i++) // aggiunge pedine Bianche for (int j=0; j<3 && x<b; j++, x++) PedinePC[i][j].setIcon(new ImageIcon("images/Pedine/bianca_icon....
9e16a9f7-8bdb-4f0f-b652-a137e0301eb5
2
public static byte[] stringToBytes(String str) { if (str == null) { return null; } char[] chars = str.toCharArray(); int len = chars.length; byte[] buf = new byte[len]; for (int i = 0; i < len; i++) { buf[i] = (byte) chars[i]; } return buf; ...
08fd6173-8a80-4037-bb07-e87c79991dd7
7
private int[] sizeLargestComponent(ArrayList<Node> nw){ Set<Integer> Q = new HashSet<Integer>(); ArrayList<Integer> D = new ArrayList<Integer>(); for(Node N : nw) { Q.add(N.id); } Node N; int n; int q; int r; int maxS = 0; ...
792c877b-710d-4a9c-845e-dcf8f78c60c1
1
public void updateGame(long gameTime, Point mousePosition) { currentLevel.upDate(gameTime); Statistique.update(currentLevel, gameTime); if (currentLevel.isCompleted()) currentLevel = levels.NextLevel(); }
c6d668a1-4fda-4a5f-b269-ab79f4882fa7
2
public GenericList<E> concat(GenericList<E> that) { GenericList<E> res=this; if(that!=null) { for(int i=0;i<that.size();i++) { res.add(that.list.get(i)); } return res; } else { return res; } }
059a5442-c5da-4a0b-8ca1-238a332da776
9
public static void incrementalFsqCrawl(String city, double[] point, String folder, String clientId, String clientSecret, int m) throws IOException{ JsonParser parser = new JsonParser(); // Creating the grid of points around the center of the city. double[][][] grid = createGridAround(point,m); Collection<String...
7c8753fa-54d2-457e-ac01-4821c58b647d
3
public static double getPerfectAim(GunWave wave, State state) { double distance = wave.distanceSq(state.targetPosition); /* * If the enemy is further away then 30 turns there is no way that * perfect targeting could ever hope to work, the upper limit is * likely much much lower. */ if(distance > wave....
c041b89b-e067-4af4-ae9b-4a9d40bb2eff
8
public void keyPressed(KeyEvent e) { if (!dead) { int key = e.getKeyCode(); if (key == left_key) { t.start(); direction = "LEFT"; dx = -SPEED_PISTOLERO; } else if (key == right_key) { t.start(); direction = "RIGHT"; dx = SPEED_PISTOLERO; } else if (key == up_key) { t.sta...
25c724db-f7b5-4d9a-9a2c-a8fc222eb42e
9
public Causa ingresoImputadoPorTeclado(){ @SuppressWarnings("resource") Scanner scanner = new Scanner (System.in); String texto; int expediente; Long dni; Causa causa = new Causa(); try { System.out.println("Agregar Imputado a Causa"); System.out.println("------------------------"); while (true)...
0decaed4-db1e-4851-bd5a-fb0a70974590
4
public void testSetIntoPeriod_Object8() throws Exception { MutablePeriod m = new MutablePeriod(); try { StringConverter.INSTANCE.setInto(m, "", null); fail(); } catch (IllegalArgumentException ex) {} try { StringConverter.INSTANCE.setInto(m, "...
6c5b69e0-aeb4-4dda-86b6-e0a82a68fab0
7
private static int partion(int[] n, int start, int end) { int tmp = n[start]; while (start < end) { while (n[end] >= tmp && start < end) { end--; } if (start < end) { n[start++] = n[end]; } while (n[start] < tmp && start < end) { start++; } if (start < end) { n[end--] = n[start]...
16eb2f99-640b-4ad0-af11-4f0383805052
2
public void visitIntInsn(final int opcode, final int operand) { if (opcode == SIPUSH) { minSize += 3; maxSize += 3; } else { minSize += 2; maxSize += 2; } if (mv != null) { mv.visitIntInsn(opcode, operand); } }
62350ac2-bfec-4494-88f7-d8d14bb5cf84
4
@Override protected void calcCoordinates(GraphicForm gForm, Camera camera, PhysObject3D obj) { if(camera.isFixedOrientation() && !getName().equals("Looker")) setName("Looker"); else if(!camera.isFixedOrientation() && !getName().equals("Camera")) setName("Camera"); set...
e9b78db7-84af-4e2d-b6dd-127e32f4a510
8
public void quickSort(long[] arr, int left, int right) { if (left < right) { int l = left, r = right; long x = arr[left]; while (l < r) { while (l < r && arr[r] >= x) r --; if (l < r) arr[l ++] = arr[r]; while (l < r && arr[l] <= x) l ++; if (l < r) arr[r --] = arr[l]; } arr[l] = x; ...
4e70a33f-fe78-4721-a218-3505a3cc4678
8
@Override public String buscarDocumentoPorFechaVencimiento(String fechaven1, String fechaven2) { ArrayList<Compra> geResult= new ArrayList<Compra>(); ArrayList<Compra> dbCompras = tablaCompras(); String result=""; Date xfechaven1; Date xfechaven2; Date f; ...
cb7266cc-89b8-41d0-a039-2c8b3cdb0026
6
public void paint(Graphics2D g) { g.setFont(getFont()); String[] lines = null; if (getText().indexOf("\n") > -1) lines = getText().split("\n"); else lines = new String[] {getText()}; if (textUpdated) { maxStrWidth = 0; for (int v = 0; v < lines.length; v++) { int m = g.getFontMetrics().stringW...
0706bb7b-ab05-425d-9f30-fc9884a1e507
1
private void killButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_killButtonActionPerformed try { logger.log(Level.INFO, "Killing process: " + selectedProcess); logger.log(Level.INFO, "ADB Output: " + adbController.executeADBCommand(true, false, deviceManager.getS...
ef07fca0-096c-4eeb-8420-bca515837003
4
protected boolean decodeFrame() throws JavaLayerException { try { AudioDevice out = audio; if (out == null) return false; Header h = bitstream.readFrame(); if (h == null) return false; // sample buffer set when decoder constructed SampleBuffer output = (SampleBuffer) decoder.decodeFrame(h, bits...
0309638b-0058-4b4c-b1b2-83b79b32723e
1
private void setFloatValue(final Cursor cursor, final int index, final Field field, final Object object) { final Float value = (!cursor.isNull(index) ? cursor.getFloat(index) : null); Reflection.setFieldValue(field.getName(), object, value); }
202ed41b-27e0-4721-896f-64128f0afa26
8
protected int[] transmit(int[] in) throws Exception { //*deb*/System.out.println("transmit() length: " +in.length); //IO-Warrior 56 needs special handling if (iow.getId() == AbstractIowDevice.IOW56ID) { return transmit56(in); } int length = in.length; int rem...
f521a1c8-463a-4fe1-a65b-705c8faff824
1
* @return the new KB subset collection term * * @throws IOException if a communications error occurs * @throws CycApiException if the Cyc server returns an error */ public CycConstant createKbSubsetCollection(String constantName, String comment) throws IOException, CycApiException { ...
79ba9b4f-16ed-4785-ac9e-9a2f0b323905
1
public synchronized boolean removeChild(GuiComponent child) { boolean removed = children.remove(child); if (removed) child.deactivate(); return removed; }
5e2ed8bf-6ea2-4188-b3d9-dd378d32770b
8
private String useAbondVariables(String s, int frame) { if (!(model instanceof MolecularModel)) return s; MolecularModel m = (MolecularModel) model; int n = m.bends.size(); if (n <= 0) return s; int lb = s.indexOf("%abond["); int rb = s.indexOf("].", lb); int lb0 = -1; String v; int i; Angular...
b570b5e5-af9c-453b-a172-dca8f81f5b1d
7
public void mousePressed(MouseEvent event) { if (event.getSource() instanceof JButton) { JButton btn = (JButton) event.getSource(); Territory territ = map.getTerritory(btn.getName()); boolean all = (event.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK; switch (state) { case PLACE...
655b15ca-1c1a-41ce-8692-0570cdb1c9aa
1
public int compare(M meeting1, M meeting2) { MeetingImpl mImpl1 = (MeetingImpl) meeting1; MeetingImpl mImpl2 = (MeetingImpl) meeting2; if(mImpl1.meetingDate.before(mImpl2.meetingDate)) { return 1; }else{ return -1; } }
37f45ca3-60af-4b90-9de0-30e94c1f9203
1
public Hand decyrptHand(EncryptedHand hand) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException { Hand ret = new Hand(); for (int i = 0; i < Hand.NUM_CARDS; i++) { EncryptedCard tmp = hand.data.get(i); ret.data.add(decryptCard(tmp)); } return ret; }
9c251856-2bf5-4f77-a8f4-599c3a57a7a0
7
private void drawByBresenchem(Point startPoint) { List<Point> drawedPoints = new ArrayList<Point>(); startPoint.draw(); drawedPoints.add(startPoint); Point firstPoint = startPoint; Point prePoint = startPoint; Point[] points = new Point[8]; Point bigPoint = new P...
400504c8-fd11-4610-930f-cda6ff1806e2
4
public String[] getTerminals() { ArrayList list = new ArrayList(); String[] rhsTerminals = getTerminalsOnRHS(); for (int k = 0; k < rhsTerminals.length; k++) { if (!list.contains(rhsTerminals[k])) { list.add(rhsTerminals[k]); } } String[] lhsTerminals = getTerminalsOnLHS(); for (int i = 0; i < lh...
0f193a8f-96eb-4bc6-8675-36a3298a00c0
6
public boolean setBlock(int par1, int par2, int par3, int par4) { if (par1 >= -30000000 && par3 >= -30000000 && par1 < 30000000 && par3 < 30000000) { if (par2 < 0) { return false; } else if (par2 >= 256) { re...
81c30387-8c37-478e-89a3-9d3e015277f0
6
FlowBlock getSuccessor(int start, int end) { /* search successor with smallest addr. */ Iterator keys = successors.keySet().iterator(); FlowBlock succ = null; while (keys.hasNext()) { FlowBlock fb = (FlowBlock) keys.next(); if (fb.addr < start || fb.addr >= end || fb == this) continue; if (succ == ...
ce21a0d9-1a04-43ea-93de-4104d23a57fb
0
@Override public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { PresentationReconciler reconciler = new PresentationReconciler(); // Default { RGB c = new RGB(0, 0, 0); CoffeescriptScanner scanner = new CoffeescriptScanner(colorManager); scanner.setDefaultReturnToken( n...
a3d35bbf-b9b2-43aa-9e3b-9f83241b00a9
7
public int partitionInt(int[] data, int length, int start, int end) { // TODO Auto-generated method stub if(data == null || length <=0 || start < 0 || end >= length){ throw new IndexOutOfBoundsException("argument error!"); } Random r = new Random(); //nextInt(0,n+1) create an int in [0, n+1) == [0, n]; i...
ea331673-bb87-4f9d-a010-bbd50c588feb
0
public String getDest(){ return this.dest; }
edb177a1-c4f2-43ab-aaa6-58f7f7993784
2
private void postEntityFileProcessing(Employee employee) throws IOException { StringWriter stringWriter = null; String newFileName; try { stringWriter = new StringWriter(); xmlManager.marshal(employee, stringWriter); newFileName = StringUtil.concatenateStrings(employee.getEntityFileName(), ValidatorProp...
7feadba2-401d-4505-9842-dee61e78a596
5
private void checkStraightFlush() { int suit = hand[0].getSuit(); for (int i = 0; i < 5; i++) { Card card = hand[i]; if (card.getSuit() != suit) { break; } if (card.getValue() == (13 - i)) { if (i == 4 && card.getValue() < hand[3].getValue()) { myEvaluation[0] = 9; myEvaluation[1] = ha...
e3fe7a8e-be26-46e2-9b6f-6bdf4e6d4baa
3
public static boolean isArrayByteBase64( byte[] arrayOctect ) { int length = arrayOctect.length; if (length == 0) { // shouldn't a 0 length array be valid base64 data? // return false; return true; } for (int i=0; i < length; i++) {...
4100d223-c137-4147-aa8f-f1aebc0910cb
9
private void btn_aceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_aceptarActionPerformed if (lab_modo.getText().equals("Alta")){ if (camposCompletos()){ ocultar_Msj(); insertar(); menuDisponible(true); ...
a6c07093-9d7d-4b44-b245-0be0ab6a8909
7
public void addUser(String name, String pass, int accType){ Statement stmt = null; try{ //Connection conn = DriverManager.getConnection(DB_URL, dbUser, dbPass); stmt = conn.createStatement(); if(accType==0){ try{ stmt.executeUpdate("CREATE USER '"+name+"'@'localhost' IDENTIFIED BY '"+pass+"';"); ...
25741cf1-0266-49ab-93a6-0e33f44e33e6
7
private void initialize() { frame = new JFrame("Chat Client"); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { disconnect(); } }); frame.setBounds(100, 100, 596, 533); frame.setDefaul...
4fc9a43d-d94c-4079-8e88-cdc477b7c1b4
9
public void sendAudioSocks(final SocketChannel chan, final boolean join, final int channel) { Runnable runner = new Runnable() { public void run() { Getoptions opt = new Getoptions(); if(Wuuii.DEBUG) { System.out.println("Send audio byte[] buffer join="+join +" transmission=" + opt.getTransmission()...
048a7174-5b19-4ff9-b696-0932cfe75808
0
public void setQuestName(String qName) { QuestName = qName; }
fcd4c1ab-d263-4d95-92e5-a816da9bb130
1
@Test public void testEquals() { try { System.out.println("equals"); Port anotherPort = new Port(80, 50, 2); Port instance = new Port(80, 50, 2); boolean expResult = true; boolean result = instance.equals(anotherPort); assertEquals(expR...
c5e971da-0878-4094-909c-45dc0cd50640
1
private void addAll(FactoryOfPlays factory) { for (AbstractPlay play : factory) bestPlays.add(play); }
b95c2c38-d060-4062-89d7-f71ecf9cedd5
4
@Override public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) { if(!enabled) getServer().getPluginManager().enablePlugin(this); if(parentGen.equals("")) return new ChunkGen(); Plugin p = getServer().getPluginManager().getPlugin(parentGen); if(p == null) { getLogger().warning("Plug...
57578837-b4fd-4d0a-abc3-0c44e750991f
3
public MasterServerImpl(File metaData, TreeMap<String, ReplicaLoc> nameToLocMap) throws IOException { locMap = new ConcurrentHashMap<String, ReplicaLoc[]>(); fileLock = new ConcurrentHashMap<String, Lock>(); txnID = new AtomicInteger(0); timeStamp = new AtomicInteger(0); replicaServerAddresses = new Replic...
15026c63-f007-4059-bc27-448a2060d871
3
public DiceImage() { try { for(int i = 0; i < activeDiceImage.length; i++) { activeDiceImage[i] = ImageIO.read(new File(getClass().getResource("resource/" + (i + 1) + ".png").toURI())); inactiveDiceImage[i] = ImageIO.read(new File(getClass().getResource("resource/" + (i + 1) + "g.png").toURI()...
aea620fa-c17c-436d-ad4e-fa51e0bebedf
0
public void clear() { fill(null); }
994ca0bd-017f-4667-8054-bdb899d38602
4
private void addTileIfOutdated(Tile tile, AtomDelta delta) { // Make sure the turf actually exists if(tile != null) { // TODO: discriminate between the different outdated types if(tile.outdated != 0) { delta.updates.add(new FullAtomUpdate(tile)); } for(Atom content : tile.contents) { if...
f8529f47-dfbf-4e35-92d2-d15314afe7cb
5
private void toNote() { ItemDefinition item = ItemDefinition.forId(certTemplateId); groundModel = item.groundModel; modelZoom = item.modelZoom; rotationY = item.rotationY; rotationX = item.rotationX; scaleInventory = item.scaleInventory; offsetX = item.offsetX; offsetY = item.offsetY; destColors = ite...