method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5fd0b276-319d-4e8c-b314-28e7c53082e1
7
public void set_safe(final long i, final Object value) { if (value instanceof Boolean) { setBoolean_safe(i, (Boolean) value); } else if (value instanceof Byte) { setByte_safe(i, (Byte) value); } else if (value instanceof Short) { setShort_safe(i, (Short) v...
80f1b1ae-b5c3-4e33-8127-1538ddb9a844
9
public int candy2(int[] ratings) { int[] candies = new int[ratings.length]; // store the candies for (int i = 0; i < ratings.length; i++) { if (i == 0) candies[i] = 1; // base case else { if (ratings[i] > ratings[i-1]) { candies[i] = candies[i-...
0cf9d84b-6189-4520-b329-890f60c41086
5
public boolean pegIsAvailableToPlayer(int c, int r, int player) { if (player == 0) { if (c == 0 || c == boardSize_ - 1) return false; else return true; } else { if (r == 0 || r == boardSize_ - 1) return false; else return true; } }
708b1c24-bd18-4e11-96fe-d6f6fb1b7c24
6
public void run() { // While it's not stopped by internal error or external command while (runLoop){ // Wait for 5 seconds before actually refreshing // Get all peers from the database Table peer_address=db.getTableWithColumns("peer_address", new String[]{"peer_id", "address"}); ...
5875e351-76d2-4504-8830-7d97c17422ed
2
@Override public void setValueAt (Object val, int row, int column) { if ((column < 2) || (column > 2+ MainWindow.setupData.getEventLength ())) return; MainWindow.rosterDB.getRosters().get(row).setAvailability (MainWindow.setupData.getDateAt(column-2), val); fireTableDataChanged(); }
6747dc03-c6ec-4662-9601-4da49c256c9a
7
AbstractNode factor() { AbstractNode node = null; if (test(IDENT)) { if (testLookAhead(DOT) || testLookAhead(LBRAC)) { node = new ContentNode(selector()); } else { node = new ContentNode(constIdent()); } } else if (test(INT)) { node = integer(); } else if (test(STR)) { node = string(); ...
c1ff7ba6-3b0b-4651-86a3-2f34c5f74d2e
0
public int numberVariables() { return (new HashSet(MAP.values())).size(); }
646f558c-c598-4fb8-b42e-e8c1893d8b79
5
private void addLabyrinth(int height, int length) { for (int i = 1; i < height; i++) { for (int j = 1; j < length; j++) { if (border(i,j,length,height)) { super.addBricks(new Point(i, j)); } else if (centralBlo...
c0482a7e-26c4-4b42-b9a4-d9c60634b491
2
private boolean setBooleanInitParameter(String parameterValue, boolean defaultValue) { if (null != parameterValue) { try { return "true".equalsIgnoreCase(parameterValue); } catch (Exception e) { return defaultValue; } } return defaultValue; }
703cab07-1a6f-4c82-aa47-26b078a519b3
6
public void onEnable() { inst = this; SkyQuest.onServer = true; qm = new QuestManager(); fm = new FileManager(); qlm = new QuestLogManager(this); if(!getDataFolder().exists()) { try { fm.saveData(getDataFolder(), qm); } catch (IOException e) { e.printStackTrace(); } } getSer...
569817a4-429f-42d5-8ea5-289478379b4f
5
public List<Book> getBooksByBranch(int branch_id) { List<Book> list = new ArrayList<>(); Connection con = null; Statement stmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = DriverManager.getConnect...
878a16e9-be85-4e8f-84cc-bc4e384970e6
1
public double[] getNumberArrayProperty(String name) { int col = Util.findColumn(model, name); double[] a = new double[model.getRowCount()]; for (int i = 0; i < a.length; i++) { a[i] = ((Number) model.getValueAt(i, col)).doubleValue(); } return ...
fba867b8-26e2-4b74-bf66-5306dd5d46de
1
private static int countSlots(Expression[] exprs, int length) { int slots = 0; for (int i = 0; i < length; i++) slots += exprs[i].getType().stackSize(); return slots; }
05ac7d81-714e-4fa1-a193-873ab478d92d
4
public boolean isOptOut() { synchronized (optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g...
ec4bd986-fe54-4b05-8d93-429d9d77ee43
7
public void renderSprite(int xp, int yp, Sprite sprite, boolean fixed) { if (!fixed) { xp -= xOffset; yp -= yOffset; } for (int y = 0; y < sprite.getHeight(); y++) { int ya = y + yp; for (int x = 0; x < sprite.getWidth(); x++) { ...
930b3c26-2a86-40f9-ba62-548f113a4f62
9
private static boolean propsEquals(Member member, Object o1, Object o2) { if (member == null) { throw new IllegalStateException("Member is null in propsEquals"); //return false; } try { if (member instanceof Field) { Field f = (Field)member; System.out.println(String.format("EqualsUtils.propsEqua...
0212bb75-8a9a-4633-b20f-9745e438c48d
0
public void setValue(String value) { this.value = value; }
9728e9b6-e534-49e0-8e3a-f9be2c232187
5
private Integer[][] cross2(Integer[] t1, Integer[] t2, boolean randomCrossPosition) { int length = t1.length; int crossPosition1, crossPosition2; Integer[][] t = new Integer[6][length]; if (randomCrossPosition) { double d1, d2; d1 = Math.random() * length; ...
29a5b9b0-032c-4725-85a5-f37d4de790c6
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=prof...
21629705-cf54-447c-a427-513a911a30c1
7
private int levelAuxPrefixFree(Node focusNode,int level, int usedLevel) { if (level==1){ if (usedLevel>0 & !focusNode.isUsed()) if (focusNode.setLUsed()) usedLevel--; //FIll 0 first if (usedLevel>0 & !focusNode.isUsed()) if (focusNode.setRUsed()) usedLevel--; } else{ if (usedLevel>0 & !foc...
a174f669-4312-49e2-9d77-8a5d8e7f4b16
8
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if(sender instanceof ConsoleCommandSender) { sender.sendMessage("§cThis can only be run in game!"); return true; } if(args.length== 1) return false; if(args.length>= 3) { Player p = (Player) ...
cea4e90a-4223-4522-a0f7-a34c579e5f51
9
String reformatExpression(String exp) { int i = 0; char it; int itCount; boolean haveStar; StringBuffer buff = new StringBuffer(); int size = exp.length(); while (i < size) { it = exp.charAt(i); itCount = 1; haveStar = false; ...
44163263-aed2-49d0-bd04-1de2d6ee165a
1
private static void displayMovesInVector(Vector<Move> v){ for(Move m:v){ m.display(); System.out.print(", "); } System.out.println(); }
cdb5fc65-a762-4907-a080-461338c5af18
1
public synchronized void deleteWay(int pos, long wayId) { if (ways.size() > pos) ways.get(pos).remove(wayId); }
fc817374-b657-471b-a76b-f1ad87750522
1
public void setReleaseTime(Date time) { if (time == null) throw new IllegalArgumentException("Time cannot be null"); this.releaseTime = time; }
714e2fab-bc64-48df-a7f3-2bb16c8daea9
1
@Override public void display(int depth) { StringBuffer buff = new StringBuffer(); for (int i = 0; i < depth; i++) { buff.append('-'); } System.out.println(buff + " " + getName()); }
48f3c2d3-86a9-498d-b411-575c64d047f3
0
public List<CompositeInstance> getFilteredInstances(){ return this.instances; }
ce8964df-a248-42f5-b1dd-e5cec950f1c7
8
public int longestConsecutive(int[] num) { HashMap<Integer, Boolean> map = new HashMap<Integer, Boolean>(); int len = num.length; if(len < 2) { return len; } int max = 1; for(int i=0;i<len;i++) { map.put(num[i], true); } for(int i=0;i<len;i++) { int current = num[i]; int count...
24e1c5a5-6c85-4040-a5a9-2c9f13798390
4
public static void count_words(String s) { boolean wordStarted = false; int wCount = 0; for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); boolean letter = ch != ' ' && ch != ','; if (letter) { wordStarted = true; } else...
8f75c2b4-de8a-4597-9f0f-88cf1c4da60c
3
public void sendData(ObjectOutputStream[] streams, double time, int newPlayer){ for(int i=0;i<streams.length;i++){ if(streams[i] == null) continue; try { streams[i].writeDouble(time); streams[i].flush(); } catch (Exception e) { System.out.println("issue in GameMechanics.sendData"); ...
b76e1a82-1787-4207-9ab9-c954e6a6fb16
4
public void initTokenClasses() { table.println("package lexer;"); table.println(" "); table.println("/**"); table.println(" * This file is automatically generated<br>"); table.println(" * it contains the table of mappings from token"); table.println(" * constants to th...
6e005be1-dd52-4379-ae54-a7c83e34168c
6
public static void addSchool() { System.out.print("Connection add school ... "); //Connexion à la base BaseSetting bs = new BaseSetting(); if (bs.testerConnexion()) { System.out.println("success"); try (Scanner sc = new Scanner(System.in)) { ...
0a9ce6fd-7ba7-4a2d-ada7-2ddd1db93b1c
0
@Override public void setAttemptClientConnect(IAttemptClientConnect attemptClientConnect) { this.attemptClientConnect = attemptClientConnect; }
807a8a66-87d0-40bd-93f4-78138a0d4dd1
7
public int[] getTemplatePixels(int x0, int y0, int x1, int y1) { int retPixels[] = new int [735]; /* 21*35 */ int xLen, yLen, sX, sY, cX, cY, oX, oY; double xInc, yInc, nY, scale; xLen = x1 - x0; yLen = y1 - y0; /* distance between the eyes is 23 pixels from experiences */ xInc ...
72e18b43-f6f6-4a9a-8595-75c0a4fd043b
7
public void put(K key, V value) { //if hashmap size is more than a certain load //its time to rehash the array if(size >= max_size*loadFactor ){ //double the max_size max_size *= 2; //temporarily copy the old array Entry []temp = new Entry[max_siz...
1c414018-ec83-4241-b362-465fab74edb7
0
@Override public String getDescription() { // This description will be displayed in the dialog, // hard-coded = ugly, should be done via I18N return "Assembly files (*.asm)"; }
6c467dfe-911c-4d65-988a-01fbee39db6b
0
public Territory(GoGame game1) { game = game1; squares = new HashSet<Square>(); }
a93a931e-8ba1-452d-aeb5-7b978da4ad97
4
public static String getNick(String name) { if (name.startsWith(":")) name = name.substring(1); if (name.startsWith("#")) return name; else if (name.length() > 0 && name.indexOf('!') >= 0) { name = name.split("!")[0]; return name; } ...
6d5fe9f4-a8fe-45b3-95cc-85cee89a5ee9
1
public int recordReturnType(CtClass type, boolean useResultVar) throws CompileError { gen.recordType(type); return gen.recordReturnType(type, "$r", (useResultVar ? resultVarName : null), stable); }
26eb4906-8fe8-48c5-97cf-24695f91493b
9
public void generateObj() { try { Class<?> clazz = Class.forName("com.rock.reflect.User"); //默认调用无参构造器 Object u1 = clazz.newInstance(); System.out.println(u1); //获取构造方法,再调用 Constructor<?> constructor = clazz.getConstructor(int.class,String.class); Object u2 = (User) constructor.newInstance(1,"roc...
59dcbe21-87e4-4fe2-a86d-470cdca9053b
1
public void closeChat() { if (cbtn != null) cbtn.click(); }
c54b74ca-c64b-48b6-aa59-7a3dde5a0def
6
public static void main(String[] args) throws InterruptedException { final Random randomizer = new Random(); final Bank bank = new Bank("Native", Math.abs(randomizer.nextLong())); final Account[] accounts = new Account[ACCOUNTS_COUNT]; double totalAmount = 0.d; for (int i = 0;...
0e804ae2-7819-4087-aabb-cf027b9a6f0e
7
public void mouseReleased(MouseEvent evt) { boolean orderChanged = false; for (int i=0; i<slotList.size(); ++i) { Slot slot = slotList.get(i); if (!slot.isDragged()) continue; if (insertBeforeSlot...
05a84afa-4601-4437-b785-1d920f330382
4
private static boolean validTile(ITile[][] map, int x, int y) { return (x >= 0 && x < map.length) && (y >= 0 && y < map[0].length) && map[x][y].isPassable(); }
341712e3-d627-47f6-955b-be26d209f162
4
public boolean salvar(Usuario usuario) { if(usuario.getNome()==null || usuario.getNome().equals("")){ return false; } if(usuario.getLogin()==null || usuario.getLogin().equals("")){ return false; } usuariosBancoDeDados.put(usuario.getId(), usuario); ...
8a9a6b8f-63bd-4f72-95d5-352ef424dc09
2
public void refreshSearches () { // refresh da search panel int pageSize = pages.size(); // holds total # of pages at the time this method is called for (int i = pageSize-1; i > 0; i --) { // loop through pages remove(pages.get(i)); // remove page from panel pages.remove(pages.get(i)); // remove page from ar...
94f76dc2-3e60-4003-b478-8c0b40f9dd5a
7
public static void genTagOuput(TagletManager tagletManager, Doc doc, Taglet[] taglets, TagletWriter writer, Content output) { tagletManager.checkTags(doc, doc.tags(), false); tagletManager.checkTags(doc, doc.inlineTags(), true); Content currentOutput = null; for (int i = 0; i...
ffc2aa47-c834-4f07-8ed0-bdf14e1e7eb4
1
public void SaveFile(String path, String FileContent, boolean CleanFileContent, String type) { FileWriter file; BufferedWriter writer; Calendar calendar = new GregorianCalendar(); // Fecha y hora actuales. SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss"); // Formato de la fecha. String...
5f65d0d8-8ae8-4276-affa-e7cebc72a48e
9
public String addNewBook() { // on récupère les données du formulaire String bookTitle = book.getBookTitle(); String bookAuthor = book.getBookAuthor(); String bookSummary = book.getBookSummary(); Integer bookType = book.getBookType(); //Integer bookState = book.getBookState(); Integer bookState = 1; // 1 ...
612483d3-b937-4c96-bcda-f3581c6c1eeb
6
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(args.length == 1) { if(args[0].equalsIgnoreCase("help")) { // show help! showHelp(sender); return true; } } if(plugin.commands.containsKey(label)) { boolean hasPermission = true; if(sender ins...
5b37334a-11d3-4d15-8a64-2fac94937881
7
public void display() { win2.pushMatrix(); // translate to coordinates of center of top of t1 int height; int h1 = myWall.getT1().getHeight(); int h2 = myWall.getT2().getHeight(); if (x < Animation.WALL_WID / 2) { height = h1; } els...
983624d3-2537-43d9-b69c-a98d8a97c493
6
public boolean foundResult(Map<Variable, Term> result) { // Print the whole combination of variables that satisfies the evaluated query. Iterator<Map.Entry<Variable, Term>> bindings = result.entrySet().iterator(); while (bindings.hasNext()) { Map.Entry<Variable, Term> binding = bindi...
6e3090de-a9aa-4a1a-976c-ac105fcff563
3
@Test public void canDetermineTheColumnFitnessOfAGrid() { for (int sudokuPower = 1; sudokuPower < 10; sudokuPower++) { // all columns are valid but the first one for (int i = 0, size = sudoku.getGridLength(); i < size; i++) { if (i == 0) continue;...
0c49f3ab-6238-488d-8e85-283ddb93258c
4
public static void removeRate(int rateId){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCommit(false); PreparedState...
ddde1c71-fd7b-4b14-9c19-52fcbc36d303
8
private void setListeners() { /* * The action listener for remove carriage button */ btnRemove.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { theTrain.removeCarriage(); } catch (TrainException e1) { e1.printStackTrace(); } ...
63fd9201-c4f4-42ff-b3a2-4f4cfa4fd61e
7
long findRecordStart(long pos) { try { raf.seek(pos); int len = 0; for (long p = pos; (len = raf.read(buffer)) > 0; p += len) { for (int idx = 0; idx >= 0;) { // Find '\n@' in this buffer idx = findNl(buffer, idx); if (idx >= 0) { idx++; if ((idx < buffer.length) && (buffer[id...
6f88cdb6-898b-4409-bceb-2904c73ad827
5
@Override public boolean equals(Object obj) { if(this == obj) return true; if(obj == null) return false; if(getClass() != obj.getClass()) return false; Point other = (Point) obj; if(!Arrays.equals(components, other.components)) return false; if(dimension != other.dimension) return false; return true; }
8a48c011-008f-45eb-8c02-011139806215
9
} // ----------------------------------------------------------------------- @Override public DateTimeValueRange range(DateTimeField field) { if (field instanceof ChronoField) { ChronoField f = (ChronoField) field; if (f.isDateField()) { switch (f) { case DAY_OF_MONTH: ...
3673f2b3-49ff-4b51-8f00-0405613eac41
6
public static String getAttributeName(int index) { switch (index) { case 0: return "STR"; case 1: return "DEX"; case 2: return "CON"; case 3: return "INT"; case 4: return "...
6ffb8021-fdf3-451d-9f58-71c421fade13
5
@Override public List<Integer> loadArrayFromFile(String path) { if (path == null) { throw new IllegalArgumentException("Path is not specified!"); } List<Integer> list = new ArrayList<Integer>(); String line; BufferedReader bufferedReader = null; try {...
7148a572-1a28-4cfa-8e88-d5a2a8a1998d
9
static final public void repeticao() throws ParseException { trace_call("repeticao"); try { jj_consume_token(WHILE); jj_consume_token(A_PARENTESES); expressao(); jj_consume_token(F_PARENTESES); jj_consume_token(A_CHAVES); label_2: while (true) { comando(); ...
0915cf4c-df06-4a7b-b9e7-e1e015c42150
5
public boolean checkBox (int row, int col) { int i = 0, j = 0, k = 0, count = 0; /* Uses nested for loops to check the entries */ for (k = 1; k < 10; k++) { for (i = row; i < row+4; i++) { for (j = col; j < col+4; j++) { count = 0; if (k == Integer.parseInt(entries[i][j].getText())){ ...
279e82c6-6a54-4d1a-9466-fdc9572a54f9
9
void getNewMessages(DateTime loopTime) throws Exception{ //Clean up of buffers goes here! Because we don't want to itterate over the new messages as we know //they are new! //1. First, we clean up. for (Vessel v: theVessels){ v.theTrackBuffer.cleanBuffer(theOpti...
117d5cf0-aaf9-4338-a06b-580e494360cd
2
@Override public int compare(Device arg0, Device arg1) { if (arg1.getPrice() > arg0.getPrice()){ return 1; } else if(arg0.getPrice() > arg1.getPrice()){ return -1; } return 0; }
5733a966-7a19-46ba-b86c-438092a441f7
2
@Override public void freeze() { if(!used && global) { global = false; } }
f25655d0-6227-4298-8a56-5e0bbb47dd20
4
private static List <File> directoryFiles(String path, String extension) { List <File> allFiles = new ArrayList <File> (); allFiles.add(new File(path)); int index = 0; while (index != allFiles.size()) { File currentFile = allFiles.get(index); if (currentFile.isDirectory()) { allFiles.remove(index); ...
857022c4-f19d-43da-af26-58d9c18d1209
3
@Override public void setData(ByteBuffer data) { setVersion(data.getShort()); short numberSubtables = data.getShort(); for (int i = 0; i < numberSubtables; i++) { short platformID = data.getShort(); short platformSpecificID = data.getShort(); ...
d5af14d9-4297-4fa9-9c85-ba29bf039101
6
public ArrayList<File> find(String path, String mask) throws FileNotFoundException { ArrayList<File> result = new ArrayList<>(); File file = new File(path); if (!file.isDirectory()) { throw (new FileNotFoundException("it is not directory!")); } if (!MaskValidator.isValid(mask)) { throw (new Runtim...
f4950a11-0f09-4da2-b9f0-e1a3f07a11b6
1
public void draw() { if (texture != null) texture.bind(); glEnableVertexAttribArray(0); glEnableVertexAttribArray(1); glBindBuffer(GL_ARRAY_BUFFER, vbo); glVertexAttribPointer(0, 3, GL_FLOAT, false, Vertex.SIZE * 4, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUF...
ee0ddfc2-0082-40df-b226-4d7f2591dc0f
8
public boolean move (int direction, Client c) { // All moves are of one square, lets make sure // that the target square is fre if (c == null) return false; if (c.current == null) return false; Coordinate newLoc = null; switch (direction) { case Coordinate.NOR...
64ec2c91-40cd-4c9c-a251-262047a47781
6
public void run() { while (true) { // Create a buffer to read datagrams into byte[] buffer = new byte[1500]; // Create a packet to receive data into the buffer DatagramPacket packet = new DatagramPacket(buffer, buffer.length); if (active) { ...
7b510212-34d0-4ee0-b572-574864f8651e
8
@Override public void run() { while (Server.run) { try { stream.ping(); if (stream.isEOF()) { break; } while (stream.getAvailable() > 0) { Packet packet = Packet.readPacket(stream); if (packet != null) { packet.handle(); if (packet instanceof Packet_Login) { Packe...
0644346d-fd76-4396-84d9-835c4a8baf8a
9
public void clientHttp() { BufferedReader in = null; try { ListIterator<SearchHitMessage> it = Simpella.searchHitMsgList.listIterator(); String ipToConnect=""; String portToConnect=""; String fileName=""; String fileIndex=""; int flag = 0; while(it.hasNext()) { SearchHitMessage shm = i...
417e61a3-70f4-4432-bc09-3b14eaac7e54
9
private Class<? extends Matrix> getClassFor(int rows, int cols) { if (cols==1) { switch (rows) { case 2: return Vector2.class; case 3: return Vector3.class; case 4: return Vector4.class; default: return Vector.class; } } else if (rows==2 && cols==2) return Matrix2.class; else if (rows==3 ...
2927ee5b-4afc-4193-b3ed-385be078e625
3
public HashMap<String,PDFObject> getDictionary() throws IOException { if (type == INDIRECT) { return dereference().getDictionary(); } else if (type == DICTIONARY || type == STREAM) { return (HashMap<String,PDFObject>) value; } // wrong type return new Has...
8e0c88f7-0100-497e-8b26-91961b8703a9
7
public int modificarEnunciado(DTO.Enunciado en) { try { if (con.isClosed()) { con = bd.conexion(); } String consulta; Object ob = null; if(en.getDespuesDe().getCodigo() !=0){ ob =en.getDespuesDe().getCodigo(); ...
b0071bb8-7803-458d-81ca-0e9fe1d162a2
3
protected void stateChanged() { if(lastState == ButtonState.ACTIVE && currentState == ButtonState.HOVER) { ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, this.text); for(ActionListener l : actionListeners) l.actionPerformed(e); } }
f4c0fcd2-8ef1-471f-b170-70f1ac0499d5
3
public void loadConfig() { while (!getDataFolder().exists()) { saveConfig(); } File file = getDataFolder(); String filename = file + "/config.cfg"; config = new Properties(); try { config.load(new FileInputStream(filename)); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IO...
bbca4804-7f44-4f21-acce-05991b2e3e5b
4
public User findUserByKey(String key) { Session session =null; User user; try { session= HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); Criteria criteria = session.createCriteria(User.class); user=(User)criteria.add(Re...
ea2ee71f-22d8-4022-a737-2adc5261f5a5
6
@Override public void approveSelection() { File file = getSelectedFile(); if (this.dialogType == JFileChooser.OPEN_DIALOG) { // Alert if file does not exist. if (!file.exists()) { String msg = GUITreeLoader.reg.getText("error_file_not_found"); msg = Replace.replace(msg,GUITreeComponentRegistry.PLA...
899f6f01-233a-4b02-8b48-43ab711024f4
9
private boolean r_postlude() { int among_var; int v_1; // repeat, line 75 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 75 // [, line 77 bra = cursor; ...
1ed4e1fc-1d0e-4349-a7bf-29225e86fb51
4
public HashMap<Integer, List<Integer>> constructAdjacencyList() throws IOException { HashMap<Integer, List<Integer>> adjacencyList = new HashMap<Integer, List<Integer>>(); List<String> sequence = new ArrayList<String>(); List<Integer> knotList = new ArrayList<Integer>(); BufferedReader b...
c3532fae-74d8-4cdb-ad01-f4e53095d407
2
public static boolean isValidForename(String forename) { if (forename == null) return false; return forename.matches("[a-zA-Z]+") && forename.length() <= 32; }
edbbc506-57a5-4789-99a6-0f851d9da43e
6
@Override public void run() { threadRun = true; Simulator simulator = MainProgram.getSimulator(); while(threadRun && numSteps > 0 && simulator.getSimulatorView().isViable(simulator.getField())) { MainProgram.getSimulator().simulateOneStep(); numSteps--; while(infinite && numSteps == 0) { n...
7d8bf2f6-106f-4017-a29d-d60ba808b5d9
8
private static void exportFrame(ExportDiagnoser d, Frame f, File baseDirectory) { Rectangle rect = f.properRectangle(); Point pivot = f.getPivot(); d.printSection(f.getName()); RelativeFile relativeImageFile = f.getImageFile(); if(relativeImageFile!=null) { File imageFile = relativeImageFile.getAbsolut...
d2746752-9051-4d4e-9a90-f19e42efa1c4
2
public final TLParser.whileStatement_return whileStatement() throws RecognitionException { TLParser.whileStatement_return retval = new TLParser.whileStatement_return(); retval.start = input.LT(1); Object root_0 = null; Token While91=null; Token Do93=null; Token End95=nu...
0b635c06-37eb-4751-a49f-6698a886b282
0
public Integer getId() { return id; }
2b76c287-05a7-4562-a00f-644d4422d285
1
@Override public V remove(K key) { int i = findEntry(key); if (i < 0)// key not in table return null; V value = bucket[i].getValue(); bucket[i] = available; size--; return value; }
d07f377e-4778-42c9-8578-e091efa1f4dd
4
@Override public void itemStateChanged(ItemEvent ie) { String name = displayLabel.getFont().getName(); Font font; if(styleItems[0].isSelected() && styleItems[1].isSelected()) font = new Font(name, Font.BOLD+Font.ITALIC, 72); ...
7140ed98-4118-48fd-a1b6-c60115fced1e
7
public void paintComponent(Graphics g) { BufferedImage spriteSheet = null,Thruster; BufferedImageLoader loader = new BufferedImageLoader(); try { spriteSheet = loader.loadImage("images/Ship_Shop/shipshopparts.png"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrac...
4a151d07-c0a6-4aac-a232-fd5a88574cd8
0
public String getLastMessage() { return lastMessage; }
244b3554-a021-4f43-8444-04bb55d853f6
5
public boolean equals(Object o){ Production p = (Production)o; if( this.dot == p.dot && this.left.equals(p.getLeft())){ if( this.right.size() == p.right.size()){ for( int i = 0; i < this.right.size(); i++){ if( !this.right.get(i).equals(p.right.get(i))){ return false; } } ...
ee3ac027-5b78-4b42-a005-d907db26802a
2
private long largest(final long number) { long result = 1; for (int p : Primes.primes) { if (number % p == 0) { result = p; } } return result; }
31accd8b-e0dd-4a5c-9c7f-4daf1dd5f70b
5
private void cycle2( int i, int k, WordInfo wf, Hand h, int cross_score, int word_score, int word_mult ) { if (WordFinder.killAllNow) { // Kill It } else if (this.Board...
a69cc04d-a17f-4989-ad18-d4a8742e9608
2
public static CustomButton doHistoryViewButton() { final CustomButton a = new CustomButton("show my history"); a.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { JFrame searchResultFrame = new JFrame("my history"); searchResultFrame.setSize(1300, 650)...
979cb1cd-55d8-4e7e-8cf5-af5272deea74
9
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if (args.length == 0) { if (player == null) { sender.sendMessage(ChatColor.RED+"This command can o...
3be56145-af1e-4006-b119-1978f6b3f630
3
private void createButtons(){ java.net.URL buttonIcon = Paintimator.class.getResource("images/backPage.png"); backPage = new JButton(new ImageIcon(buttonIcon)); backPage.setToolTipText("Previous Page"); backPage.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg...
ec95d639-134e-4a86-8086-cb1ca7e8f661
8
public void MoveModel() { if(win == GameStatus.VICTORY || lose == GameStatus.DEFEAT) pause = true; if(!pause) { CollideableObject q; int i = 0; win = GameStatus.VICTORY; lose = GameStatus.DEFEAT; while (i < data.size()) { q = data.get(i); if (q.color != Color.BLUE && q.color != Col...
01dec9a0-c934-47c6-a34d-d3c6c1657701
5
@Override public void onDraw(Graphics G, int viewX, int viewY) { if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300) { Graphics2D g = (Graphics2D)G; Composite c = g.getComposite(); // g.setComposite(new Additive()); g.setColor(new Color(255,r.nextInt(255),...
de1f9ec6-0aa1-4204-a7ad-20637607a313
1
private void lisaaKilpienergiaa(Pelihahmo h){ if (!h.getSuojakilpi()){ h.setKilpienergia(h.getKilpienergia() + LISAAMIS_VAKIO); } }