method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9daebd66-1ac5-4452-9f78-1792eaff1a78
7
@Override public void mouseClicked(MouseEvent e) { if(e.getComponent().equals(view.Play)){ try { mode.Play("C:/Users/Dimitris/Downloads/testHY252.mid"); } catch (InvalidMidiDataException | IOException | MidiUnavailableException | InterruptedException e1) { // TODO Auto-generated catch block...
410d5afc-4b18-4ef0-9e93-0cf796b7fbb5
7
@Override public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) { if (context == null) { throw new NullPointerException(); } Object result = null; if (isResolvable(base)) { if (params == null) { params = new Object[0]; } String name = method...
ee37e110-81fa-4710-9855-1f8cb1a4b331
3
public boolean sendPacket(String ip, int port, byte[] data) { try { InetAddress serverAddr = InetAddress.getByName(ip); tcpSocket = new Socket(serverAddr, port); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } OutputStream os = null; ...
5075e093-8e86-414a-b810-5aff5fb8c3fa
3
public boolean validPosition(int a, int b) { return a >= 0 && a < height && b >= 0 && b < width; }
7214a3b5-f49d-4202-9643-1351ac60efd3
3
public static void main(String[] args) { System.out.println("Enter value of n:"); Scanner scan=new Scanner(System.in); int n=scan.nextInt(); for(int i=0;i<n;i++) { int c=1; for(int j=0;j<n-i;j++) { System.out.print(" "); } ...
34976deb-7afd-4bde-8254-e47ebbdf7656
7
private StatInfo doStatsOnDividendSum() { TreeMap<String,Float> lastDividends = new TreeMap<String,Float>(); for(String ticker: dbSet){ lastDividends.put(ticker, 0f); } float[] dividendSums = new float[dbSet.size()]; for (Entry<Float, float[][]> ent : Database.DB_ARRAY.entrySet()) { int i = 0; for (f...
f3558322-22b8-49de-adea-fe0352ac3481
7
protected void consumeMethodHeaderName(boolean isAnonymous) { // MethodHeaderName ::= Modifiersopt Type 'Identifier' '(' // AnnotationMethodHeaderName ::= Modifiersopt Type 'Identifier' '(' // RecoveryMethodHeaderName ::= Modifiersopt Type 'Identifier' '(' MethodDeclaration md = null; // if(isAnnotationMethod) { //...
3fb2909e-580e-422c-b903-de6958115d77
8
public static boolean isBlockSeparator(String s) { if (s.startsWith("--") && s.endsWith("--")) { return true; } if (s.startsWith("==") && s.endsWith("==")) { return true; } if (s.startsWith("..") && s.endsWith("..")) { return true; } if (s.startsWith("__") && s.endsWith("__")) { return true; ...
0d5218cf-10b6-48a6-a522-b320e26a52be
6
public void update(Long id, String title, String message) { try { utx.begin(); } catch (NotSupportedException e) { e.printStackTrace(); } catch (SystemException e) { e.printStackTrace(); } Message msg = em.find(Message.class, id); msg....
449de6ba-cf07-4713-89f1-b4c84f3fa448
7
public String[] getResourceListing(String path) throws URISyntaxException, IOException { URL dirURL = getClass().getClassLoader().getResource(path); if (dirURL != null && dirURL.getProtocol().equals("file")) { return new File(dirURL.toURI()).list(); } if (dirURL == null) { String me = getCl...
b2146fe5-1a62-45cf-818e-d2f8c74b00a1
5
public void setObject( Object o ) { if( o instanceof GraphicFrame ) { graphicFrame = (GraphicFrame) o; } else if( o instanceof Pic ) { pic = (Pic) o; } else if( o instanceof Sp ) { sp = (Sp) o; } else if( o instanceof CxnSp ) { cxnSp = (CxnSp) o; } else if( o instanceof GrpSp ) ...
46ec9f3c-7d9a-4507-8d73-136ad5bc4be4
1
private void siirryAlemmalleSuoritustasolle(int prioriteetti) { asetaJonoonArvollinen(); while (suoritustasot.size() > prioriteetti) { nykyinenJono().paataJono(); suoritustasot.remove(suoritustasot.size() - 1); } }
87098b5d-828a-44a4-ae58-607d5265943f
8
@Override public void loadFromString(String contents) throws InvalidConfigurationException { Preconditions.checkNotNull(contents, "Contents cannot be null"); Map<?, ?> input; try { input = (Map<?, ?>) yaml.load(contents); } catch (YAMLException e) { throw new...
0a5d454a-54fc-4198-84b9-793a2ef83749
2
public List<User> DisplayAllUsers (){ List<User> listeUsers = new ArrayList<>(); String requete = "select * from User"; try { Statement statement = MyConnection.getInstance().createStatement(); ResultSet resultat = statement.executeQuery(requete); while(res...
e0469bbf-94b0-4ec7-942d-e629787846b2
0
public OperatingSeat getSeat() { return this._seat; }
956efa0c-4a68-4719-a141-2fcb2d470bf0
3
@Override void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) { // Replace child for(ListIterator<PExp> i = this._exp_.listIterator(); i.hasNext();) { if(i.next() == oldChild) { if(newChild != nul...
8f414f64-6598-4c10-9f03-60918a98522b
5
protected void calculateOCGroupDist(ArrayList<Group> gs, ArrayList<Graph.OpinionCluster> ocSet, int agentpool) { int numGroups = 0; //numClusters = ocSet.size(); for(Group g: gs) if(g.getAgents().size() > 0) numGroups++; int ocPos; double[] ocTrial = new double[ocGroupAverageSet.length]; for(Group g: gs)...
30db0584-4f89-46aa-a3f7-0060ebdeb8b0
2
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.name).append(" :=").append(NEWLINE); for(int i=0; i<this.predicates.size(); i++) { sb.append("\t").append(this.predicates.get(i)); if(i < this.predicates.size() - 1) { sb.append(",").append(NEWLINE); } } ...
21fb8b26-be0d-483f-a040-fd038303a8f1
9
public int read(char[] cbuf, int off, int len) throws IOException { int readAhead = 0; int read = 0; int pos = off; char[] readAheadBuffer = new char[BUFFER_SIZE]; boolean available = true; while (available && read < len) { available = super.read(readAheadBuffer, readAhead, 1) == 1; if (availa...
c722ae1e-5129-4865-a1ea-8a23e58f12fc
5
@EventHandler public void onArenaPlayerDeath(PADeathEvent e){ FileConfiguration config = Main.getConfig(); Player p = e.getPlayer(); HashSet<ArenaTeam> Teams = e.getArena().getTeams(); for (ArenaTeam team : Teams) { HashSet<ArenaPlayer> Players = team.getTeamMembers(); for (ArenaPlayer ap : Players) { ...
41d828c4-7b9b-4496-8eef-8d18e679c65f
1
public void award_bonus(BigInteger threshold, BigInteger bonus) { if (getBalance().compareTo(threshold) >= 0) deposit(bonus); }
d4d8d904-402a-49f3-a761-7dc7e9e1a572
8
private int getLoginStatus(String username) { try { // Fisrt test is for Employee loginStatus.setString(1, username); resultSet = loginStatus.executeQuery(); while(resultSet.next()) { status = r...
990d7170-4536-4a1d-b1cb-77bd4da0213c
5
private static void inspect(Object objects){ System.out.println(objects.getClass().getSimpleName()); if(objects instanceof String){ System.out.println("String"); } if (objects instanceof Car){ System.out.println("Car"); } if (objects instanceof Veh...
fe1e706d-f9f8-4342-889a-6c6351801b29
0
public void addCardtoHand(Card x){ hand.add(x); }
e5c61e6d-2bbb-46a5-b11f-e56390f7588e
7
protected void processKSFile(File file) throws IOException { soundPlaying = false; super.processKSFile(file, RouteParser.scenarioFileRename(this, file.getName())+".ks"); if (lang != Language.EN) { //Postprocess: remove blank lines and merge lines that belong to a single sentence StringBuilder sb = ne...
d5d7b8d0-f338-4d01-8977-1371082e16c6
1
public static boolean Edward() { double proc = Math.random(); if (proc < 0.2) return true; else return false; }
2bce6090-9d91-4a0b-85ff-8a027737380d
8
public String[] completeName(String part) { Vector<String> ret = new Vector<String>(); if (part.startsWith("_")) { ret = CodeCompletionUtils.complete(abbrs, part); } else if (part.endsWith("(")) { ret = CodeCompletionUtils.complete(part, interpreter, commands, ext_command...
d1736f47-96e0-497d-99cd-8ee537acda6a
5
protected void initFields() { if (fieldByName == null) { if (fieldStr == null) fieldStr = guessFields(); // No fields data? guess them. fieldNames = fieldStr.split("" + FIELD_NAME_SEPARATOR); fieldByName = new HashMap<String, Field>(); for (String fname : fieldNames) { try { if (!fname.isEmpty(...
7cc0cdea-50a4-4179-852a-d972611bbcc2
2
public void setupGame() { Dealer dealer = new Dealer(); Scanner input = new Scanner(System.in); System.out.println("How many players will be playing?"); while (!input.hasNextInt()) { System.out.println("Please enter a number!"); input.nextLine(); } numOfPlayers = input.nextInt(); addPlayers(numOfPl...
5937c30d-b6b3-40d4-8472-c7f360d535db
2
public BBZoomLevelHeader getZoomLevelHeader(int level) { if(level < 1 || level > zoomLevelsCount) return null; return zoomLevelHeaders.get(level - 1); }
e19e8cc5-c35d-4e0d-a7e7-06b1b8f5563e
2
private static void printBoatTable(ArrayList<ParkerPaulTaxable> taxables) { double totalTaxes = 0.00; // total taxes for items double minTaxes = -1.00; // min taxes for items double maxTaxes = 0.00; // max taxes for items int count = 0; // count of items printBoatHeader(); ...
c7ba71d1-7f5d-4e07-bbb6-10a4a5de6245
0
public void setUsername(String username) { this.username = username; }
2bd80925-b1cd-49f5-95f3-41a44c54f374
2
public BoyerMoore(String pattern, int R) { this.pattern = pattern; int M = pattern.length(); // initialize skip table right = new int[R]; for (int i = 0; i < R; i++) right[i] = -1; for (int j = 0; j < M; j++) right[pattern.charAt(j)] = j; }
39aa9143-b0a1-4898-b9d0-b5a099306477
0
public static File getGameDirectory(int serverIndex){ return new File(getWorkingDirectory(), Settings.serverNames[serverIndex]); }
056acaa8-8f96-42e1-aadb-4349ccb600e6
6
private void createFile(){ menuFile = new JMenu("File"); menuFile.setMnemonic('I'); menuBar.add(menuFile); //this is is really important. it fixes a bug. //when in full screen mode on 2nd monitor the JMenu appears on the wrong //monitor if the x location isn't specified menuFile.setMenuLocation(0, 50); ...
9c5cfc71-69c8-40a9-89d0-f6d6e4408e0b
4
public void writeLine(String line) throws IOException { String now = DATE_FORMAT.get().format(new Date()); if (line.indexOf('\n') >= 0 && line.indexOf('\n') < line.length() - 1) { write((String.format("%s\t\t%s:\n", now, name)).getBytes()); for (String l : line.split("[\\r\\n]+")) { write((String.format("...
998cc392-f663-4d85-843d-f5522a002ad5
5
@Override public void run() { long t = System.currentTimeMillis(); while (!salir) { if (data.size() > 0) { gui.printEcualizer(data.get(0)); long n = temp.get(0); ...
6f845f7a-cec1-45c8-b3e4-d38f5d41a975
5
private void generateBlock(int BlockID) { switch (BlockID) { case 0: generateIBlock(); break; case 1: generateLBlock(); break; case 2: generateOBlock(); break; case 3: ...
82ba7095-1037-403a-badf-8721fa4b7cd8
9
public static String eventuallyRemoveStartingAndEndingDoubleQuote(String s) { if (s.length() > 1 && isDoubleQuote(s.charAt(0)) && isDoubleQuote(s.charAt(s.length() - 1))) { return s.substring(1, s.length() - 1); } if (s.startsWith("(") && s.endsWith(")")) { return s.substring(1, s.length() - 1); } if (s...
b91e234a-860f-419c-bc95-2e99c0142ff7
9
public int calMaxPathSum(TreeNode root, int sum) { if (root == null) return sum; int leftSum = calMaxPathSum(root.left, sum); int rightSum = calMaxPathSum(root.right, sum); if (sum < 0) sum = root.val; int maxSumWithCurNode = root.val; if (rightSum > 0) ...
aa546463-11c9-4792-a23b-c13430f9817c
8
@Override public DialogFX build() { final DialogFX CONTROL = new DialogFX(); for (String key : properties.keySet()) { if ("buttonsLabels".equals(key)) { CONTROL.addButtons(((ObjectProperty<List<String>>) properties.get(key)).get()); } else if ("buttonsLabels1...
8d8640a3-7c8a-47b1-96d7-96136b383fca
8
public static ServerAddress func_78860_a(String par0Str) { if (par0Str == null) { return null; } String as[] = par0Str.split(":"); if (par0Str.startsWith("[")) { int i = par0Str.indexOf("]"); if (i > 0) { ...
f6fdd714-964e-4966-823c-3037e3046402
3
@Override public Token parse() { Token next = first.getNext(); if (!next.isOperator(Operator.BRACKET_LEFT)) throw new RuntimeException("Expected '(' after WHILE, found: " + next); next = next.getNext(); testExp = new BooleanExpression(next, scope); next = testExp.parse(); if (!next.isOperator(O...
5ec70e09-fe1d-495b-9ee9-4380c6bd6b88
0
@Override protected void setColoredExes() { // TODO Auto-generated method stub ParametricCurve ermit = new ErmitCurve(allex); coloredEx = ermit.Calculation(); }
5778328c-90ff-4301-a9ca-42b9f165a689
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...
275950d2-09c0-47c6-adb0-ae7eba772db5
6
public void applyRemovals(){ for (Body b : bodiesToRemove){ if (b != null) { if (b.getUserData() != null){ Entity e = (Entity) b.getUserData(); if(cam.getFocus().equals(e)) cam.removeFocus(); objects.remove(e); //ensures player still has access to the character //after hitt...
9c66ffeb-f471-44e4-934b-b104b65a00fe
2
public void rebondProjectilesStructuresLoop() { for (int j = 0; j < module.getListStructures().size(); j++) { for (int i = 0; i < module.getListProjectiles().size(); i++) { rebondProjectilesStructures(module.getListProjectiles().get(i), module.getListStructures().get(j)); } } }
7845bed7-3078-4dcc-bcdc-121e3b257a70
3
public void setAccounting(Accounting accounting) { setAccounts(accounting == null ? null : accounting.getAccounts()); setAccountTypes(accounting == null ? null : accounting.getAccountTypes()); setJournals(accounting == null ? null : accounting.getJournals()); }
40d966e8-0fdf-4669-8777-050f3050e57a
0
private long getDaysFromSeconds(long seconds) { return seconds / SECONDS_IN_A_DAY; }
99b30a8f-594e-47d2-8e0b-f38a2d8c0196
8
void setPickingStyle() throws ScriptException { checkLength34(); boolean isMeasure = (statement[2].tok == Token.monitor); String str = null; Token token = statement[statementLength - 1]; int tok = token.tok; switch (tok) { case Token.none: case Token.off: str = (isMeasure ? "measureoff" : "toggle"); ...
4070e09a-6393-4c38-8114-02419dcb7985
9
private void postPlugin(final boolean isPing) throws IOException { // The plugin's description file containg all of the plugin data such as name, version, author, etc final PluginDescriptionFile description = plugin.getDescription(); // Construct the post data final StringBuilder data = new StringBuilder(); ...
8fe91175-7f23-4af9-be54-570da83a5cf7
2
public void listRecordByPrescribedDate(String start_date, String end_date, int employee_no) { String selectQuery = "SELECT r.PATIENT_NO, t.TEST_NAME, p.NAME, r.PRESCRIBE_DATE " + "FROM TEST_RECORD r, PATIENT p, TEST_TYPE t " + "WHERE r.PATIENT_NO = p.HEALTH_CARE_NO " + "AND r.TYPE_ID = t.TYPE_ID " ...
f7418a3a-f42f-4b7d-b96d-385a0acddcc6
2
private List<CompositeState<TransitionInput>> collectCompositeStates(State<TransitionInput> state) { List<CompositeState<TransitionInput>> composites = new ArrayList<>(); for(CompositeState<TransitionInput> composite : state.getComposites()) { int insertionPosition = composites.size(); while(composite != nul...
53505a78-141c-4743-a7f4-2c4b180da98a
0
@Override public void setDbConnString(String dbconnstring) { this.dbconnstring = dbconnstring; }
054f74f3-ec68-4de5-b180-a504350747c3
1
public void envoyerDonnee(String donnee) { try { outStream.writeUTF(donnee); } catch(IOException ioe) { System.out.println(ioe); } }
5fccccb6-3f70-47c6-847d-87c1a4c7d5ab
2
private void loopUntilShutdown() throws Exception { while (true) { byte[] incoming = receive(); MessageHandler handler = new MessageHandler(incoming); if (handler.isShutdownMessage()) break; byte[] outgoing = handler.createResponseMessage(); ...
8367b7de-2e0c-41ec-8c9d-07af60946800
4
public void initialise() { // Instantiate a vector of TreeEntity's treeEntityVector = new Vector <TreeEntity>(); // Fill the vector with the relevant TreeEntity's if they exist. if(SafetyNet.getSlideShow() != null) treeEntityVector = SafetyNet.getSlideShow().getTree(); // Remove any current images if(i...
72a6dfd6-f8f7-4c1a-af17-b6a41e2c231e
8
public Transaction bindToTransaction(Map<String, String[]> parameterMap){ Transaction transaction = new Transaction(); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Calendar cal = Calendar.getInstance(); transaction.setTimestamp(dateFormat.format(cal.getTime()))...
b9ee9e05-946a-4763-938d-cb1b45ad1c18
1
public static String fileExt(File f) { String fileName = f.getName(); int i = fileName.lastIndexOf('.'); if (i > 0) { return fileName.substring(i+1); } return ""; }
5febe64a-5070-4c68-94f7-96b1c8ba8c70
9
public String encode(String plain) { //Assume plain has a length which is multiply of 25 //Need to generate a key of length x, 25x=length of plain // if(!is_valid(plain)) // return null; //add 'X' till the length is a multiply of 25 // if(plain.endsWith("mess")) /* if(plain.startsWith("thisi...
d782f662-388f-4886-a001-260ce477f80b
4
private void initMainFrameButtonActions() { mainFrame.getButtonGo().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (mainFrame.getAddressField().getText().isEmpty()) { mainFrame.getButtonGo().setEnabled(false); ...
f0f62138-496b-4e2d-8367-1dc749dc0672
6
private void createCellArray(String mapFile) { // Scanner object to read from map file Scanner fileReader; ArrayList<String> lineList = new ArrayList<String>(); // Attempt to load the maze map file try { fileReader = new Scanner(new File(mapFile)); ...
e83e8f85-022f-4d98-b525-1eabe3a523cb
3
@Override public void sort(int[] array) { for( int i = array.length-1; i > 0; i--){ for (int j = 0; j < i; j++) { if(array[j]>array[j+1]){ swap(array, j ,j+1); } } } }
1afd764d-be0b-4039-af13-35c17c0029c2
7
private void masaSureKontrol(){ System.out.println("111111"); for(Bilgisayar b : bilgisayarlar){ if(b.getDurum() == Bilgisayar.Durum.SURELI_ACIK || b.getDurum() == Bilgisayar.Durum.SINIRSIZ_ACIK){ if(b.gecenSureyiArtir()){ suresiBitmisDurumaAl(b); ...
0c2a2cee-ef7e-4ada-bede-d1ee0851338a
4
public List<TileType> getRelatedTileTypes(TileType tileType) { List<TileType> relatedTileTypes = new ArrayList<TileType>(); for (TileType t : tileTypes) { for (String s : tileType.getTags()) { if (!s.equals("COMMON") && t.getTags().contains(s)) { relatedTi...
443382dd-732a-4388-bea7-325be605cda3
7
public void update() { tryattack(); xa = 0; ya = 0; if (!attacking) { randommovement(); } if (anim < 40) anim++; else { anim = 0; } if (xa != 0 || ya != 0) { walking = true; move(xa, ya); } else { walking = false; } if (hit) { if (anim2 < 40) anim2++; else { an...
b8d6aa8d-c48c-460c-a0d0-9446485f4ab0
9
public static void main(String[] args) { BaseAccount[] list = new BaseAccount[5]; list[0] = new SavingsAccount("Fred"); list[1] = new ChequeAccount("Jim"); list[2] = new ChequeAccount("Sue"); list[3] = new SavingsAccount("Jim"); list[4] = new SavingsAccount("Jill"); ...
121b966f-1cf6-497d-9c39-054d19e3dd2b
2
@Override public void run() { while(true) { try { String s = "up pressed: " + isUpPressed + ", down pressed: " + isDownPressed + ", spacePressed: " + isSpacePressed; f.setTitle(s); ...
465633a3-d7e6-4a8b-afad-cc4e8af96521
0
public String getName() { return name; }
42ab88b1-5d76-40c6-9ed1-c0b81b0bbf8b
6
static double grad(int hash, double x, double y, double z) { int h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE double u = h<8 ? x : y, // INTO 12 GRADIENT DIRECTIONS. v = h<4 ? y : h==12||h==14 ? x : z; return ((h&1) == 0 ? u : -u) + ((h&2) == 0 ? v...
430de85a-c5b1-43c4-81ca-534f8de43869
9
@Override public Object getMetaPacket(Object watcher) { Class<?> DataWatcher = Util.getCraftClass("DataWatcher"); Class<?> PacketPlayOutEntityMetadata = Util.getCraftClass("PacketPlayOutEntityMetadata"); Object packet = null; try { packet = PacketPlayOutEntityMetadata.getConstructor(new Class<...
58621669-e002-44aa-bc8d-801a4d70ef7a
5
public static boolean moveFile(File src, File dest, boolean eraseOldDirs) { makeDirs(dest); if (!src.renameTo(dest)) { return false; } if (eraseOldDirs) { while ((src = src.getParentFile()) != null) { if (src.isDirectory() && src.listFiles().length == 0) { src.delete(); } else { break; }...
8155ec8e-f167-49af-aac2-39e64125f1ed
2
private void lockProgrammProcess(Shell shell) { System.out.println("Try to get program lock"); initDataDir(); File locker = new File(VCNConstants.LOCK_FILE_PATH); locker.delete(); boolean isAlreadyLocked = locker.isFile(); if (isAlreadyLocked) { MessageOKDialog md = new MessageOKDialog...
d211b937-5290-43db-bf83-a75fb44fca63
6
@EventHandler public void SilverfishHarm(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.getSilverfishConfig().getDouble("Silverfis...
798e06de-2379-46ad-91cf-07036b54711b
5
private void addToValidPositions(Unit unit, List<Position> validPositions, MovementHelper helper, List<Unit> units) { boolean hasDifferentColorUnit = false; if (units == null) { return; } for (Unit otherUnit : units) { // If the unit has a different color if (!unit.get...
068ca8d6-e306-43a5-a4a0-db588affcc37
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; User user = (User) o; if (ip != null ? !ip.equals(user.ip) : user.ip != null) return false; if (mac != null ? !mac.equals(user.mac) : user.mac ...
62be40d7-b0f3-4d2a-ac75-ec9b2cb150d2
3
public TerrainService clone() { TerrainService t = super.clone(); for(int i=0;i<super.getNombreColonnes();i++) { for(int j=0; j<super.getNombreLignes(); j++) { if(!(t.getBloc(i, j)==super.getBloc(i, j))) throw new PostConditionError("getNombresColonnes(clone(T)) != getNombresColonnes(T) * getNombresLign...
47eacb43-a61d-4255-bf27-d76a057900a9
2
public static void main(String[] args) { String number = "12"; System.out.println("test val : "+(0-'0')+","+((0-'0')-'0')+",'0' is "+('0')); int sum = 0; for (char c : number.toCharArray()) { sum = sum - (0 - c) - '0'; while (sum >= 3) { sum -= 3; } } ...
335595c5-9154-48cb-906e-4b5fb207723d
2
public static String[] getOptionValues(String option) { // Try and parse the list on the ";" separator. String arguments_to_parse = null; if (CommandLineUtilities._command_line.hasOption(option)) arguments_to_parse = CommandLineUtilities._command_line.getOptionValue(option); if (CommandLineUtilities._proper...
b3432cdf-814e-4f64-b9ce-fe2d1d19c42a
8
private boolean r_postlude() { int among_var; int v_1; // repeat, line 70 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 70 ...
1bdbc1ec-8053-4455-9362-cb7b43027ced
6
private void envoyerFichier() { try { File file = new File(this.pCheminCible); // Ouverture file if (file.exists() && file.canRead()) { //file dans stream Http.syslog.info("file content:" + this.pCheminCible); setStatus(CodeResponse.OK.g...
b4f0c219-3e7b-473f-a9ac-a9fc942b71c3
5
public static void deleteWorld(int ID) { if (ID < 0 || ID > 4) { if (ChristmasCrashers.isDebugModeEnabled()) System.err.println("Failed to delete world " + ID + " - invalid world ID (must be between 0 and 4, inclusive)."); return; } if (worlds[ID] == null) { if (ChristmasCrashers.isDebugModeEnabled()...
df2bd63c-80f3-4c1b-9abf-f213b5207f8b
9
public int countTokens(String line, int ich) { int tokenCount = 0; if (line != null) { int ichMax = line.length(); char ch; while (true) { while (ich < ichMax && ((ch = line.charAt(ich)) == ' ' || ch == '\t')) ++ich; if (ich == ichMax) break; ++token...
f34798fd-9c5d-4580-b4df-7f7084ef0d9c
7
public Set<Pair> getHBonds() { // positions that are bonded together //TODO: find ideal way Set<Pair> hBonds = new HashSet<Pair>(); Set<Integer> usedPoints = new HashSet<Integer>(); int i = 0; for(Iterator<Point> iter = this.iterator(); iter.hasNext();) { Point p = iter.next(); RNABasePair pair = this.g...
b860a3d6-bea5-4f50-861e-ee76a9acdfb9
8
String fileTypeString(int filetype) { if (filetype == SWT.IMAGE_BMP) return "BMP"; if (filetype == SWT.IMAGE_BMP_RLE) return "RLE" + imageData.depth + " BMP"; if (filetype == SWT.IMAGE_OS2_BMP) return "OS/2 BMP"; if (filetype == SWT.IMAGE_GIF) return "GIF"; if (filetype == SWT.IMAGE_ICO) return...
7f7c86ca-3aeb-4877-84ec-946ce95c5347
3
public void PlayerFileAccessor(JavaPlugin plugin, String fileName) { if (plugin == null) throw new IllegalArgumentException("plugin cannot be null"); if (!plugin.isInitialized()) throw new IllegalArgumentException("plugin must be initiaized"); this.plugin = plugin; this.fil...
c43992dc-b485-4059-b9d8-dd5a4f6a2e52
1
public void remover(AreaConhecimento areaconhecimento) throws Exception { String sql = "DELETE FROM areaconhecimento WHERE id = ?"; try { PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql); stmt.setLong(1, areaconhecimento.getId()); stmt.executeUpdate(); } catch (SQL...
d07c24eb-5c0d-4591-b7fc-2dc4aae6844e
8
private boolean r_postlude() { int among_var; int v_1; // repeat, line 62 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 62 ...
0808aec0-7757-41f4-a19a-d680a7ff13a0
5
public static void main(String[] args) throws IOException { if(args.length != 2 || args[0].equalsIgnoreCase("help")) { System.out.println("Argument is empty! Please provide the path of the input.txt"); System.out.println("B-Tree Path/to/input.txt Path/to/output.txt"); return; } FileOutputStream fos...
b236f3e4-8ae9-4526-a7d8-255872353ce5
2
public static MetaData parseMap(final Reader xmlStreamReader, final Parser pzparser) throws JDOMException, IOException { final Map map = parse(xmlStreamReader, pzparser); final List<ColumnMetaData> col = (List<ColumnMetaData>) map.get(FPConstants.DETAIL_ID); map.remove(FPConstants.DETAIL_ID); ...
ee4325b6-f6f0-4b00-9bb1-f07439cdc7c4
9
public void actionPerformed(ActionEvent e) { Object o = e.getSource(); // if it is the Logout button if(o == logout) { client.sendMessage(new ChatMessage(ChatMessage.LOGOUT, "")); return; } // if it the who is in button if(o == whoIsIn) { client.sendMessage(new ChatMessage(ChatMessage.WHOISIN, ""))...
9d84fc6b-f58e-423f-b468-940cdefbefe0
4
private boolean allWagonsLoaded() { boolean condition = true; java.util.List listOfWagons = getWorld().getObjects(Wagon.class); if(listOfWagons.size() > 0){ for(int i = 0; i < listOfWagons.size(); i++) { Wagon x =(Wagon) listOfWagons.get(i); ...
16cadef2-ecfe-4da0-a8fe-274b4124e7b7
4
private void searchIndex() { // if at least one file has been parsed if( fileIndex.numOfFilesParsed() != 0 ) { // show an input dialog box and get the file name from user String searchWord = (String) JOptionPane.showInputDialog( new J...
1c58af89-d147-4586-a6ad-c6a2bc2f6fed
5
public short[] naive(Node[] nodes) { short[] tour = new short[nodes.length]; boolean used[] = new boolean[nodes.length]; used[0] = true; for (short i = 1; i < nodes.length; i++) { short best = -1; for (short j = 0; j < nodes.length; j++) { if (!used[j] && (best == -1 || dist(tour[i - 1], j, nod...
4856598b-a81a-4855-9449-45180586b650
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; BSTNode bstNode = (BSTNode) o; if (value != null ? !value.equals(bstNode.value) : bstNode.value != null) return false; return true; }
95f6ac8b-e978-4589-b201-d2954a5a879b
7
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(!sender.hasPermission(pluginMain.pluginManager.getPermission("thf.kick"))){ sender.sendMessage(ChatColor.DARK_RED + "You cannot KICK ME!"); return true; } if(args.length == 0){ sender.sendMessa...
1adee2c7-aa2d-44af-8d5f-d79542d87ad8
7
public void run() { MessageHandler<E> p = null; try { p = c.newInstance(); } catch (InstantiationException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } cat...
c270db26-5616-449c-8b5c-9f5d6f484287
3
public Object rest() { if (size() == 0) { throw new RuntimeException("Cannot remove first element of an empty list."); } else if ((super.size() == 1) && (!this.isProperList)) { return this.getDottedElement(); } final CycList<E> cycList = new CycList<E>(this); cycList.remove(0); retur...
3a4fa2d9-4c99-4e6d-b2c6-2471436c4564
4
public List<Type> levelOrderBFT() { ArrayList<Type> result = new ArrayList<Type>(); LinkedList<BinaryNode> queue = new LinkedList<BinaryNode>(); if(root == null) return result; queue.addLast(root); while(!queue.isEmpty()){ BinaryNode n = queue.removeFirst(); result.add(n.getData()); if(n.get...
68a65561-fd52-40be-9782-001abf4fc6f8
3
static <E extends Enum<E>> String toString(EnumSet<E> set) { if (set == null || set.isEmpty()) { return ""; } else { final StringBuilder b = new StringBuilder(); final Iterator<E> i = set.iterator(); b.append(i.next()); for (; i.hasNext();) { b.append(',').append(i.next()); } retu...