method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ebbc607b-b5b2-4e3e-8eae-881a71add78f
5
public MenuLevelSelect(Game game) { setVisible(false); int gridx = 0; int gridy = 0; int lvlCount = 0; if (path.exists()) { for (File lvl : path.listFiles()) { if (lvl.getName().contains("terrain")) { if (lvlCount > 12) BlueMaggot.e = new Exception("Too many levels added! Max is 12."); ...
14818f38-c9d1-4c1b-957c-cc1f219e20d8
9
public int grow(int growdirection) { int dx =0; int dy = 0; switch (growdirection) { case 0: dx = 0; dy = -1; break; case 1: dx = 1; dy = 0; break; case 2: dx = 0; dy = 1; ...
7cea19d3-4720-4a65-8444-24edc13bb079
1
public char evaluate_char(Object[] dl) throws Throwable { if (Debug.enabled) Debug.println("Wrong evaluateXXXX() method called,"+ " check value of getType()."); return '?'; };
7514a746-db3b-4d48-bbf1-f2f35e546094
0
public void setItem(Items item) { this.item = item; }
63bf7b9c-3d01-49ed-990e-5306f0c99cad
7
public static void main(String[] args) { try { UIManager.setLookAndFeel("com.jtattoo.plaf.texture.TextureLookAndFeel"); } catch (UnsupportedLookAndFeelException e) { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".e...
ceea162d-9aaa-4d01-87d2-85bdede8d5ab
1
public MainFrame_View() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) {} frame = new JFrame("World Map - Interactive Map"); frame.setSize(INIT_WIDTH, INIT_HEIGHT); frame.setResizable(RESIZABLE); fra...
4191e0df-df3e-4234-a98b-2a5ebe845013
0
public void addNode(Node node) { nodes.add(node); }
0d4e9db0-fb57-488c-8c65-ddfb48f5484c
7
private void filterPixels(DirectGif89Frame dgf) throws IOException { if (ciLookup == null) throw new IOException("RGB frames require palette autodetection"); int[] argb_pixels = (int[]) dgf.getPixelSource(); byte[] ci_pixels = dgf.getPixelSink(); int npixels...
ebc650a8-25ae-4010-9128-b716baed1591
8
public void generateMapImage() { BufferedImage dungeonImage = new BufferedImage(sizeX * TILE_SIZE, sizeY * TILE_SIZE, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = dungeonImage.createGraphics(); for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { i...
41db74e7-7071-4499-9a8f-cb7ffdadff15
3
private final void resetModDate() { final Path repo = ((SongData) this.songdata).getRoot() .resolve( this.main.getConfigValue(Main.VC_SECTION, Main.REPO_KEY, "band")); try { final Git session = Git.open(repo.toFile()); try { final ObjectId head = session.getRepository().getRef("HEAD") ...
89997d41-b9f1-4c39-a690-fe2e490f5835
5
public void keyReleased(KeyEvent key){ switch (key.getKeyCode()){ case KeyEvent.VK_UP: player.moveY(1); break; case KeyEvent.VK_LEFT: player.moveX(1); break; case KeyEvent.VK_RIGHT: player.moveX(-1); break; case KeyEvent.VK_DOWN: player.moveY(-1); break; case KeyEvent.VK_SPACE: ...
6b585d80-8987-41e9-abf5-e02922808f10
4
public String getText(Key key) { String text = texts.getProperty(key.getProperty()); if (text == null && "month".equals(key.getKind())) { Calendar c = Calendar.getInstance(); c.set(Calendar.MONTH, key.getIndex()); ComponentFormatDefaults defaults = ComponentFormatDefa...
83ca3d85-c398-4e62-8629-be8fc8e0d9de
6
public boolean isValidSudoku(char[][] board) { int[] cols = new int[9]; int[] rows = new int[9]; int[] squs = new int[9]; Arrays.fill(cols,0); Arrays.fill(rows,0); Arrays.fill(squs,0); for (int i=0; i < 9 ;i++ ) { for (int j =0 ; j < 9 ;j++ ) { ...
9c859d5f-6db7-49ea-bc86-6f83a1d89de8
8
@Override public void init(int l, int h) { this.grille = new BlocService[l][h]; this.l=l; this.h=h; for(int i=0; i<l; i++) for(int j=0; j<h; j++) if(i==0 || i==l-1 || j==0 || j==h-1 || (i%2==1 && j%2==1)) { BlocService t = new BlocImpl(); t.init(BlocType.MURMETAL); grille[i][j] = t; }...
a9c237f0-9283-4d19-954d-2828a5e45886
2
public Map<String, EventDetail> sendRequest(String params) { Map<String, EventDetail> result = new HashMap<String, EventDetail>(); RestTemplate rest = new RestTemplate(); String json = rest.getForObject("https://api.guildwars2.com/v1/event_details.json"+params, String.class); ObjectMapper mapper = new ObjectMap...
f322c154-68f3-479a-a322-2b1b3bab8ad1
4
public boolean actionSupervise(Actor actor, Venue venue) { // // If you have any items demanded by the venue, put them away- for (Item i : actor.gear.allItems()) { if (i.refers != null || i.type.form != FORM_COMMODITY) continue ; if (venue.stocks.demandFor(i.type) > 0) actor.gear.transfer(...
9dcbcbb3-fbf0-4db4-8383-1d2780bed0a0
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...
a08c775e-931b-415e-ac6e-104dc8d9173a
1
public void SetRangByScore(){ // Ordre meilleur joueur selon le score Collections.sort(listeScores, ScoreJoueur.InscritNomComparator); int i=0; // ajout le rang au joueur for(ScoreJoueur joueur : listeScores){ i++; joueur.setRang(i); } }
3aec8b60-e502-4af5-bd7a-df0c4bb3dc9d
4
public static Field getField(Class<?> clazz, String name) { while (clazz != null) { for (Field field : clazz.getDeclaredFields()) { if (field.getName().equals(name)) { field.setAccessible(true); return field; } } ...
8d6798f9-8009-447c-89bf-63c3c33b90b6
8
@Override public void render(Graphics g, Visibility visibility, float x, float y, float scale) { if(visibility == Visibility.VISIBLE) { boolean hasSomeEntities = occupying.size() > 0; boolean hasSomeEntering = entering.size() > 0; boolean hasSomeLeaving = leaving.size() > 0; if(hasSomeEntities) { if(...
b09ab63a-60fe-4638-8ce4-5d455388b4e0
9
public static String normalizePath(String path) { String[] comps = path.split("/"); String[] ap = new String[comps.length]; int j = 0; boolean absolute = comps[0].length() == 0; for (int i = 0; i < comps.length; ++i) { String s = comps[i...
bd43ebae-a595-4c15-a8eb-59a7727cb48e
3
@Override public byte[] save(JoeTree tree, DocumentInfo docInfo) { String lineEnding = PlatformCompatibility.platformToLineEnding(PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_LINE_ENDING)); // Show dialog where use can pick a CSS or cancel. Do lazy instantiation since text assets won't be...
65cb5bd4-00cd-4664-811b-821b77e8e5d0
3
@Override public void deserialize(Buffer buf) { objectUID = buf.readInt(); if (objectUID < 0) throw new RuntimeException("Forbidden value on objectUID = " + objectUID + ", it doesn't respect the following condition : objectUID < 0"); foodUID = buf.readInt(); if (foodUID <...
ba575916-c2a7-4e01-a285-7bf99174ac41
7
private void checkLaserCollisionsWithSprites(Laser laser){ // update other sprites //Iterator i = map.getSprites(); LinkedList <Sprite> oldSprites = map.getSprites(); LinkedList <Sprite> sprites = (LinkedList<Sprite>) oldSprites.clone(); //sprites.add(map.getPlayer()); Not doing this right ...
e9bc90a8-74c9-46f2-87ae-2e4b3df5d4b6
4
public Collection<DependencyNode<V>> toNodes() { Map<K, DependencyNode<V>> nodeMap = new HashMap<K, DependencyNode<V>>(); for (Entry<K, V> e : values.entrySet()) { nodeMap.put( e.getKey(), new DependencyNode<V>( e.getValue() ) ); } for (Entry<K, DependencyNode<V...
77ec394f-4021-4158-848f-94c945c7324e
7
public static void check(HttpURLConnection c) throws IOException { int code = c.getResponseCode(); switch (code) { case HttpURLConnection.HTTP_OK: case HttpURLConnection.HTTP_PARTIAL: return; case HttpURLConnection.HTTP_MOVED_TEMP: case HttpURLConnection.HTTP_...
7f89333a-59a9-4d48-ac3b-a364aef2ccf6
7
public static int minCut(String s) { if(s.length() == 0)return 0; int length =s.length(); int[] dp = new int[s.length()+1]; boolean[][] palin = new boolean[s.length()][s.length()]; for(int i =s.length(); i>=0;i--){ dp[i] = length-i; } for(int i = length-1; i>=0;i--){ for(int j = i; j < length ...
63bef0c7-2dd5-472b-bd19-289519e36c5d
2
public TableCellEditor getCellEditor(int row, int column) { if (!finalEdit) return super.getCellEditor(row, column); int mc = convertColumnIndexToModel(column); return cellEditors[row][mc] == null ? super.getCellEditor(row, column) : cellEditors[row][mc]; }
ab7882b8-a648-4adf-9138-9cda032e00ed
1
public void resetInteractiveObject() { for (int i = 0; i < interactiveObjectCachePos; i++) { InteractiveObject interactiveObject = interactiveObjectCache[i]; method289(interactiveObject); interactiveObjectCache[i] = null; } interactiveObjectCachePos = 0; }
44a8c1a3-3de0-41e5-9179-657593b9784d
1
private JButton getJButton0() { if (jButton0 == null) { jButton0 = new JButton(); jButton0.setText("SELECT"); jButton0.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { jButton0MouseMouseClicked(event); } }); } return jButton0; }
833168bb-9b6a-4a2c-92ec-f43593283f26
2
public List<String> getTableDescription(String tableName) throws DataBaseTableException { TableDescription td = null; for (DataBase db : databases.values()) { td = db.getTableDescription(tableName); if (td != null) { return td.getColumnNames(); } ...
50733595-3654-4893-9516-4cc789a86578
7
public void preUpdate() { LinkedList<Element> elementTouch = collisionElementList((int)x, (int)y, Type.ALL, false); Element elem; while(!elementTouch.isEmpty()) { elem = elementTouch.removeFirst(); if(elem.type == Type.BOMBERMAN) pushEvent(elem,"explosion", power); if(elem.type == Type.ROBOT) ...
47bd22c2-81cb-4986-a25f-548f2050c8d6
3
public void setUpComboBoxes(Set<Card> cards) { JComboBox peoplePossibilities = new JComboBox(); JComboBox roomsPossibilities = new JComboBox(); JComboBox weaponsPossibilities = new JComboBox(); for (Card card : cards) { String name = card.getName(); if (card.getType().equals(CardType.PERSON)) { people...
c757ebe0-48e8-4b23-aca7-3ce038479514
6
@AfterGroups("MaxHeapIntegers") @Test(groups = { "MinHeapIntegers" }) public void testMinHeapIntPushPop() { Reporter.log("[ ** MinHeap Integer Push ** ]\n"); testQueueInt = new MinPriorityQueue<>(new Integer[seed], true); try { Reporter.log("Insertion : \n"); timeKeeper = System.currentTimeMillis(); ...
2e15517a-5418-4aea-9d49-a21fed74d416
0
public void setAge(String age) { this.age = age; }
91a27500-847e-47e2-8f25-c37d94ca91de
2
public void read(String filename) throws MySecondException { String content; if (filename == null) throw new MySecondException("The file name provided is null"); File file = new File(filename); try { FileReader reader = new FileReader(file); char[] chars = new char[(int) file.length()]; reader.re...
fdfce4b3-b796-4955-993d-070620496e37
1
@EventHandler public void onChat(PlayerBlockChangeEvent event) { if (event.getPlayer() == getPlayer()) { found = true; X = event.getX(); Y = event.getY(); Z = event.getZ(); holding = event.getBlock(); mode = event.getPlaceType(); super.wakeUp(); event.Cancel(true); } }
bf9c8ac2-b37b-422d-92a8-101d88499941
2
private boolean jj_3_58() { if (jj_3R_74()) return true; if (jj_scan_token(POINT)) return true; return false; }
924734d8-d0ab-48de-9293-b8936604b793
1
@Override public boolean addGroup(String group) { if (!groups.contains(group)) { groups.add(group); return true; } return false; }
ddb5df8b-c086-4cba-a3cd-c529ae3320a7
3
private char[] convertToString(CharSequence s) { if (s == null && s.length() % 2 != 0) { throw new IllegalArgumentException(); } int len = s.length(); char[] dest = new char[len / 2]; for (int i = 0, j = 0; i < len; i += 2, j++) dest[j] = (char) ((s.charAt...
2218f618-8356-489f-b4dd-4d6b48c19e02
2
public static void write(HighScore hs, int n, String file){ try{ RandomAccessFile f = new RandomAccessFile(file, "rw"); char[] ch = hs.getName(); f.seek(FILE_SIZE * n); for(int i = 0; i < STRING_SIZE; i++){ f.writeChar(ch[i]); } f.writeInt(hs.getScore()); f.close(); } catch(Exception e){ ...
7e82c898-5309-489a-b818-13ed5b3a8b8c
3
public List<ArrayList<String>> parceEntry(String toCheck) { List<ArrayList<String>> toReturn = new ArrayList<>(); List<String> books = readBooks(); List<ArrayList<String>> topics = readTopics(); toReturn.add(new ArrayList<>()); toReturn.add(new ArrayList<>()); for (Stri...
0faad46f-5ea5-40d9-b970-7753f5b3ddf2
2
@Override public void caretUpdate(CaretEvent e) { if(isLiveDecode()) { try { int methodID = Integer.parseInt(((JTextField) e.getSource()).getName()); parent.executeCipher(methodID); } catch(Exception ex) { ex.printStackTrace(); ...
89f482dc-fc98-4935-a400-8011505c8d65
1
public void run(QuitKeyListener user) { window.activate(); sleep(500); while(!user.hasQuit()){ world.update(); window.repaint(); sleep(25); } window.deactivate(); }
2d9e314d-08c7-4192-91ae-282f57aae534
8
public static void main (String args[]) { int iii,i,ic,k,m,n,nread,ntries,nwrite; int info[] = new int[2]; // int nprob; // int nfev[] = new int[2]; // int njev[] = new int[2]; int nprobfile[] = new int[29]; int nfile[] = new int[29]; int mfile[] = new int[29]; int...
dad2249f-674a-4535-8807-08814941cb9a
4
private static void getInput(){ /* Single action input */ if (Keyboard.next()){ if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE){ quitGame(); } } /* Game input */ if (Keyboard.isKeyDown(Keyboard.KEY_W)){ Court.player.moveUp(); } if (Keyboard.isKeyDown(Keyboard.KEY_S)){ Court.player.move...
9786d79f-f567-4297-a4dd-89b303c115c9
4
public TabuStageParams(int maxSteps, int minTheta, int maxTheta) { if (maxSteps <= 0) { throw new IllegalArgumentException("'max steps' <= 0"); } MAX_STEPS = maxSteps; if ( minTheta < 0 || maxTheta < 0) { ...
bd822499-4204-4afd-a935-45d9faad4dcf
6
@Override public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { if (args.length == 1) { List<String> matches = new ArrayList<String>(); for (String subcommand : subcommands) { if (StringUtil.startsWithIgnor...
9d5c0843-f058-40df-a3a4-f8cce79b2550
7
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); try{ MySQLcon db = new MySQLcon("jdbc:mysql://localhost:3306/project","a","a"); ResultSet r = db.Quer("SELECT * FROM project_assignements"...
a1d16ab2-8f94-4faa-b173-851002f3d312
0
public static String getPrivateKey(Map<String, Object> keyMap) throws Exception { Key key = (Key) keyMap.get(PRIVATE_KEY); return SecurityCoder.base64Encoder(key.getEncoded()); }
ed884120-b8fe-4c25-a36a-d60ca30677a7
9
private static String get_pattern(BufferedReader input, String pattern) { PDPM_DEBUG.PDPM_REPORTER_LOG("->get_pattern() pattern: " + pattern); String line = null; String value = null; while(true) { try { line = input.r...
8eacd9da-722a-45f0-a067-bc6d058ee67e
5
public static void main(String[] args) { int rc = 0; for (String fname : args) { File file = new File(fname); if (!file.canRead()) { System.err.println("Cannot read " + fname); rc++; continue; } try { ...
9dea6a23-a75a-423b-aa49-42d254d1253b
9
Color AdvColorPix(int count, String[] ColorIndex) { int c1; int c2; int r; int g; int b; int or; //old red int og; int ob; double dr; double dg; double db; String fg; //foreground colour String bg; //background colou...
1e909ad7-eca6-480f-944a-f6272ec3f04f
0
public void print(){ int y = 10; // local variable declaration System.out.println(y); }
5a4ac3ed-2e0c-46df-80dd-0e1ea488a479
8
@Override public void channelRead(ChannelHandlerContext channelHandlerContext, Object object) { ByteBuf byteBuf = ((ByteBuf) object); boolean isLegacyPing = false; byteBuf.markReaderIndex(); try { if (byteBuf.readUnsignedByte() == 254) { int id = byteBu...
5b37633d-f72d-4a83-a7e9-a9e27ea266b7
2
private void skip(long amount) throws IOException { while(amount > 0) { long skipped = input.skip(amount); if(skipped < 0) { throw new EOFException(); } amount -= skipped; } }
beeb4fbb-0f63-4083-83e7-bd8b82924bc1
5
@Override public void onCloseFile(String arg0, DokanFileInfo arg1) throws DokanOperationException { synchronized (handles) { if (DEBUG) System.out.println("CloseFile: " + arg0); if (arg1.handle == 0) return; FileHandle handle = handles.remove(arg1.handle); if (handle != null) { try {...
18869319-7da4-4317-81e1-2d4d3907c8d5
1
public ResultSet getList(String whereString) { StringBuffer sql = new StringBuffer(""); sql.append("SELECT Exam_ID,Instructions,isPublic"); sql.append(" FROM `Exam`"); if (whereString.trim() != "") { sql.append(" where " + whereString); } SQLHelper sQLHelper ...
c6547596-1b37-4563-ab7c-357158a3b515
0
@Override public void start() throws Exception { super.start(); }
8d3f58fd-c00b-4a7b-bff5-9cedbda25abf
1
public void updateTime() { if (this.isActive) { this.playersTurn.time++; // if (this.isWhitesTurn) { // this.playerWhite.time++; // } else { // this.playerBlack.time++; // } } else { this.stopTime(); } this.setWindowTitle(); }
c9c232ed-f2aa-4574-ba45-5e765cdff530
0
public int getPageFirstItem() { return page * pageSize; }
72f2d7a4-e686-4341-91c2-d8c1f79cda57
7
private List<Distance> getAMatchingDistance(List<Distance> referenceDistances, List<Distance> probeDistances) { List<Distance> list = new ArrayList<Distance>(); do { list.clear(); int random = new Random().nextInt(referenceDistances.size()); list.add(referenceDistances.get(random)); for(Distance d : pr...
ffa71c60-68a0-47de-812e-79eda9faa5a3
4
private void checkMaxRotationForMoments() { // If the maxrotation is negative, no maxrotation is checked if (getMaxRotation() < 0) return; // limits the moment(s) if needed for (Point momentorigin: this.moments.keySet()) { double moment = this.moments.get(momentorigin); if (Math.abs(moment) >...
67fa914a-6f1a-42b7-b699-58501b7a0258
4
private void kimmota(Pelihahmo h){ asetaKimmotusehto(h); if (getEhtoX(h) == 1){ h.setVaakaNopeus((-1)*h.getVaakaNopeus()*h.getNopeudenHidastusKerroin()); if (!h.getSuojakilpi()){ h.setElinvoima(h.getElinvoima() - Math.abs(h.getVaakaNopeus())*VAHE...
bc3d9869-4696-469c-8a2c-f3868cde8933
1
private void combo_expertizesItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_combo_expertizesItemStateChanged //заносим в глобальную переменную текущую ID экспертизы try { Globals.idCurrentExpertize = Integer.parseInt(String.valueOf(combo_expertizes.getSelectedItem(...
926dc597-acdf-4c33-8246-f0c5936a1c44
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the * to str...
3b0f0b39-7cea-4dc7-a4fb-e93ca8a5abcb
7
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost, msg)) return false; if((myHost instanceof MOB)&&(myHost == this.affected)&&(((MOB)myHost).location()!=null)) { if((msg.sourceMinor()==CMMsg.TYP_SHUTDOWN) ||((msg.sourceMinor()==CMMsg.TYP_QUIT)&...
f8432c0b-80d7-40cd-9064-3f7221892fd6
4
public static List<Card> process(String xmlFileName){ List<Card> cards = new ArrayList<Card>(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder; try { builder = factory.newDocumentBuilder(); Document doc = builder.parse(XMLDomProcess.class.getRes...
292aa4c9-4e32-433a-8580-cec58e997ed5
8
private Instances assignClassValue(Instances dataSet) { if (dataSet.classIndex() < 0) { if (m_logger != null) { m_logger. logMessage("[ClassValuePicker] " + statusMessagePrefix() + " No class attribute defined in data set."); m_logger.statusMessage(statusMessagePrefix() + "WARNING: N...
f2507699-7fa9-4965-8463-b71aa633b8ae
9
private String getConcatenated() { StringBuilder concatenated = new StringBuilder(); concatenated.append("receiver_id=").append(getReceiverId()); concatenated.append("&subject=").append(_subject); concatenated.append("&body=").append(_body != null ? _body : ""); concatenated.append("&amount=").append(_amount)...
626db883-71ad-4c07-a881-50f5003c988a
4
public void paintComponent(Graphics g) { super.paintComponent(g); //draw the background for(int h = 0; h <= 400; h+=cellH) { g.drawLine(0, h, 400, h); } for(int w = 0; w <= 400; w+=cellW) { g.drawLine(w, 0, w, 400); } for(int i = 0; i<numEnemy; i++) enemy[i].draw(g); p1.draw(g); if...
60c2bef4-3ef4-4648-b5c4-4be6efab2ad9
3
public void startGame(long noPlayers) { if (noPlayers != 1 && noPlayers != 2) { new MemoryGameError().displayError("startGame - invalid number of players specified."); return; } Game game; if (noPlayers == 1) { new OptionsMenuV...
5d7847c7-c95a-4a9b-ad35-eea4acf75c2e
4
public boolean isFirstColumn(Column column) { if (column != null) { for (Column col : mColumns) { if (col == column) { return true; } if (col.isVisible()) { return false; } } } return false; }
2145a16e-95bc-4ee1-84b9-4c7bf8edb68c
0
public void sacrifice() { }
05d320ff-df05-42fa-b02b-ae3b76551925
8
public static double[][] get_line_points_stegers(ImageProcessor ip, double sigma, boolean mode) { int image_width = ip.getWidth(); int image_height = ip.getHeight(); int l; double a; double b; //final line points double[][] line_points = new double[7][image_width*image_height]; // store results of...
81a9f42d-0a5b-4544-9b45-5909dfd842dc
8
public void sendToServer(final File fileToSend, final boolean isDirectory) { //TODO opportunity to append the file new Thread() { @Override public void run() { try { boolean haveToShowDialog = false; boolean appendFile = false; for (FTPFile f : ftpFiles) { if (fileToSend.getName().equ...
88188484-175a-41da-a6c6-27e8d87bef5a
5
@Override public void sendMessage(String sender, String receiver, String message, int sentBy) throws RemoteException { System.out.println("sending ..."); if(_userStore.get(receiver) != null) { System.out.println("user is online"); ClientInterface client = _userStore.get(receiver); if(client != null) c...
4673be06-579e-4639-a3df-a78e683a5ae5
2
protected void writeColumnTitles() throws IOException { final Iterator<String> titleIter = columnTitles.iterator(); while (titleIter.hasNext()) { final String title = titleIter.next(); if (titleIter.hasNext()) { this.writeWithDelimiter(title); } else ...
82a0ba22-c8c9-414f-ae53-25c327d61f10
1
public void registerAll(String fallbackPrefix, List<Subcommand> commands) { for (Subcommand cmd : commands) { register(fallbackPrefix, cmd); } }
dfc18db1-2968-40a3-9747-bfd87b739675
1
@Override public String toString() { if (tile == null) { return "p" + number + " is dead (" + cooldown + " turns remaining) with " + points + " points"; } return "p" + number + " at " + tile.x + "," + tile.y + " with " + points + " points"; ...
7195eda8-0ff6-4503-98aa-cdc5b2034ccb
6
public static void main(String[] args) { final String menu[] = {"Quitter", "Solde", "Paiement", "Retrait", "Dépot"}; int choix; boolean quit; Banque compte = new Banque(0); NumberFormat argent = NumberFormat.getCurrencyInstance(); //boucler tant et aussi longtemps que l'utilisateur n'a pas quitté qu...
e54773f8-6da9-4a5d-97a6-d30d4b36b47f
5
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; try { if (value.equals("0") || !value.endsWith("0")) { Double.parseDouble(value); isValueNumeric = true; ...
a918af67-d08a-411c-bc90-b04b082a9bc5
5
private Message collectMessageFromR(int c, int r) { int messageRound = 0; Message m; do { m = outcome.get(c); if (m != null) { messageRound = getRoundFromPayload(m.getPayload()); } if (isSuspect(c)) { // r is been suspected, no need to block any further break; } try { Thread.sl...
fc6bd6f8-75d1-4b48-8de3-4e2403cf2bd0
8
public void loadSchema(String catalogFile) { String line = ""; String baseFolder=new File(catalogFile).getParent(); try { BufferedReader br = new BufferedReader(new FileReader(new File(catalogFile))); while ((line = br.readLine()) != null) { /...
6dc6b90c-255c-4aeb-adde-3528e8df9d7c
4
@Override public boolean set(T object) { if (this.locked()) { return false; } if (this.lis != null && !this.lis.canChange(this)) { return false; } if (super.set(object)) { this.count++; return true; } return false; }
914d6959-4493-4f5d-b5ed-5e87e1636341
1
public void dropAllTables(){ try{ Connection connection = DriverManager.getConnection(connectionString); Statement s = connection.createStatement(); s.executeUpdate("drop table if exists parent"); s.executeUpdate("drop table if exists recipeingredients"); s.executeUpdate("drop table if exists ingredien...
8dd54e6b-f9fd-4eb4-baaa-43471406ba63
8
public void output_characterised_trace(String file_path, ArrayList<TraceEntry> trace, boolean debug, boolean output_enabled){ BufferedWriter bw = null; if(output_enabled){ try { bw = new BufferedWriter(new FileWriter(new File(file_path),false)); } catch (IOException e) { System.out.println("Couldn'...
b884ee30-13ad-4352-8487-e4db1ef09f82
2
static final ArchitectureToolkit getFactory(ARCH architecture) { switch (architecture) { case ENGINOLA: return enginolaToolkit; case EMBER: return emberToolkit; } // switch String errMsg = Integer.toString(architecture.ordinal(...
97855b5f-8660-4b01-b590-bd0727a730c4
6
public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); ...
1b172c10-0b9a-41d9-b3d5-adee562b906c
5
public void calculateAdjacentAnts(World world) { // Iterate through World cells in radius 1 around this cell and update adjacent ants count as necessary adjacentAntsBlack = 0; adjacentAntsRed = 0; for (int i = 0; i < 6; i++) { int[] adjCell = adjacentCell(i); Cel...
1a4203e7-4856-444d-8440-51b98162c000
7
void count(int i, int pos){ for(int digit=0; digit<=digits[pos]; digit++){ if(pos==digits.length-1 && digit==0) continue; if(isAsserted(i, digit) && !used[digit]){ if(digit<digits[pos]){ dp[1][i]+= factorial(pos); } else{ ...
86ad7c8f-7dc5-48d5-8ed4-3bd8ad958668
5
public String saveAssignment(){ preCreateAssignment(); boolean check = true; if(asmo.getDeadline().isEmpty()){ check = false; addFieldError("asmo.deadline", "You must to enter a value to deadline"); }else { SimpleDateFormat df = new SimpleDate...
e889a728-96ec-4754-9a4d-9e459133f061
5
public Map<Integer, Integer> getGeneSpans(String text) { Map<Integer, Integer> begin2end = new HashMap<Integer, Integer>(); Annotation document = new Annotation(text); pipeline.annotate(document); List<CoreMap> sentences = document.get(SentencesAnnotation.class); for (CoreMap sentence : sentences) {...
965438dc-4033-4309-a739-af8ed7dd9b26
6
public List<String> getAllSongs(String artistName){ if(artistName.equals(null) || artistName.equals("")) return null; List<String> allSongs = null; String url = buildUrl(artistName,null); try { Document document = reader.read(url); // XMLUtil.writeToFile(document, artistName + " - songs.xml"); ...
6e0a0467-0e9e-4f63-b66b-d1cceb6f21bd
0
private static AnswerCombination generateAnswerCombination() { List<Token<AnswerColors>> tokens = new ArrayList<Token<AnswerColors>>(); tokens.add(new Token<AnswerColors> (AnswerColors.BLACK)); tokens.add(new Token<AnswerColors> (AnswerColors.BLACK)); tokens.add(new Token<AnswerColors> (AnswerColors.WHI...
696fa9d8-0773-431a-a865-084f91e3fdcd
8
private Double pricingPlan(String plan) { final Properties prop = loadProperties(); if (plan != null) { if (PLAN_BASIC.equals(plan)) { return Double.parseDouble(prop.getProperty("plan.basic.fee")); } if (PLAN_PREMIER.equals(plan)) { Double.parseDouble(prop.getProperty("plan.premier.fee")); } ...
1bb56da2-de06-4b17-8e05-fdf03df06070
1
public OutlineHeader(Outline owner) { super(); mOwner = owner; setOpaque(true); addMouseListener(this); addMouseMotionListener(this); setAutoscrolls(true); ToolTipManager.sharedInstance().registerComponent(this); if (!GraphicsUtilities.inHeadlessPrintMode()) { DragSource.getDefaultDragSource().creat...
af6f825f-6273-4e6a-ae70-82606b996283
7
private void initCloseCode() throws InvalidFrameException { code = CloseFrame.NOCODE; ByteBuffer payload = super.getPayloadData(); payload.mark(); if( payload.remaining() >= 2 ) { ByteBuffer bb = ByteBuffer.allocate( 4 ); bb.position( 2 ); bb.putShort( payload.getShort() ); bb.position( 0 ); code...
50aa1e5a-4b83-4285-b8ab-b92a0b2f0a84
5
private void doRequest() { try { // jumping to START_OBJECT if(jp.nextToken() != JsonToken.START_OBJECT) { System.out.println("Root should be object: quitting"); return; } // jumping to fieldName "cell" jp.nextToken(); // jumping to START_OBJECT jp.nextToken(); JsonNode n...
dfc1c6f3-18ba-47e7-9556-01a04775ae30
3
private int popupExit () { int choix ; choix = GUIUtilities.question_YES_NO ( Utilities.getLangueMessage( Constantes.MESSAGE_FERMER_LOGICIEL )) ; if ( choix == JOptionPane.YES_OPTION ) { if ( this.fileName != null ) { choix = GUIUtilities.question_YES_NO_CANCEL ( Util...