method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
17f547b5-df2f-4981-8c9a-6db15f5a7f49
1
protected boolean controlSizeInputLength(JTextField textfield, int maxLength) { boolean ret = true; String tmp = textfield.getText(); if (tmp.length() > maxLength) { textfield.setText(tmp.substring(0, maxLength)); ret = false; } return ret; }
04a65ec5-5db2-437f-a391-bb1ee6cc011b
1
public void executeQuery (String query) { try { Statement statement = conn.createStatement(); statement.execute(query); statement.close(); } catch (SQLException e) { System.err.println("MySQL Error: " + e.toString()); } }
c8ddd774-dc0f-463b-9f43-2aee51e92618
7
public void eat(int foodId, Pet npc) { if (npc != player.getPet()) { player.getPackets().sendGameMessage("This isn't your pet!"); return; } Pets pets = Pets.forId(itemId); if (pets == null) { return; } if (pets == Pets.TROLL_BABY) { if (!ItemConstants.isTradeable(new Item(foodId))) { player....
6fcf1b29-5829-44bf-8977-5e98ac7bc749
5
public boolean equals(Object obj) { Deals deal = (Deals) obj; if (this.dealId != deal.dealId){ return false; } if (this.merId != (deal.getMerId())){ return false; } if (this.catId != deal.getCatId()){ return false; } if (this.title.equals(deal.getTitle())){ return false; } if (this.dis...
e698d7a3-68d9-434c-9064-f69a769ef668
1
public static void main(String[] args) throws IOException { encodeCombined encoder = new encodeCombined(); BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]))); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(args[1]))); int c; w...
66fc5072-b6e8-452d-8a6c-78d2c92afc88
2
public void setChecked(Production production, boolean checked) { Integer r = (Integer) productionToRow.get(production); if (r == null) return; int row = r.intValue(); Boolean b = checked ? Boolean.TRUE : Boolean.FALSE; data[row][1] = b; ((DefaultTableModel) getModel()).setValueAt(b, row, 1); }
275d9de4-741c-492c-8450-f029fdd95972
2
public static WaterSubmodesOfTransportEnumeration fromValue(String v) { for (WaterSubmodesOfTransportEnumeration c: WaterSubmodesOfTransportEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
b6c3d76c-5bea-4048-b70b-a63d564347b2
4
private void handleCollision(BallModel ball) { int close = 3; if (ball.getCenterPosX() - ball.getDiameter() > pos.getX() && ball.getPosX() > pos.getX() + blockWidth + close) { ball.setPosX(pos.getX() + blockWidth); ball.invertVelX(); } if( ball.getPosY() > pos.get...
d82ed946-a8fc-45a9-b130-a05feeb934e2
4
@Override public boolean equals(Object obj) { if (obj instanceof Rectangular) { Rectangular r = (Rectangular) obj; return r.x1 == x1 && r.y1 == y1 && r.x2 == x2 && r.y2 == y2; } else return false; }
6fda1ea2-2274-40de-9837-d38ec15c64e7
7
public void recoverFiles(javax.swing.JList list, String path) throws FileNotFoundException { if (!list.isSelectionEmpty()) { int indices[] = list.getSelectedIndices(); System.out.println("Jumpto value: " + jumpto + "\t\tAll foundAt relative to this"); byte ar[] = new byte[512...
c66aedea-2d23-4f3a-8bac-2a362adab11c
4
public void contact(Subject s) { if (s == null) { return; } // The neighbor is not infected if (!s.isInfected()) { // The neighbor can be infected if (Config.getProperty(disease.toString().concat(".Infection.") .concat(toString(...
7efe573e-64de-4311-848c-70e170643e46
0
public static void setXYasVertex(boolean b) { XYVertex = b; }
ffd7b2d5-97bb-4d06-ba2b-0899b9620727
3
public void pollInput() { if (Screen.getInput().backspace.clicked) { if (msg != "") { if (!(msg.length() <= 0)) msg = msg.substring(0, msg.length() - 1); } } }
5cec3d26-bfc3-460f-a44d-14ab83a8b260
3
@Override public Membre insert(Membre obj) { PreparedStatement pst = null; try { pst = this.connect().prepareStatement("INSERT INTO Membre (email,nom,prenom,mdp,status,id) VALUES (?,?,?,?,?,?);"); pst.setString(1, obj.getEmail()); ...
3a7fe999-ce9a-445c-98b2-ab1751631cc9
0
public String getTicketStatus() { return ticketStatus; }
5683b75f-f0c9-4912-b0b4-93fd4da2561e
0
public static String decrypt(String seed, String encrypted) throws Exception { byte[] keyb = seed.getBytes("UTF-8"); MessageDigest md = MessageDigest.getInstance("MD5"); byte[] thedigest = md.digest(keyb); SecretKeySpec skey = new SecretKeySpec(thedigest, "AES"); Cipher dcipher = Cipher.getInstance("AES/...
b549c6db-fd61-4655-a745-7fd98914d8a6
7
@Override public void executeMsg(Environmental affecting, CMMsg msg) { super.executeMsg(affecting,msg); final MOB source=msg.source(); if(!canFreelyBehaveNormal(affecting)) return; final MOB observer=(MOB)affecting; if((source!=observer) &&(msg.amITarget(observer)) &&(msg.targetMinor()==CMMsg.TYP_GI...
88d2802f-b8da-4679-ac30-11cecbfa2021
9
private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_...
2dd06103-60b1-4d96-b106-089fe437f48b
7
boolean checkFilters(Headline headline) { if (_regexFilter == null || _regexFilter.equals("")) { return true; } StringBuilder s = new StringBuilder(); s.append(" "); s.append(((headline.getAttribution() == null) ? " " : headline.getAttribution())); ...
4444f119-938c-49f2-a57d-2fc413697aaa
6
private ArrayList<String> getCommandPage() { List<String> commands = new ArrayList<>(); List<String> usage = new ArrayList<>(); Plugin[] plugins = plugin.getServer().getPluginManager().getPlugins(); PluginDescriptionFile file = null; try { for (Plugin p : plugins) { ...
4bba43a9-a8d8-496d-8129-bfe338bdab89
7
public void testEdgeMethodsExceptions() throws Exception { Graph<String, Integer> graph = newGraph(); try { graph.containsEdge("Delhi", "Mumbai"); fail(); } catch (IllegalArgumentException e) { } try { graph.removeEdge("Delhi", "Mumbai"); ...
ef9138b6-22f7-4252-a573-de55b87e5336
0
public void setMobilePer(String mobilePer) { MobilePer = mobilePer; }
d60670bd-cf26-4ae2-86a5-808b68b78f52
4
protected boolean checkForUndefinedCliParameters() { boolean allValid = true; for (String paramName : commandLine.getOptions()) { boolean currentValid = false; for (IOption parameter : root) { if (parameter.getName().equals(paramName)) { cur...
c98df32b-c1a8-4c5f-9156-fcf854f1654e
7
protected boolean attack(int[] damages, BaseEntity enemy, int r, int c) { if (enemy.health - damages[0] <= 0 && health - damages[1] <= 0) //Both may kill each other { if (health >= enemy.health) { if (!(enemy instanceof City)) location.grid.removeUnit(enemy); health = 1; return true; } ...
cbbfb20d-78c6-4158-8ecc-d241c1fbb327
6
private void nonGenerationalCrossover(int[] parents) { int crossoverPoint = rand.nextInt(geneSize); int[][] children = new int[2][geneSize]; int[] child = new int[geneSize]; int leftIndex = 0; int rightIndex = 0; if(rand.nextInt(10000) > 10000/2) { leftIndex =...
8c4c5662-9056-4b6e-8a69-fe3b3927d2e9
0
public OutlineMoveableIndicator(OutlinerCellRendererImpl renderer) { super(renderer, GUITreeLoader.reg.getText("tooltip_toggle_moveability")); }
6c6dc7f2-d882-4007-89d0-41745196594d
6
public List<Message> getMessagesTo(String recipient, int nbMes){ List<Message> res = new ArrayList<Message>(); for(Message msg : recentMessages){ if(msg.getRecipient().contains(recipient)){ res.add(msg); } } int logInd = 0; while(res.size() < nbMes && logInd < logs.size()){ List<Mess...
5ccfb389-5fb9-4b88-b474-d6079ba087ab
0
public void up(int velocity) { controls.up(velocity); }
a8ca93dd-732b-45fa-9291-3a789f4fd658
8
public void draw(Graphics2D g2d) { for(int i = 0; i < 256; i ++) for(int j = 0; j < 256; j ++){ if(hull[i][j] != null) { double[] transformed = transform(i*32,j*32); AffineTransform trans = AffineTransform.getTranslateInstance(transformed[0]+x, transformed[1]+y); trans.concatenate(AffineTr...
d23c36fc-ec40-4ed6-a821-be8f83113491
5
public void read_input(String file_name) { File file = new File(System.getProperty("user.dir") + "/inputs/" + file_name); BufferedReader file_reader = null; try { file_reader = new BufferedReader(new FileReader(file)); String line; while( (line = file_reader.readLine()) != null) pars...
37169a0d-1870-483d-b2a5-c978ce5df547
3
@Override public List<User> getAll() throws SQLException { List<User>users = null; Session session=null; try{ session=HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); users = session.createCriteria(User.class).list(); session.getTransaction().commit(); }catch(Exceptio...
177bef60-c6d5-4eb6-b8f7-881d4a8184be
0
public void setLilium(int lilium) { this.lilium = lilium; }
e9a10758-9f38-45ff-b6f0-c6a28740c599
9
private void updateStateTellSteps(List<Keyword> keywords, List<String> terms) { //We should have come here by a keyword jump and the recipe shouldve been passed or set if (keywords != null && !keywords.isEmpty()) { for (Keyword kw : keywords) { if (kw.getKeywordData().getType() == KeywordType.RECIPE) { currR...
e32976a7-543c-41fa-b57a-961e7b770f46
8
public static void main(String[] args) { int val1,val2,no=-1; float c; //String d; //char oper; Scanner in=new Scanner(System.in); while(no!=0) { System.out.println("Enter the 2 numbers to perform calculations"); val1=in.nextInt(); val2=in.nextInt(); System.out.println("Now Press\n '1' for ...
febe673f-bf2d-4296-9fdb-bc44be11424b
0
public boolean hasFile(String name) { return new File(plugin.getDataFolder() + File.separator + "Players" + File.separator + name + ".data").exists(); }
1032f95a-b75b-4524-a50f-d356316fbd38
5
@Override public Object callOperationSynchronously(String operationName, Object... arguments){ OrocosOperation operation = getOperation(operationName); Any[] anyArguments = castOperationArguments(operation, arguments); CAnyArgumentsHolder holder = new CAnyArgumentsHolder(anyArguments); try { Any result =...
7bfcfff4-174d-4797-8fd8-2d1fd6899641
2
public FFT(double[] timeData) { while (power2Size < timeData.length) { power2Size <<= 1; } System.out.println("arraysize: " + timeData.length); System.out.println("pow2 size: " + power2Size); this.dataToTransform = new double[power2Size]; createZeroFilledArrayForFFT(timeData); transformedData = compu...
196c141a-a563-453e-9b1c-b6636a6de2a6
6
protected void generateLevel() { int rand; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { rand = random.nextInt(100); if (rand < 60) tilesInt[x + y * width] = 0; else if (rand < 80) tilesInt[x + y * width] = 1; else if (rand < 90) tilesInt[x + y * width] = 2;...
cf1562c3-259a-4680-93a5-8b9ce1229103
6
private void setPath(){ ArrayList <ArrayList <Integer>> finalPath = new ArrayList <ArrayList <Integer>>(); if (flyingLevel){ //flying level path is always the same finalPath = flyingPath; } else{ //generates the 3 paths for each checkpoint finalPath....
a460baa1-8874-41a2-b5c3-74c462cbee9c
3
public void addChild(String rootTaxonName, String taxonName, TaxonRank taxonRank){ TaxaNode newNode = null; TaxaNode nodePointer = null; TaxaNode father = null; // check if the element is already in the tree if (null != this.nodeList.get(taxonName)) return; // nodePointer = this.nodeList.g...
cf3714ea-da84-4718-8141-6a8650381c50
9
public List<FoodDataBean> getSearchArticles(int start, int end,String search, String val, int area) throws Exception{ Connection conn = null; Statement stmt = null; ResultSet rs = null; List<FoodDataBean> articleList = null; try{ conn = getConnection(); val = new String(val.getBytes("iso_8859-1"),"utf-8...
ec3314da-3711-4955-b9bc-75c1878528d4
8
public Usuario validarUsuario(String login,String password) throws ServletException{ System.out.println(" +T.U.:validarUsuario("+login+","+password+"): Validando usuario..."); Usuario usuario=null; Statement stmt=null; ResultSet rset=null; if(login==null)throw new ServletException("el login es nulo en t...
e91a7414-d096-40f4-a8aa-42b4349f482f
4
@Test(groups = { "Integer-Sorting", "Fast Sort" }) public void testMergeSortInt() { Reporter.log("[ ** Merge Sort ** ]\n"); try { testSortIntegers = new MergeSort<>( fastShuffledArrayInt.clone()); Reporter.log("1. Unsorted Random Array\n"); timeKeeper = System.currentTimeMillis(); testSortInte...
e16be78c-f965-486a-ac9c-56d5b7c97d53
5
public boolean check() { if (commandLine == null) { throw new RuntimeException("No command line arguments given. Use setArguments()."); } boolean valid = checkForUndefinedCliParameters(); fillInCliValues(); if (valid) { valid &= root.isValid(); // visit ...
2dadb666-d81a-4b37-8a1b-3c258b11995d
0
public JToolTip createToolTip() { return new gui.JMultiLineToolTip(); }
bbfd36ac-fbcb-4f01-859c-62e84a098b89
0
private void setSpecialArrangement(){ int a=0; String b="123"; //Clinic.setSpecialArrangement(a,b); }
09fc9756-4dea-4036-b656-03b050083a9e
1
private void button1MouseClicked(MouseEvent e) { // TODO add your code here if (comboBox1.getSelectedIndex() == 0) { double x = new GoldenRatio(-0.5, 0.5, Double.parseDouble(textField2.getText())).calculate(new Function10()); // double x = new QuadraticApproximation(-0.5, 0.5, Dou...
94431d5a-c48f-4543-b24d-b55709d5abb8
1
@Override public double arvo() throws IllegalStateException { if (!super.laskettavatAsetettu()) { throw new IllegalStateException(); } return super.getEtujasen().arvo() + super.getTakajasen().arvo(); }
c36c4e60-d3d7-4861-a507-2bbc06f10581
5
private Object handleConverterNotFound(Object source, Class<?> sourceType, Class<?> targetType) { if (source == null) { assertNotPrimitiveTargetType(sourceType, targetType); return null; } if (targetType.isAssignableFrom(sourceType) && targetType.isInstance(source)) { return source; } throw new Illeg...
f85072d0-a614-44dc-88b9-2e19fdcfeeb6
8
public static RNASecStr loadSecStrDBN(String path) { try { BufferedReader fr = new BufferedReader(new FileReader(path)); String line = fr.readLine(); String seqTmp = ""; String strTmp = ""; while((line!= null)&&(strTmp.equals(""))) { line = line.trim(); if (!line.startsWith(">...
45d28c39-c3fe-40ca-bf38-e3e990a9849d
2
public static boolean hasMove(Pokemon pokemon, Pokemon.Move move) { boolean has = false; for (int i = 0; i<4; i++) { if (pokemon.move[i] == move) has = true; } return has; }
8151bc00-aab5-45e1-a713-918d5d638711
6
public void run() { System.out.println("Admin server initialized, listening on port " + m_serverSocket.getLocalPort()); while( true ) { try { m_socket = m_serverSocket.accept(); byte[] buffer = new byte[40960]; Pattern userPwdPattern = Pattern.compile("username:(\\S+)\\s+password:(\\S+)\\s+com...
57edfa45-6741-4b9d-8224-93199967af2f
4
@Test public void testDisproveSuggestionOnePlayerTwoMatch() throws BadConfigFormatException { // 3 possible targets one step from 13,16 ComputerPlayer player = new ComputerPlayer("test","yellow",board.getCellAt(board.calcIndex(13, 16))); // give player 6 known cards player.getCards().add(mustardCard); playe...
2be51764-af9c-4080-92ef-50b6cfe3ac40
6
public Player getOfflinePlayer(String name) { File playerfolder = null; Player player = null; Player onlinePlayer = Bukkit.getServer().getPlayer(name); if (onlinePlayer != null) { player = onlinePlayer; return player; } try { playerfolder = n...
432f1a24-0d01-414d-b133-6ec54afbd631
9
private void generateTables() { /* Initialise the cbits array */ ProteinProducer.cbits = new int[2][tfGenes.length+pGenes.length][tfProteins.length]; for (int i = 0; i < 2; i++) for (int j = 0; j < tfGenes.length + pGenes.length; j++) for (int k = 0; k < tfProteins.length; k++) Prote...
f1bc41f3-c1e2-46a0-8a05-e9eeebd000e0
5
public static ExpansionDecisions calculateIdealExpansion(BotState state, SuperRegion superRegion) { ExpansionDecisions out = new ExpansionDecisions(); List<Region> missingRegions = superRegion.getMissingRegions(state); /* * If it's not possible for us to take the SuperRegion in one turn due * to not all mis...
462f70ca-120b-40a2-986e-c1d12d15a20e
6
@EventHandler public void WolfHeal(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.Heal.DodgeChance...
08914820-7b19-4aa8-bf3d-31d3dcc3b088
5
@Override public Action getAction() { if(FRONT == Type.EMPTY) { int bleh = random1.nextInt(100); if(bleh <= 25) return Action.TURN_RIGHT; else if (bleh > 25 && bleh < 50) return Action.TURN_LEFT; else return Action.HOP; } else if(FRONT == Type.OTHER) { return Action....
4d52ecfb-c82b-4c3a-9281-fa0be73ca3aa
6
private void updateTexture(int limit) { _timer += 1.0 * _REFRESH_POS / 5; if (_timer > limit) { ++_statutTexture; if (!isDestructing()) { if (_arriere) { if(_statutTexture >= _liste_texture_back.size()) { _statutTexture = 0; } _texture = _liste_texture_back.get(_statutTexture);...
b0ab4828-c762-40f9-b66d-727f83d8d6c7
2
private int findFreeId() { for (int i=vortexSpaces.length-1; i>=0; i--) { if (vortexSpaces[i] == null) { //check if null's have to be put return i; } } int onGoingId = vortexSpaces.length; doubleSize(); return onGoingId; }
f9e7cd57-c405-4528-89e9-86495281bb40
5
public ArrayList<Entry> getNextEntriesForUsers(ArrayList<User> listOfUsers, ArrayList<Entry> listOfEntries) { boolean foundNext = false; int index = 0; Entry entry; ArrayList<Entry> listOfNewEntriesForUser = new ArrayList<Entry>(); for (User user : listOfUsers) { foundNext = false; while (!foundNe...
b75d9eee-9065-4349-b2c5-e4f555408e70
4
public static void main(String[] args) { // set number of tests and quizzes int[] tests = new int[2]; int[] quizes = new int[3]; // input test scores, quiz scores, and homework average. System.out.println("Please enter your test grades."); for (int t = 0; t < tests.length; t++) { System.out.println("Test...
0da1e2f3-909e-4fb6-acaa-e36700a2bd7d
5
private final int gen_caps_delta(int index, int[] delta, int nDelta, boolean sliding, Move[] moves, int startIndex) { int moveIndex = startIndex; // Record the board's en passant square, white/black castling rights and // half-moves for (int i = 0; i < nDelta; i++) // Loop through the 8 possible deltas { ...
6fcb293d-3b45-4253-af03-16ded3d45122
3
@Override public void alterarIntNota(ItensNota intensNot) throws ClassNotFoundException, SQLException, Exception { dados.alterarIntNota(intensNot ); if(intensNot.getQtdComprada()<=0){ throw new ItensNotaException("Quantidade Comprada nao pode ser menor ou igual zero"); } ...
b24c062c-cb0a-40c6-9bf8-e7db718f2b3b
9
public double[] prob(int[] ps, int pos) { double[] p = new double[4]; double[] r = new double[4]; double[] q = new double[4]; for (int g = 0; g < windowsize; g++) { if (true) { p[0] = 1.0; p[1] = 1.0; p[2] = 1.0; for (int i = g + 1; i < windowsize; i++) { p[0] += model[0][ps[pos]][ps[pos...
d6f9694d-9dee-400f-bfa8-c58983d3f696
4
private void berekenBotsing(ArrayList<Positie> baan, HashMap<String, HashSet<Positie>> elementen){ ietsGeraakt = false; for(int i = 1; i < baan.size(); i++){ for(String id : elementen.keySet()){ for(Positie posElement : elementen.get(id)){ if(baan.get(i).e...
4a5d89a0-aaea-433a-a985-5fdb5637d779
7
public static void main(String[] args) { System.out.println("Starting network example ..."); try { ////////////////////////////////////////// // First step: Initialize the GridSim package. It should be called // before creating any entities. We can't run ...
c4d4709c-098d-4de4-b893-3708bf1e7515
5
public void personGuess() { System.out.println("\n------------------------------"); System.out.println("PLAYER'S TURN"); System.out.println("------------------------------"); int choice; boolean readGuess = true; reportHand(); choice = getInt( "Enter the number of the card you would like to inquire about" ); ...
7f7d83af-54a1-4502-a67b-01c45084d5e8
9
public static boolean checkInequality(String str){ str = str.trim(); INEQUALITY inequalityType = isInequality(str); if(inequalityType == INEQUALITY.EMPTY){ throw new RuntimeException("this is not inequality in [ ] block!"); } List<String> lexems; if(ineq...
e89741d8-0259-419d-a926-07286c22d85d
9
public Object[] parseParameters(String parameterString) { boolean isQuoteEnclosed = false; int bracketLevel = 0; List<Object> parameters = new ArrayList(); int index = 0; String currentParameter = new String(); while (index < parameterString.length()) { cha...
8acc25da-e65c-43fc-bd41-b5318f1d03f9
1
public static void main(String[] args) { Properties p = System.getProperties(); for (Map.Entry<Object, Object> entry : p.entrySet()) { System.out.println(entry.getKey() + " -> " + entry.getValue()); } System.out.println(); System.out.println("File separator is: " + p....
250704cf-410d-4536-bb82-0444becfbd75
7
public String[] getOptions() { String[] superOptions = super.getOptions(); String[] options = new String[4 + superOptions.length]; int current = 0; if (getMarkovBlanketClassifier()) options[current++] = "-mbc"; options[current++] = "-S"; switch (m_nCVType) { case (LOOCV) : options[current++] =...
f13da29c-1e26-4fd3-9c26-acc87169b5dd
8
public void testConstructor_int_int_int_int() throws Throwable { TimeOfDay test = new TimeOfDay(10, 20, 30, 40); assertEquals(ISO_UTC, test.getChronology()); assertEquals(10, test.getHourOfDay()); assertEquals(20, test.getMinuteOfHour()); assertEquals(30, test.getSecondOfMinute()...
c5a95f17-33bb-421e-8044-ce1c3f971482
3
void readFile(String fastqFileName) { // Initialize seqIndex = new SequenceIndexer<DnaAndQualitySequence>(new DnaQualSubsequenceComparator(false)); references = new ArrayList<Long>(); int referencesPerSequence = 10; int seqIdx = 0; // Read file for( Fastq fastq : new FastqFileIterator(fastqFileName, Fast...
8197cd41-5a4c-4b19-9bd5-5f563302a1a5
2
public void initialiseGrid(Grid gameGrid) { grid.getChildren().clear(); int size = gameGrid.getGridSize(); for (int y = 0; y < size; y++) { for (int x = 0; x < size; x++) { ImageView iv = gameGrid.getSquare(x, y).getImageView(); grid.getChildren().add(...
d07d407a-0e77-4c5b-865e-91816ec32cf5
3
public List<String> getRecources() { List<String> f = new ArrayList<String>(); for (String s : l) { File sf = new File(s); File parent = sf.getParentFile(); if (!parent.exists()) { throw new IllegalArgumentException("Not found: " + parent); ...
c3d78e60-1fce-42d6-86b4-7891120eae4b
7
@Override public String toString() { switch (this) { case NO_TIMER: return Messages.getString("noTimer"); //$NON-NLS-1$ case BRONSTEIN_DELAY: return Messages.getString("bronsteinDelay"); //$NON-NLS-1$ case FISCHER: return Messages.getString("fischer"); //$NON-NLS-1$ case FISCHER_AFTER: return ...
ab9e4494-ebed-4968-8b9d-1045769a18a0
8
private static void parseCommandLine(String[] args) throws IOException, NumberFormatException { for (String arg : args) { String[] vals = arg.split("=", 2); String key = vals[0].trim(); String value = vals[1].trim(); if (key.equals("--mode") || key.equals("-mode")) { try { MODE = Mode.valueOf(...
d95be28c-2094-4389-81d9-bf88587b7d71
0
private void returnToGroupListPage() { driver.findElement(By.linkText("group page")).click(); }
ff2df7f3-eaf1-4914-9b08-de17f2ccb93f
2
public void removeLink(Integer i) { links.remove(i); for (int j = 0; j < links.size(); j++) { Integer x = links.get(j); if (x >= i) links.set(j, x - 1); } }
957c219a-3d07-45d1-a64c-4db288d4969b
7
@Override public void collectStats(SegmentEventRecoder recorder, StringBuilder builder) { List<InfinteMutation> mutations=recorder.getMutationsSorted(); //builder.append("//\n");//this is a start sim output delimiter... so its not for here.. if (recorder.isTrackTrees()) recorder.treeStrings(builder); if(isL...
a5fe2971-0ddc-4856-b861-86cb5297d8e1
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PhpposItemsTaxesEntity that = (PhpposItemsTaxesEntity) o; if (itemId != that.itemId) return false; if (Double.compare(that.percent, percent) !=...
3a689bf1-96a5-4404-ae3a-6729e8bd5bc1
8
public static OfflinePlayer parsePlayer(final Context context, final int position) { if (position < 0 || context.arguments.size() <= position) return null; String query = context.arguments.get(position).toLowerCase(); final boolean isExact = !query.endsWith("*"); // Trailing asterisk indicates ...
6da352f9-ee77-4703-a2d0-397c113ffed1
9
public boolean play( int i, int j, int val ){ if( values[i][j] != 0 ) return false; boolean flag1 = l_play(i, j, val); boolean flag2 = u_play(i, j, val); boolean flag3 = r_play(i, j, val); boolean flag4 = d_play(i, j, val); boolean flag5 = lu_play(i, j, val); bool...
2a35a98d-85f4-46fc-9277-a686d88f77bf
0
public void setMember(Member member) { this.member = member; }
daf01fa1-afed-4830-8e1d-2d6bfc8315df
0
public static String getGrid(int i){ return possibleGrids[i]; }
33f1ecea-f6e5-4d05-83f1-6f93e484ad63
9
private void printPlotStats() { if (time == start) { String line = FormattedStatistics.repeatChar('-', 69 + FormattedStatistics.header().length() + FormattedStatistics.header("(err)").length()); System.out.format("#%15s %s %s %16s %8s %8s %16s%n#%s%n", "reltime", FormattedStatistics.header(), Forma...
fffb308e-1206-4d8b-8341-80537b257578
4
public void testHLIDGeneration() { System.out.println("\n**** testHLIDGeneration ****"); CycAccess cycAccess = null; try { try { if (connectionMode == LOCAL_CYC_CONNECTION) { cycAccess = new CycAccess(testHostName, testBasePort); } else if (connectionMode == SOAP_CYC_CONNECTI...
b56f4467-46f8-43b5-a9a5-b310a2812f17
9
public void run() { boolean connectionFailed = false; while (running) { try { RS232CmdData cmdData = null; if (queue == null) { logger.warning("Waiting for queue to reset"); Thread.sleep(1000); } ...
6aa97fb3-1800-41f8-80dd-7d3652483919
7
@Override protected boolean report() { try { Document l_Document = m_Info.getDocument(); Paragraph l_Title = new Paragraph(new Chunk(getTitle(), m_Info.getTitleFont())); l_Title.setAlignment(Element.ALIGN_CENTER); l_Title.setSpacingAfter(15f); l_Document.a...
f664c149-d1d2-47cc-ac04-17a49daa6101
6
public ReturnValue stringSearch (QueryConfig config) throws Throwable { ReturnValue revalue = new ReturnValue(); //store the query revalue.querystring = config.getQuerystring(); //the enumerator of value list DocsEnum value_enum; //create a term for query Term qterm = new Term(fieldname2,config.getQuer...
555fe4c2-c09e-4d02-84ac-406519ff076b
1
public void undo(){ if (this.canUndo()){ this.commands.get(current).unExecute(); current--; } }
5346e6d7-ac0a-4ff8-afdd-1fec8fef2482
9
/* */ public void mousePressed(MouseEvent m) /* */ { /* 468 */ switch (m.getButton()) { /* */ case 1: /* 470 */ if (activeClass != null) { /* 471 */ if (!this.grenadeSelected) /* 472 */ activeClass.autoFire = true; /* */ else { /* 474 */ System.out.p...
a49438f6-5348-4786-a0e5-cd581eeb7845
3
public boolean eat(Blood b) { if(this.live && b.isLive() && this.getRect().intersects(b.getRect())) { this.life = 100; b.setLive(false); return true; } return false; }
49435fa5-a399-4a2a-9b81-a0d8b901ca98
2
public Set getDeclarables() { Set used = new SimpleSet(); if (type == FOR) { incrInstr.fillDeclarables(used); if (initInstr != null) initInstr.fillDeclarables(used); } cond.fillDeclarables(used); return used; }
7c0b5a1e-9655-48d5-b218-b9f02fedfeb7
2
private List<DBObject> ConstructMongoQuery(List<String> finvizReturn) { LinkedList<DBObject> MongoQueryList = new LinkedList<DBObject>(); int headerFlag = 0; String[] headers = new String[]{""}; for (String finvizValues : finvizReturn){ if (headerFlag == 0){ ...
fbd3dfad-0cde-46ad-8950-9bf1f57aea1f
0
public void setNombre(String nombre) { this.nombre = nombre; }
14d48f85-f6bf-4a02-97b3-50edff3d5ea2
4
@Test public void testWeightLimits() { Metabolism m = new Metabolism(); try { m.setWeight(0); fail("An IncoherentWeightException should have been thrown."); } catch(IncoherentWeightException e) {} try { m.setWeight(-12.3); fail("An IncoherentWeightException should have been thrown."); } catch(Inc...
4f0a6adf-7b0c-4b73-ae3a-c1034237e666
9
private void loadPlayers(){ FileInputStream inputStream; InputStreamReader reader; Scanner scanner = null; try { inputStream = new FileInputStream(currentPlayerFileName); reader = new InputStreamReader(inputStream, "UTF-8"); scanner = new Scanner(reader); String line = ""; while(scanner.h...
a3acf442-6c68-47a1-97da-2fbb6b4cb580
5
@Override public int check(DiceSet diceSet) { int points = 0; Map<Integer, Integer> vals = new HashMap<Integer, Integer>(); for (int i = 0; i < diceSet.SIZE; ++i) { int key = diceSet.getValue(i); if (!vals.containsKey(key)) { vals.put(key, 1); ...