method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
407970a2-873c-426b-b6b3-c4c43fa53bf9
3
private void moveOnX(Vector<Integer> ans, int xDis, int yDis){ if (xDis >= 0){ ans.add(1); if (yDis >= 0){ ans.add(0); ans.add(3); ans.add(2); } else { ans.add(2); ans.add(3); ans.add(0); } } else { ans.add(3); if (yDis >= 0){ ans.add(0); ans.add(1); ans.add(2); } else { ans.add(2); ans.add(1); ans.add(0); } } }
0071c030-bafb-4fa0-b71d-aab12ccc00f6
8
public void getInput() { Scanner scanner=new Scanner(System.in); int n, serial=1; while(scanner.hasNextInt()) { n=scanner.nextInt(); if(n<0) break; if(n==0||n==1) { System.out.println("Case "+serial+": 0"); }else if(n==2) { System.out.println("Case "+serial+": 1"); }else { int m=(int) Math.pow(2, 1); int i=1; int value=1,noOfPastes=1; for(i=1;m<=n;i++) { m=(int) Math.pow(2, i); if(m<=n) { value=m; noOfPastes=i; } } if(value==n) { System.out.println("Case "+serial+": "+(noOfPastes)); } else { System.out.println("Case "+serial+": "+(noOfPastes+1)); } } serial++; } }
b2abb491-2816-4270-aa6e-02f35817d75f
3
private boolean _jspx_meth_c_import_0(PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // c:import org.apache.taglibs.standard.tag.rt.core.ImportTag _jspx_th_c_import_0 = (org.apache.taglibs.standard.tag.rt.core.ImportTag) _jspx_tagPool_c_import_url_nobody.get(org.apache.taglibs.standard.tag.rt.core.ImportTag.class); _jspx_th_c_import_0.setPageContext(_jspx_page_context); _jspx_th_c_import_0.setParent(null); _jspx_th_c_import_0.setUrl("AdminHyperRef.jsp"); int[] _jspx_push_body_count_c_import_0 = new int[] { 0 }; try { int _jspx_eval_c_import_0 = _jspx_th_c_import_0.doStartTag(); if (_jspx_th_c_import_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return true; } } catch (Throwable _jspx_exception) { while (_jspx_push_body_count_c_import_0[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_c_import_0.doCatch(_jspx_exception); } finally { _jspx_th_c_import_0.doFinally(); _jspx_tagPool_c_import_url_nobody.reuse(_jspx_th_c_import_0); } return false; }
5921206e-e101-4dd1-902f-a70c1bb68ac6
4
public Double getTagWeight(Integer userID, Integer resourceID) { if (! userResourceTagMaping.containsKey(userID) || ! userResourceTagMaping.get(userID).containsKey(resourceID)) { return 0.0; } //get user's tag for the provided resource Map<Integer, List<Integer>> resourceTagMaping = userResourceTagMaping.get(userID); List<Integer> tags = resourceTagMaping.get(resourceID); Double resourceTagScore = 0.0; List<Integer> tagsByUser = new ArrayList<Integer>(); Set<Integer> uniqueTagsUsedByUser = new HashSet<Integer>(); for (List<Integer> tagsAtResource : resourceTagMaping.values()) { tagsByUser.addAll(tagsAtResource); uniqueTagsUsedByUser.addAll(tagsAtResource); } for (Integer tag : tags) { resourceTagScore += getTagScore(userID, tag, tagsByUser, uniqueTagsUsedByUser); } return resourceTagScore; }
f0205026-37dd-4cd3-b3a1-f19e0501f7dd
8
@Override public Object getValueAt(int row, int col) { Osoba osoba = data.get(row); switch (col) { case 0: return row; case 1: return osoba.getNazwisko(); case 2: return osoba.getImie(); case 3: return osoba.getKodPocztowy(); case 4: return osoba.getMiasto(); case 5: return osoba.getUlica(); case 6: return osoba.getTelefon(); case 7: return osoba.getTelefon2(); default: break; } return null; }
e888f295-6689-4e88-ab11-c041bc1290f1
9
public List getSearchArticles(int start, int end,String search, String val, int area) throws Exception{ Connection conn = null; Statement stmt = null; ResultSet rs = null; List<BoardDataBean> articleList = null; try{ conn = getConnection(); // val = new String(val.getBytes("iso_8859-1"),"utf-8"); String sql = "select * from (select ROWNUM as RNUM, b.* from (select * from board" + " where area="+area+" and "+search+" like '%"+val+"%'"+" order by ref desc, step asc) b) a " + "where RNUM >="+start+" and RNUM <="+end; System.out.println(sql); stmt = conn.createStatement(); rs = stmt.executeQuery(sql); if(rs.next()){ articleList = new ArrayList(end); do{ BoardDataBean article = new BoardDataBean(); article.setIdx(rs.getInt("idx")); article.setArea_idx(rs.getInt("area_idx")); article.setTitle(rs.getString("title")); article.setContent(rs.getString("content")); article.setNickname(rs.getString("nickname")); article.setId(rs.getString("id")); article.setWdate(rs.getTimestamp("wdate")); article.setRead_count(rs.getInt("read_count")); article.setRecommand_count(rs.getInt("recommand_count")); article.setRecommand(rs.getInt("recommand")); article.setNon_recommand(rs.getInt("non_recommand")); article.setCategory(rs.getString("category")); articleList.add(article); }while(rs.next()); } }catch(Exception ex){ System.out.println("boardDBBean getSearcharticles : " + ex); }finally{ if(rs != null){ try{rs.close();} catch(SQLException e){e.printStackTrace();} } if(stmt != null){ try{stmt.close();} catch(SQLException e){e.printStackTrace();} } if(conn != null){ try{conn.close();} catch(SQLException e){e.printStackTrace();} } } return articleList; }
976523d2-75e0-4f38-9ee0-e95bb30c405e
0
public static void main(String args[]) { new Win(); }
135713ce-535e-4cf5-9e09-c32253ef7a51
3
public boolean ValidateTicker(String ticker){ if("".equals(ticker)){ return false; } this.inputStream = getClass().getResourceAsStream("/allTickerSymbols.txt"); this.fileScanner = new Scanner(this.inputStream); while(this.fileScanner.hasNextLine()){ if(this.fileScanner.nextLine().contains(ticker)){ this.fileScanner.close(); return true; } } this.fileScanner.close(); return false; }
e9018d5b-9765-4fb0-9c41-8abb9aa84c8b
6
@Override public int loop() { if (Game.getClientState() != Game.INDEX_MAP_LOADED) { return 1000; } if (client != Bot.client()) { WidgetCache.purge(); Bot.context().getEventManager().addListener(this); client = Bot.client(); } if (Game.isLoggedIn()) { for (Node node : nodeCollection) { if (node != null && node.activate()) { node.execute(); return Random.nextInt(50, 100); } } } return Random.nextInt(50, 100); }
189fc74e-3440-4e9c-9fea-14dccf2fef08
6
@EventHandler public void CreeperWaterBreathing(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.getCreeperConfig().getDouble("Creeper.WaterBreathing.DodgeChance") / 100; final double ChanceOfHappening = random.nextDouble(); if (ChanceOfHappening >= randomChance) { dodged = true; } if (plugin.getCreeperConfig().getBoolean("Creeper.WaterBreathing.Enabled", true) && damager instanceof Creeper && e instanceof Player && plugin.getConfig().getStringList("Worlds").contains(world) && !dodged) { Player player = (Player) e; player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, plugin.getCreeperConfig().getInt("Creeper.WaterBreathing.Time"), plugin.getCreeperConfig().getInt("Creeper.WaterBreathing.Power"))); } }
a7735f93-d7e4-4da5-88b1-8a76d526a483
5
public void mousePressed(MouseEvent e) { for(int i = 0;i < ui.getButtons().size();i++) { b = ui.getButtons().get(i); if(e.getX()>=b.getX() && e.getX()<=b.getX()+b.getWidth()) { if(e.getY()>=b.getY() && e.getY()<=b.getY()+b.getHeight()) { b.setBgColor(Color.BLUE); repaint(); b.clicked(); break; } } } }
09e54b9f-7a82-43d3-a619-abba380373ab
9
protected int getPageAddressLarge(int va, boolean inst, boolean priv, boolean read, int entryL1, int entryL2) { int dom = BitOp.getField32(entryL1, 5, 4); int base = BitOp.getField32(entryL2, 16, 16); //int ap3 = BitOp.getField32(entryL2, 10, 2); //int ap2 = BitOp.getField32(entryL2, 8, 2); //int ap1 = BitOp.getField32(entryL2, 6, 2); //int ap0 = BitOp.getField32(entryL2, 4, 2); int sub = BitOp.getField32(va, 14, 2); int tblIndex = BitOp.getField32(va, 0, 16); int acc, apsub, pa; switch (sub) { case 0: case 1: case 2: case 3: apsub = BitOp.getField32(entryL2, 4 + sub * 2, 2); break; default: throw new IllegalArgumentException("Unknown sub page (large), " + String.format("sub:%d, va:0x%08x, entryL1:0x%08x, entryL2:%d.", sub, va, entryL1, entryL2)); } acc = getDomainAccess(dom); switch (acc) { case DOMACC_INVALID: case DOMACC_RESERVED: //ドメインフォルト、ページ faultMMU(FS_DOM_PAGE, dom, va, inst, priv, read, String.format("Domain page (large), dom list:0x%08x, dom acc:%d, entryL1:0x%08x", getCoProcStd().getCReg(CoProcStdv5.CR03_MMU_DACR), acc, entryL1)); return 0; case DOMACC_CLIENT: if (isPermitted(priv, read, apsub)) { //アクセス許可がある break; } //許可フォルト、ページ faultMMU(FS_PERM_PAGE, dom, va, inst, priv, read, String.format("Permission page (large), dom acc:%d, sub:%d, apsub:%d, entryL1:0x%08x, entryL2:0x%08x", acc, sub, apsub, entryL1, entryL2)); return 0; case DOMACC_MANAGER: //アクセス許可がある break; default: throw new IllegalArgumentException("Unknown domain access (large), " + String.format("dom acc:%d, va:0x%08x, entryL1:0x%08x, entryL2:%d.", acc, va, entryL1, entryL2)); } pa = (base << 16) | tblIndex; return pa; }
b00261f9-7200-4b98-80bc-f7c387b66e9c
4
private String format(LogRecord e) { StringBuilder sb = new StringBuilder(); Level lvl = e.getLevel(); if (lvl == Level.INFO) { sb.append("[INFO] "); } else if (lvl == Level.SEVERE) { sb.append("[SEVERE] "); }else if (lvl == Level.FINE) { sb.append("[MSG] "); } else { sb.append("[OTHER] "); } sb.append(e.getMessage()); sb.append('\n'); Throwable t = e.getThrown(); if(t!= null){ StringWriter sw = new StringWriter(); t.printStackTrace(new PrintWriter(sw)); sb.append(sw.toString()); } return sb.toString(); }
7a73039a-dd45-4dfa-8406-120120696cee
5
public String post(String name, Paste paste, ReportFormat format, ExpireDate expireDate) { if(name == null) name = ""; String report_url = ""; try { URL urls = new URL(this.POST_URL); HttpURLConnection conn = (HttpURLConnection) urls.openConnection(); conn.setConnectTimeout(5000); conn.setReadTimeout(5000); conn.setRequestMethod("POST"); conn.addRequestProperty("Content-type", "application/x-www-form-urlencoded"); conn.setInstanceFollowRedirects(false); conn.setDoOutput(true); OutputStream out = conn.getOutputStream(); byte[] data = ("api_option=paste" + "&api_dev_key=" + URLEncoder.encode(this.API_KEY, "utf-8") + "&api_paste_code=" + URLEncoder.encode(paste.toString(), "utf-8") + "&api_paste_private=" + URLEncoder.encode("1", "utf-8") + // 1 = unlisted, 0 = public, 2 = private (need to be logged in for that) "&api_paste_name=" + URLEncoder.encode(name, "utf-8") + "&api_paste_expire_date=" + URLEncoder.encode(expireDate.toString(), "utf-8") + "&api_paste_format=" + URLEncoder.encode(format.toString(), "utf-8") + "&api_user_key=" + URLEncoder.encode("", "utf-8")).getBytes(); out.write(data); out.flush(); out.close(); if (conn.getResponseCode() == 200) { InputStream receive = conn.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(receive)); String line; StringBuffer response = new StringBuffer(); while ((line = reader.readLine()) != null) { response.append(line); response.append("\r\n"); } reader.close(); String result = response.toString().trim(); if (!result.contains("http://")) { report_url = "Failed to post! (returned result: " + result; } else { report_url = result.trim(); } } else { report_url = "Failed to post!"; } } catch (Exception e) { e.printStackTrace(); } return report_url; }
4351470d-0ffa-468f-bacd-8cd88d7aa85e
4
public void displayResult(boolean success) { String text; if (success) { display.setForeground(Color.GREEN); text = "Success!"; } else { display.setForeground(Color.RED); text = "Failed"; } display.setText(text); display.setEchoChar((char) 0); display.setEditable(false); for(int i=0;i<buttons.length;i++) buttons[i].setEnabled(false); try { Thread.sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } for(int i=0;i<buttons.length;i++) buttons[i].setEnabled(true); display.setText(""); display.setEchoChar(passwordChar); display.setEditable(true); }
c7f57701-87f9-42c0-a76c-3ac7a99d4e22
0
public void setTurnOffCommand(Command turnOffCommand) { this.turnOffCommand = turnOffCommand; }
66f375ff-e84b-417b-82b5-f1e10732d4dc
0
Type(int type) { this.type = type; }
99a8a579-649c-4c36-966b-c0c00bfd723e
7
private void lsUpdateGroup (final int ISA, final int first, final int last) { final int[] SA = this.SA; int a, b; int t; for (a = first; a < last; ++a) { if (0 <= SA[a]) { b = a; do { SA[ISA + SA[a]] = a; } while ((++a < last) && (0 <= SA[a])); SA[b] = b - a; if (last <= a) { break; } } b = a; do { SA[a] = ~SA[a]; } while (SA[++a] < 0); t = a; do { SA[ISA + SA[b]] = t; } while (++b <= a); } }
7c6a91cf-e681-445f-82f8-f4e7811dc88a
1
@Override public void mouseClicked(MouseEvent e) { System.out.println("CLICK"); new Thread(new Runnable(){ public void run() { synchronized(Main.lignes) { MenuDroite.lblVitesse.setText(""+bus.getVitesse());// = new JLabel("OH YEAH "+bus.getId()); Utils.removeAllListeners(MenuDroite.btnAugmenterVitesse); Utils.removeAllListeners(MenuDroite.btnReduireVitesse); Utils.removeAllListeners(MenuDroite.slctDestination); MenuDroite.btnReduireVitesse.addActionListener(new ReduireCtrl(bus)); MenuDroite.btnAugmenterVitesse.addActionListener(new AugmenterCtrl(bus)); MenuDroite.modelSlctDestination.removeAllElements(); Iterator it = Main.stations.get(""+bus.getLigneId()).iterator(); while(it.hasNext()) { MenuDroite.modelSlctDestination.addElement(it.next()); } MenuDroite.slctDestination.addItemListener(new DestinationCtrl(bus)); MenuDroite.lblLigne.setText("Ligne "+bus.getLigneId()+ "- Bus "+bus.getId()); MenuDroite.lblTraffic.setText(Main.lignes.get("LIGNE bus.getLigneId()").getEtatTraffic()); Main.contenuPrincipal.menuDroite.validate(); } }}).start(); }
8d92092f-e07e-420c-9874-f5ba93016fd6
6
public void method346(int i, int j) { i += anInt1442; j += anInt1443; int l = i + j * DrawingArea.width; int i1 = 0; int j1 = myHeight; int k1 = myWidth; int l1 = DrawingArea.width - k1; int i2 = 0; if(j < DrawingArea.topY) { int j2 = DrawingArea.topY - j; j1 -= j2; j = DrawingArea.topY; i1 += j2 * k1; l += j2 * DrawingArea.width; } if(j + j1 > DrawingArea.bottomY) j1 -= (j + j1) - DrawingArea.bottomY; if(i < DrawingArea.topX) { int k2 = DrawingArea.topX - i; k1 -= k2; i = DrawingArea.topX; i1 += k2; l += k2; i2 += k2; l1 += k2; } if(i + k1 > DrawingArea.bottomX) { int l2 = (i + k1) - DrawingArea.bottomX; k1 -= l2; i2 += l2; l1 += l2; } if(k1 <= 0 || j1 <= 0) { } else { method347(l, k1, j1, i2, i1, l1, myPixels, DrawingArea.pixels); } }
576aa71a-d008-48f8-a72f-a48f9332f8fc
5
@Override public boolean doTest(FuzzySet set, IDomain domain) { boolean isSymmetric = new SymmetryTestCommand( set.getName()).doTest(set, domain); System.out.println(isSymmetric ? "YES" : "NO"); boolean isReflexive = new ReflexivityTestCommand( set.getName()).doTest(set, domain); System.out.println(isReflexive ? "YES" : "NO"); boolean isTransitive = new TransitivityTestCommand( set.getName(), minOperator).doTest(set, domain); System.out.println(isTransitive ? "YES" : "NO"); System.out.print("Is " + set.getName() + " an equivalence relation? "); return isSymmetric && isReflexive && isTransitive; }
75d1df78-72e1-4feb-ac34-693979998627
8
public void handleReceivedPacket(DatagramPacket packet){ byte [] data=packet.getData(); String temp_name=extractName(data); if(temp_name.equals(name)){ return;//if packet with the name of the host arrived -> dont do anything } String message; if(!members.contains(temp_name)){ // first time connected members.add(temp_name); ui.addUserToList(temp_name); System.out.println(printMembers(members)); } if(data[0]==TEXT){ System.out.println("Received from : " + temp_name); if(data[SEQ_NUM_INDEX]!=last_seq_num){ last_seq_num=data[SEQ_NUM_INDEX]; message=extractText(data); System.out.println("Received new Text : " + message); calendar= new GregorianCalendar(); // it has to be created here ui.addStringToChat(temp_name,calendar.get(Calendar.HOUR), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND), message); }else{ calendar= new GregorianCalendar(); // or here // ui.addStringToChat(temp_name,calendar.get(Calendar.HOUR), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND), "sent us a duplicate!!!");//debugging } prepareNextAck();//send back an ack always sender.wakeUp(); } if(data[0]==ACK){ System.out.println("ACK received!"); ack_buffer.remove(temp_name);//cross off that ack if(ack_buffer.isEmpty()){ conseq_timeouts=0;//reset timeout counter timer.stop(); } } if(data[0]==AUDIO){ //logic goes here; } if(data[0]==DISCONNECT){ System.out.println("DISCONNECT user : " + temp_name); members.remove(temp_name); ack_buffer.remove(temp_name); ui.removeUserFromList(temp_name); } //sender.wakeUp(); }
d1d7b6e0-732a-420f-bac7-726408362d2d
7
public static void main(String[] args) throws DatumException { SortedSet<Voertuig> voertuigen; voertuigen = new TreeSet<>(); try { voertuigen.add(new Personenwagen("opel", DATUM_1, 1000, 5, Color.YELLOW, BESTUURDER_A, INGEZETENE_A, INGEZETENE_B)); voertuigen.add(new Personenwagen("opel", DATUM_2, 1050, 4, Color.RED, BESTUURDER_B, INGEZETENE_C, INGEZETENE_D)); voertuigen.add(new Pickup("GMC", DATUM_3, 2000, 3, Color.WHITE, VOLUME_1, BESTUURDER_AB)); voertuigen.add(new Pickup("FORD", DATUM_3, 2100, 3, Color.RED, VOLUME_2, BESTUURDER_BBE, INGEZETENE_E, INGEZETENE_F)); voertuigen.add(new Vrachtwagen("MAN", DATUM_5, 4000, 2, VOLUME_3, 10000, 2, BESTUURDER_D, INGEZETENE_G)); voertuigen.add(new Vrachtwagen("SCANIA", DATUM_6, 4000, 3, VOLUME_4, 15000, 2, BESTUURDER_DE, INGEZETENE_G, INGEZETENE_H)); } catch (IllegalArgumentException e) { System.out.printf("Caught IllegalArgumentException: %s", e.getMessage()); System.exit(1); } catch (MensException e) { System.out.printf("Caught MensException: %s", e.getMessage()); System.exit(1); } SortedSet<Voertuig> voertuigen_aankoop = new TreeSet<>(Voertuig.getAankoopprijsComparator()); SortedSet<Voertuig> voertuigen_merk = new TreeSet<>(Voertuig.getMerkComparator()); voertuigen_aankoop.addAll(voertuigen); voertuigen_merk.addAll(voertuigen); printVoertuigen("eerste set", voertuigen.iterator()); printVoertuigen("tweede set", ((TreeSet<Voertuig>) voertuigen_aankoop).descendingIterator()); printVoertuigen("derde set", ((TreeSet<Voertuig>) voertuigen_merk).iterator()); // Serialization String serFileName = "wagenpark.ser"; try (ObjectOutputStream fh = new ObjectOutputStream(new FileOutputStream(serFileName))) { fh.writeObject(voertuigen); } catch (FileNotFoundException e) { System.out.printf("Caught FileNotFoundException: %s\n", e.getMessage()); System.exit(1); } catch (IOException e) { System.out.printf("Caught IOException: %s\n", e.getMessage()); System.exit(1); } SortedSet<Voertuig> voertuigen_deserialized; try (ObjectInputStream fh = new ObjectInputStream(new FileInputStream(serFileName))) { try { voertuigen_deserialized = (SortedSet < Voertuig >) fh.readObject(); printVoertuigen("deserialized set", voertuigen_deserialized.iterator()); } catch (ClassNotFoundException e) { System.out.printf("Caught ClassNotFoundException: %s\n", e.getMessage()); System.exit(1); } } catch (FileNotFoundException e) { System.out.printf("Caught FileNotFoundException: %s\n", e.getMessage()); System.exit(1); } catch (IOException e) { System.out.printf("Caught IOException: %s\n", e.getMessage()); System.exit(1); } }
5385f2b5-6121-4402-91c3-33d407f91f39
6
@SuppressWarnings("unchecked") public void addTag(String tag, String filePath){ Picture picture = findById(filePath); if(picture != null){ List<TagI> tags = new ArrayList<TagI>(); try{ tags = (List<TagI>) picture.getTags(); }catch(Exception y){ Log.getLogger().log(Level.INFO, "Couldn't get any tags from Pictur " + picture); tags = new ArrayList<TagI>(); } Tag tagg = this.tagDao.findById(tag); if(tagg != null){ List<PictureI> pics = new ArrayList<PictureI>(); try{ pics = (List<PictureI>) tagg.getPictures(); }catch(Exception i){ Log.getLogger().log(Level.INFO, "Couldn't get any pictures from Tag " + tagg); } if(!(pics.contains(picture))){ beginTransaction(); pics.add(picture); tagg.setPictures(pics); tags.add(tagg); picture.setTags(tags); this.tagDao.persist(tagg); commitTransaction(); } }else{ beginTransaction(); TagI newTag = new Tag(); newTag.setTag(tag); List<PictureI> pictures = new ArrayList<PictureI>(); pictures.add(picture); newTag.setPictures(pictures); List<TagI> taggs = new ArrayList<TagI>(); try{ taggs = (List<TagI>) picture.getTags(); }catch(Exception u){ Log.getLogger().log(Level.INFO, "Couldn't get any tags from Picture " + picture); } taggs.add(newTag); picture.setTags(tags); persist(picture); entityManager.persist(newTag); commitTransaction(); } } }
6891dfe8-33fe-43c6-a61a-1967faef922b
0
public static boolean isNumeric(String str) { NumberFormat formatter = NumberFormat.getInstance(); ParsePosition pos = new ParsePosition(0); formatter.parse(str, pos); return str.length() == pos.getIndex(); }
6f1e58fd-bb86-4ab9-8644-2b380e84b6dc
0
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: final Thread serverThread = new Thread(){ public void run(){ basicslick.server.GameServer server = new basicslick.server.GameServer(PORT); } }; serverThread.start(); }//GEN-LAST:event_jButton2ActionPerformed
20e42afe-3e32-41be-a6e2-1508b26cab28
2
private static int fac(int n){ if (n==0) return 1; if (n==1) return 1; return n*fac(n-1); }
86a2c6e3-7e23-4d1f-bd8c-90307c6002d9
6
@EventHandler public void SnowmanStrength(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.getsnowgolemConfig().getDouble("Snowman.Strength.DodgeChance") / 100; final double ChanceOfHappening = random.nextDouble(); if (ChanceOfHappening >= randomChance) { dodged = true; } if (plugin.getsnowgolemConfig().getBoolean("Snowman.Strength.Enabled", true) && damager instanceof Snowman && e instanceof Player && plugin.getConfig().getStringList("Worlds").contains(world) && !dodged) { Player player = (Player) e; player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, plugin.getsnowgolemConfig().getInt("Snowman.Strength.Time"), plugin.getsnowgolemConfig().getInt("Snowman.Strength.Power"))); } }
b6511b31-c06c-42b7-a512-187f4da9228d
7
public void printToFile(String filePath) { try { StringBuilder sbOutput = new StringBuilder(); // Output each member of settings. for (Field field : this.getClass().getDeclaredFields()) { String typestr = field.getType().toString().toLowerCase(); if (typestr.endsWith("string") || typestr.endsWith("int") || typestr.endsWith("double") || typestr.endsWith("float") || typestr.endsWith("boolean")) { // We only print the fields with basic types. sbOutput.append(field.getName() + "=" + field.get(this)); sbOutput.append(System.getProperty("line.separator")); } } FileReaderAndWriter.writeFile(filePath, sbOutput.toString()); } catch (Exception ex) { ex.printStackTrace(); } }
fb62e418-8efa-4a71-8f26-79a1bdc37b6c
7
private static String defineCord(HashMap<String, List<String>> pDictionary, String cordType) { for (int i=0; i < pDictionary.get(allURIs.get(cordType)).size(); i++) { if (cordType.equalsIgnoreCase("x")) {X.add(Double.parseDouble(pDictionary.get(allURIs.get(cordType)).get(i)));} else if (cordType.equalsIgnoreCase("y")) {Y.add(Double.parseDouble(pDictionary.get(allURIs.get(cordType)).get(i)));} else if (cordType.equalsIgnoreCase("relx")) { if (pDictionary.get(allURIs.get(cordType)).size() > 1) {relX.add(Double.parseDouble(pDictionary.get(allURIs.get(cordType)).get(i)));} else {relX.add(Double.parseDouble(pDictionary.get(allURIs.get(cordType)).get(i))); relX.add(Double.parseDouble(pDictionary.get(allURIs.get(cordType)).get(i)));} } else if (cordType.equalsIgnoreCase("rely")) { if (pDictionary.get(allURIs.get(cordType)).size() > 1) {relY.add(Double.parseDouble(pDictionary.get(allURIs.get(cordType)).get(i)));} else {relY.add(Double.parseDouble(pDictionary.get(allURIs.get(cordType)).get(i))); relY.add(Double.parseDouble(pDictionary.get(allURIs.get(cordType)).get(i)));} } } return cordType; }
9ca400c8-06b4-433c-ac08-b9089d7cab8a
3
public synchronized void closeCon() throws Exception { // 清空用户列表 sleep(300); listModel.removeAllElements(); listmodel.removeAllElements(); onLineUsers.clear(); chatRooms.clear(); objChatRooms.clear(); btn_start.setEnabled(true); txt_name.setEnabled(true); txt_port.setEnabled(true); txt_hostIp.setEnabled(true); btn_stop.setEnabled(false); frame.setTitle("Client"); // 被动的关闭连接释放资源 if (reader != null) { reader.close(); } if (writer != null) { writer.close(); } if (socket != null) { socket.close(); } isConnected = false;// 修改状态为断开 }
64d976e7-006a-41b4-9991-ac9c73a88e56
9
private Object getFieldValue(final Field field, Object entity) { try { Class<?> clazz = field.getType(); if (clazz.equals(Integer.TYPE)) { return field.getInt(entity); } if (clazz.equals(Long.TYPE)) { return field.getLong(entity); } if (clazz.equals(String.class)) { return field.get(entity); } if (clazz.equals(Boolean.TYPE)) { return field.getBoolean(entity); } if (clazz.equals(Float.TYPE)) { return field.getFloat(entity); } if (clazz.equals(Double.TYPE)) { return field.getDouble(entity); } if (clazz.equals(Date.class)) { return field.get(entity); } return field.get(entity); } catch (IllegalArgumentException | IllegalAccessException ex) { Logger.getLogger(ResultSetMapper.class.getName()).log(Level.SEVERE, null, ex); } return null; }
cd81ea0d-17ba-4ff4-b8ae-d3e889ae7b65
9
private void handleEntityEnd() { if (currentArea == null || currentAttributes == null) { log.warning("Can't handle this entity! Current Value: " + currentValue + ", Current Attributes: " + currentAttributes); return; } if (currentArea.equals("accessible")) { String entity = null; for (int i = 0; i < currentAttributes.getLength(); i++) { if (currentAttributes.getLocalName(i).equals("name")) { entity = currentAttributes.getValue(i); break; } } if (entity != null) { info.addAccessibleEntity(entity, currentValue); } else { log.warning("No entity name found!"); } } else if (currentArea.equals("inaccessible")) { for (int i = 0; i < currentAttributes.getLength(); i++) { if (currentAttributes.getLocalName(i).equals("name")) { info.addInaccesibleEntity(currentAttributes.getValue(i)); } } } currentAttributes = null; }
6018591e-23a6-4b99-b87c-c36c17dc0747
8
public static void main(String[] args) { openConfig(".jifirc"); //if we have arguments...don't use a gui //Usage: jifi <device> <hex file> if (args.length == 2 && true) { String dev = args[0]; String file = args[1]; IfiComm comm = new IfiComm(Jifi.lastPort); try { comm.open(); /* TODO: recognize what controller is being used and act accordingly */ if (comm.getDevice() != Device.PIC18F8722 && comm.getDevice() != Device.PIC18F8520) { throw new IOException ("Controller not of the right type"); } /* write the hex file to the device */ HexFile hex = HexReader.parse(Jifi.lastFile); comm.eraseMem(0x000800, hex.getDataSize()); byte[][] data = hex.getChunkedData(Jifi.chunkSize); int dataSize = data.length; int firstUsedAddr = hex.getFirstUsedAddress(); for (int i=0; i<data.length; ++i) { int perc = (i+1)*100/data.length; char[] progBar = new char[30*perc/100]; java.util.Arrays.fill(progBar, '*'); System.out.printf("Uploading File: |%-30s| %d%%\r", new String(progBar), perc); try { comm.writeMem(firstUsedAddr + Jifi.chunkSize*i, data[i]); } catch (IOException ioe) { //TODO redo System.out.println("Failed at chunk: "+ i+1 + "[" + (firstUsedAddr+251*i) + "]"); throw new IOException ("Connection to RC was lost.\nMake Sure the cable is connected and try again."); } } System.out.printf("\n"); comm.returnToUserCode(); System.exit(0); } catch (FileNotFoundException fnfe) { System.out.println("File not found ex: " + fnfe.getMessage()); } catch (IOException ioe) { System.out.println(ioe.getMessage()); } } else { JifiWin win = new JifiWin(); win.open(); } saveConfig(".jifirc"); }
3e7e7e52-abaf-4959-a5e7-aafb500590b5
0
@Override protected void onTermination(Throwable exception) { System.out.printf("MyWorkerThread %d:%d\n",getId(),taskCounter.get()); super.onTermination(exception); }
ee71ef9c-8ead-4d38-8194-da651be57e5c
1
private void startUpdate() { if(periodicAddonUpdate == null) setPeriodicUpdate(1000); }
9f10aa14-60c1-4671-9ed0-6090dbabd7bf
8
@Override public boolean verifyInput() { if (lineCommentsEnabledCB.isSelected()) { String lineCommentStart = lineCommentStartField.getText().trim(); if (lineCommentStart.length()==0) { app.validateError(lineCommentStartField, "Error.NoEolCommentStart"); return false; } } if (mlcsEnabledCB.isSelected()) { String mlcStart = mlcStartDelimField.getText().trim(); if (mlcStart.length()==0) { app.validateError(mlcStartDelimField, "Error.NoMlcStart"); return false; } String mlcEnd = mlcEndDelimField.getText().trim(); if (mlcEnd.length()==0) { app.validateError(mlcEndDelimField, "Error.NoMlcEnd"); return false; } } if (docCommentsEnabledCB.isSelected()) { String docStart = docStartDelimField.getText().trim(); if (docStart.length()==0) { app.validateError(docStartDelimField, "Error.NoDocCommentStart"); return false; } String docEnd = docEndDelimField.getText().trim(); if (docEnd.length()==0) { app.validateError(docEndDelimField, "Error.NoDocCommentEnd"); return false; } } return true; }
67ea32f2-88ef-40f4-bf05-ff05698daae3
1
private void evalPutField(int opcode, int index, Frame frame) throws BadBytecode { String desc = constPool.getFieldrefType(index); Type type = zeroExtend(typeFromDesc(desc)); verifyAssignable(type, simplePop(frame)); if (opcode == PUTFIELD) { Type objectType = resolveClassInfo(constPool.getFieldrefClassName(index)); verifyAssignable(objectType, simplePop(frame)); } }
747014e0-aa20-4125-9da8-8b96ce5961e7
8
public static DictItem find(List<DictItem> dictionary, String groupId, String artifactId, String version) { DictItem match=null; for(DictItem item:dictionary) { if(item.groupId.equals(groupId)&& item.artifactId.equals(artifactId)) { // If there is a version matching this version, pick that if(version.equals(item.version)) match=item; else if(item.version.equals("*")) { if(match!=null&&match.version.equals("*")) throw new RuntimeException("Duplicate:"+match); if(match==null) match=item; } } } return match; }
348ef40d-64ee-4ded-a05f-5631628fdda0
7
protected Map readStates(Node node, Automaton automaton, Set locatedStates, Document document) { Map i2s = new java.util.HashMap(); if(node == null) return i2s; NodeList allNodes = node.getChildNodes(); ArrayList stateNodes = new ArrayList(); for (int k = 0; k < allNodes.getLength(); k++) { if (allNodes.item(k).getNodeName().equals(STATE_NAME)) { stateNodes.add(allNodes.item(k)); } } // Map state IDs to states, in an attempt to add in numeric // things first. A specialized Comparator is helpful here. Map i2sn = new java.util.TreeMap(new Comparator() { public int compare(Object o1, Object o2) { if (o1 instanceof Integer && !(o2 instanceof Integer)) return -1; if (o1 instanceof Integer) return ((Integer) o1).intValue() - ((Integer) o2).intValue(); if (o2 instanceof Integer) return 1; return ((Comparable) o1).compareTo(o2); } }); createState(stateNodes, i2sn, automaton, locatedStates, i2s, false, document); // i2s = addBlocks(document, automaton, locatedStates, i2s); return i2s; }
77c995fd-ba04-4d70-a3d4-d509f06d7c9e
0
@Override public Iterator<AbstractPlay> iterator() { return bestPlays.iterator(); }
722f1daf-2290-4dca-b050-0737367af748
8
public static String NumberToText( int n) { if ( n < 0 ) return "Minus " + NumberToText(-n); else if ( n == 0 ) return ""; else if ( n <= 19 ) return new String[] {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"}[n-1] + " "; else if ( n <= 99 ) return new String[] {"Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"}[n / 10 - 2] + " " + NumberToText(n % 10); else if ( n <= 199 ) return "One Hundred " + NumberToText(n % 100); else if ( n <= 999 ) return NumberToText(n / 100) + "Hundreds " + NumberToText(n % 100); else if ( n <= 1999 ) return "One Thousand " + NumberToText(n % 1000); else if ( n <= 999999 ) return NumberToText(n / 1000) + "Thousands, " + NumberToText(n % 1000); else return ""; }
63f3a145-be90-4279-9b9a-ac300ab62862
5
@Override public User createUser(User user) { Connection cn = null; PreparedStatement ps = null; ResultSet rs = null; try { cn = ConnectionHelper.getConnection(); ps = cn.prepareStatement(QTPL_INSERT_USER, new String[] { "user_id" }); ps.setString(1, user.getFirstName()); ps.setString(2, user.getLastName()); ps.setString(3, user.getEmail()); ps.executeUpdate(); rs = ps.getGeneratedKeys(); if (rs.next()) { int userId = rs.getInt(1); user.setUserId(userId); } } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } finally { try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } try { ps.close(); } catch (SQLException e) { e.printStackTrace(); } try { cn.close(); } catch (SQLException e) { e.printStackTrace(); } } return user; }
2266e948-6b4b-465c-be76-124bbd21fb57
8
public void buildAssociations(Instances instances) throws Exception { m_errorMessage = null; m_targetSI.setUpper(instances.numAttributes() - 1); m_target = m_targetSI.getIndex(); Instances inst = new Instances(instances); inst.setClassIndex(m_target); inst.deleteWithMissingClass(); // can associator handle the data? getCapabilities().testWithFail(inst); if (inst.attribute(m_target).isNominal()) { m_targetIndexSI.setUpper(inst.attribute(m_target).numValues() - 1); m_targetIndex = m_targetIndexSI.getIndex(); } else { m_targetIndexSI.setUpper(1); // just to stop this SingleIndex from moaning } if (m_support <= 0) { throw new Exception("Support must be greater than zero."); } m_numInstances = inst.numInstances(); if (m_support >= 1) { m_supportCount = (int)m_support; m_support = m_support / (double)m_numInstances; } m_supportCount = (int)Math.floor((m_support * m_numInstances) + 0.5d); // m_supportCount = (int)(m_support * m_numInstances); if (m_supportCount < 1) { m_supportCount = 1; } m_header = new Instances(inst, 0); if (inst.attribute(m_target).isNumeric()) { if (m_supportCount > m_numInstances) { m_errorMessage = "Error: support set to more instances than there are in the data!"; return; } m_globalTarget = inst.meanOrMode(m_target); } else { double[] probs = new double[inst.attributeStats(m_target).nominalCounts.length]; for (int i = 0; i < probs.length; i++) { probs[i] = (double)inst.attributeStats(m_target).nominalCounts[i]; } m_globalSupport = (int)probs[m_targetIndex]; // check that global support is greater than min support if (m_globalSupport < m_supportCount) { m_errorMessage = "Error: minimum support " + m_supportCount + " is too high. Target value " + m_header.attribute(m_target).value(m_targetIndex) + " has support " + m_globalSupport + "."; } Utils.normalize(probs); m_globalTarget = probs[m_targetIndex]; /* System.err.println("Global target " + m_globalTarget); System.err.println("Min support count " + m_supportCount); */ } m_ruleLookup = new HashMap<HotSpotHashKey, String>(); double[] splitVals = new double[m_header.numAttributes()]; byte[] tests = new byte[m_header.numAttributes()]; m_head = new HotNode(inst, m_globalTarget, splitVals, tests); // m_head = new HotNode(inst, m_globalTarget); }
02cb853c-04c9-47db-97e5-9836ad12819d
9
public static void initializeMappingFile (String sourceDir, String mappingFileName) throws IOException { GenUtil.validateString (sourceDir); GenUtil.validateString(mappingFileName); try { CSVReader br = new CSVReader (new FileReader (new File (sourceDir, mappingFileName))); String [] headersArr = null; String [] tempArr; RaveDD rdd = null; int cnt = 0; while ((tempArr = br.readNext()) != null) { if (tempArr.length < 5) { throw new IllegalStateException ("Source Data dictionary " + "file not valid: " + mappingFileName + " " + tempArr.length); } //debugging if (tempArr [0] == null || tempArr [1].length () == 0) { continue; } if (headersArr == null) { headersArr = tempArr; continue; } //if new DD list of entries if (rdd == null || !tempArr [0].equals (rdd.getName())) { if (rdd != null) { RaveDDMapper.addDD(rdd); cnt++; } rdd = new RaveDD(); rdd.setName (tempArr [0]); } rdd.addDDEntry (tempArr [1], Integer.parseInt (tempArr [2]), tempArr [3], tempArr [4]); } RaveDDMapper.addDD(rdd); cnt++; System.out.println ("Read Rave DD Entries: " + cnt); } catch (IOException e) { throw new RuntimeException ("Unable to read mapping file." + mappingFileName); } //debugging /* System.out.println ("Listing all code/label pairs: "); for (int i = 0; i < RaveDDMapper.RaveDDList.size (); i++) { System.out.print (RaveDDMapper.RaveDDList.get (i).toString()); } */ }
59c650d6-7708-48eb-b0d4-821f0fcd29bc
8
public static void assertReferenceIsGCed(String text, Reference<?> ref) { List<byte[]> alloc = new ArrayList<>(); int size = 100000; for (int i = 0; i < 50; i++) { if (ref.get() == null) { return; } try { System.gc(); } catch (OutOfMemoryError ignore) {} try { System.runFinalization(); } catch (OutOfMemoryError ignore) {} try { alloc.add(new byte[size]); size = (int) (size * 1.3d); } catch (OutOfMemoryError ignore) { size = size / 2; } try { if (i % 3 == 0) { Thread.sleep(i * 5); } } catch (InterruptedException ignore) {} } fail(text); }
2dc13d5a-2419-4b73-a7e8-1f989572c536
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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(TicTacToe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(TicTacToe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(TicTacToe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(TicTacToe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TicTacToe().setVisible(true); } }); }
36d81a7f-e2e8-4481-b4a0-98a298b04ae2
4
public Vector<Vector<Object>> userTable() { try { String[] keys = {"username", "active"}; crs = qb.selectFrom(keys, "users").all().executeQuery(); data.clear(); while(crs.next()) { Vector<Object> row = new Vector<Object>(); ResultSetMetaData metadata = crs.getMetaData(); int numberOfColumns = metadata.getColumnCount(); for(int i = 1; i <= numberOfColumns; i++) { row.addElement(crs.getObject(i)); } data.addElement(row); } } catch (SQLException e) { e.printStackTrace(); } finally { try { crs.close(); } catch (SQLException e) { e.printStackTrace(); } } return data; }
a5d13cf9-e596-4341-b134-bcdb05784d45
1
@Test(expected = PersistencyException.class) public void WhenLoadingFromFileWithInvalidPort_ExpectIllegalArgumentException() throws PersistencyException { RoutingTable routingTable = new RoutingTable(); try { persistenceDelegate_.load(INVALID_PORT_FILE, routingTable); } catch (FileNotFoundException e) { } }
1dfe641f-55d6-4f3c-b48d-0ff0bed4d6b4
9
public ArrayList<Integer> findSubstring(String S, String[] L) { int n = S.length(); int m = L[0].length(); int l = L.length; Map<String, Integer> needFind = new HashMap<String, Integer>(); Map<String, Integer> hasFound = new HashMap<String, Integer>(); for (int i = 0; i < l; i++) { if (!needFind.containsKey(L[i])) { needFind.put(L[i], 1); } else { needFind.put(L[i], needFind.get(L[i]) + 1); } } ArrayList<Integer> r = new ArrayList<Integer>(); int j; String w; for (int i = 0; i < n - l * m + 1; i++) { w = S.substring(i, i + m); if (needFind.containsKey(w)) { hasFound.clear(); hasFound.put(w, 1); for (j = 1; j < l; j++) { w = S.substring(i + j * m, i + (j + 1) * m); if (!needFind.containsKey(w)) { break; } Integer v = hasFound.get(w); hasFound.put(w, v == null ? 1 : v + 1); if (hasFound.get(w) > needFind.get(w)) { break; } } if (j == l) { r.add(i); } } } return r; }
f4f1e119-7713-4eba-8c97-81b44327992d
3
static synchronized void remove(LinkedList list, String name) { if (list == null) return; ListIterator iterator = list.listIterator(); while (iterator.hasNext()) { AttributeInfo ai = (AttributeInfo)iterator.next(); if (ai.getName().equals(name)) iterator.remove(); } }
811805e7-ff20-4647-a79e-f7345be05724
7
private static final FileOnDisk getPreferencesFileOnDisk(String string, int i, String string_14_, int i_15_) { String string_16_; if (i_15_ == 33) string_16_ = "jagex_" + string_14_ + "_preferences" + string + "_rc.dat"; else if (i_15_ != 34) string_16_ = "jagex_" + string_14_ + "_preferences" + string + ".dat"; else string_16_ = "jagex_" + string_14_ + "_preferences" + string + "_wip.dat"; if (i != 12606) return null; String[] strings = { "c:/rscache/", "/rscache/", userHome, "c:/windows/", "c:/winnt/", "c:/", "/tmp/", "" }; for (int i_17_ = 0; strings.length > i_17_; i_17_++) { String string_18_ = strings[i_17_]; if ((string_18_.length() ^ 0xffffffff) >= -1 || new File(string_18_).exists()) { try { FileOnDisk class234 = new FileOnDisk(new File(string_18_, string_16_), "rw", 10000L); return class234; } catch (Exception exception) { /* empty */ } } } return null; }
5b8fd0e5-6c40-448c-8f74-282c8a9c7a75
0
public void makeActive() { this.setBackground(this.BACKGROUND_ACTIVE); }
8dca0283-753a-4ad0-b662-b63385fd8ab0
8
private void intelligenceMode() { int count = 0; gameMode = "Intelligence Mode"; System.out.println("----------- INTELLIGENCE MODE -----------"); System.out.println("Tip: Press \"Q\" for quit Game"); while (true) { Coordinate scanPosition = this.inputPosition(); if (scanPosition.getX() != -1 && scanPosition.getY() != -1) { // Open the radar and scanning the center with scan radius 1 String bombardSuggestion = this.radar(scanPosition); String[] detectPosition = bombardSuggestion.split("\\|"); int x = 0; int y = 0; boolean isDropBomb; if (detectPosition.length == 1) { System.out.println("Radar does not detect any ships in this distric !"); System.out.println(); } else { System.out.println("Radar detects ships in this distric as follow coordinate !"); System.out.println(bombardSuggestion); for (int i = 1; i < detectPosition.length; i++) { String[] bombPosition = detectPosition[i].split(","); x = Integer.parseInt(bombPosition[0]); y = Integer.parseInt(bombPosition[1]); if (sea.bomb[x + y * sea.getWidth()].getValue().equals(".")) { isDropBomb = sea.dropBomb(x, y); count++; this.showInfo(count, isDropBomb, x, y); } } this.printBombField(); } if (this.sea.allShipsSunk()) { System.out.println("All ships are sunk ! Good game!"); System.out.println("A output Text file is builded !"); this.outputResultTxt(); break; } } else { if (this.sea.allShipsSunk()) { System.out.println("All ships are sunk ! Good game!"); System.out.println("A output Text file is builded !"); this.outputResultTxt(); break; } System.out.println("Game Over !!!"); System.out.println("A output Text file is builded !"); this.outputResultTxt(); break; } } }
f94a6c99-d95c-433f-93db-0860ec220d07
4
public void parse() { if (Compiler.verbose()) System.out.println("Scanning..."); lexer.scann(text); if (Compiler.verbose()) { while (lexer.hasNext()) System.out.println(lexer.nextToken().getToken() + ", "); lexer.reset(); } if (Compiler.verbose()) System.out.println("Parsing..."); /* Vector<Construct> top = new Vector<Construct>(); try { while (lexer.hasNext()) { Construct c = readNext(); top.add(c); } } catch (SyntaxError e) { e.printStackTrace(); } System.out.println(top); */ }
634ba571-7478-4dc5-b7ac-a4b8ad43bf03
0
public int getRank() { return myRank; }
82a53dd9-62d1-4c0e-97ec-5f27e0fb2fd4
3
private int readBytes(byte[] b, int offs, int len) throws BitstreamException { int totalBytesRead = 0; try { while (len > 0) { int bytesread = source.read(b, offs, len); if (bytesread == -1) { break; } totalBytesRead += bytesread; offs += bytesread; len -= bytesread; } } catch (IOException ex) { throw newBitstreamException(STREAM_ERROR, ex); } return totalBytesRead; }
5cc8dfb5-f4f7-48f1-8f43-0698ffab41d6
9
public int ladderLength1(String start, String end, HashSet<String> dict) { HashSet<String> visited = new HashSet<String>(); LinkedList<String> queue = new LinkedList<String>(); HashSet<String> termi = new HashSet<String>(); for(String str : dict){ if(diffInOne(str, end)) termi.add(str); } int level = 1; queue.offer(start); queue.offer(null); while(!queue.isEmpty()){ String cur = queue.poll(); if(cur == null){ ++level; if(queue.isEmpty()) break; cur = queue.poll(); queue.offer(null); } for(String w : dict){ if(visited.contains(w)) continue; if(diffInOne(cur, w)) { if(termi.contains(w)) return level+2; queue.offer(w); visited.add(w); } } } return 0; }
e97cc513-d1c5-450f-a6b4-06301354666b
5
public static void main(String[] args) { // TODO code application logic here Scanner entrada = new Scanner(System.in); String Cadena1=""; Cadena1=JOptionPane.showInputDialog("Ingrese Frase"); Cadena1=" "+ Cadena1 +" "; int longitud = Cadena1.length(); char[] frase1 =Cadena1.toCharArray(); int ac=0; for (int i = 0; i< Cadena1.length() ; i++) { if (frase1[i]=='A'||frase1[i]=='a') { ac=ac+1; for (int j = i; j < Cadena1.length(); j++) { if (frase1[j]==' ') { i=j; j=Cadena1.length(); } } } } System.out.println(""+Cadena1); System.out.println("hay "+ ac + " palabras con A"); }
a2e71a20-8429-4fd0-9842-649bb069b9ec
0
public void mouseReleased(MouseEvent arg0) {}
440b7808-8345-4baf-80a8-c7bd38c50b85
4
public boolean triggerShimmyOut(){ if( ! hideTimer.isRunning() && isShimmyVisible() && !menu.isMenuItemOpen() && !menu.isLock()){ hideTimer.start(); mmMenuBar.reposition(0,0); mmMenuBar.rescale(Gui.getContentPane().getWidth(), 10); return true; } else return false; }
cabfa7ff-2953-4df2-b0a1-eee1be4758f5
4
public WorldModelImpl(int width, int height, double bombPercentage, boolean isThorique, GameDifficulty gd) throws WidthException, HeightException, BombPercentageException { if (bombPercentage < 100) { this.bombPercentage = bombPercentage; } else { throw new BombPercentageException(); } if (width < 1) { throw new WidthException(width); } else { this.width = width; } if (height < 1) { throw new HeightException(height); } else { this.height = height; } this.views = new LinkedList<>(); this.gameboard = new ArrayList(width * height); this.bombNumber = (int) Math.floor(height * width * bombPercentage / 100); if (this.bombNumber == 0) { this.bombNumber++; } this.thorique = isThorique; this.message = "Remaining mines : " + this.bombNumber; this.gd = gd; this.initGameboard(); }
1042a471-a777-418c-90ef-8d25c3270a3b
2
public static AccessibilityEnumeration fromValue(String v) { for (AccessibilityEnumeration c: AccessibilityEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
2c3ccbcb-f9c0-4ef3-97a8-e2d819c53821
8
public SearchCondition build_search_condition() { SearchCondition cond = new SearchCondition(); if (this.m.get("city") != null) { cond.setCity((String)m.get("city")); } if (this.m.get("country") != null) { cond.setCountry((String)m.get("country")); } if (this.m.get("room_type") != null) { cond.setRoom_type((String) m.get("room_type")); } if (this.m.get("price_max") != null) { cond.setPrice_max(Integer.valueOf((String)m.get("price_max"))); } if (this.m.get("numrooms") != null) { cond.setNumrooms(Integer.valueOf((String)m.get("numrooms"))); } if (this.m.get("distance_to_center") != null) { cond.setDistance_to_center(Float.valueOf((String)m.get("distance_to_center")).intValue()); } if (this.m.get("date_start")!= null) { cond.setDate_start(java.sql.Date.valueOf((String)m.get("date_start"))); } if (this.m.get("date_stop")!= null) { cond.setDate_stop(java.sql.Date.valueOf((String)m.get("date_stop"))); } return cond; }
50dd42fb-20c1-4203-b119-422bbd4cf527
4
public static boolean isNumeric(String s){ if(s==null) return false; if(s.contains("E")){ String mantissa = s.substring(0, s.indexOf("E")); String power = s.substring(s.indexOf("E")+1); return isNumeric(mantissa) && isNumeric(power); } if (s.matches("((-|\\+)?[0-9]+(\\.[0-9]+)?)+")) return true; return false; }
407a1f27-ca07-43a0-bd2d-08aa2b4b7e37
7
private void fillActionComboBox() { actionComboBox.removeAllItems(); Object o = modelComboBox.getSelectedItem(); if (o instanceof BasicModel) { BasicModel model = (BasicModel) o; Map changeMap = model.getChanges(); if (changeMap != null) { synchronized (changeMap) { for (Object x : changeMap.values()) { actionComboBox.addItem(x); } } Object scriptAction = getScriptAction(changeMap); if (scriptAction != null) { actionComboBox.setSelectedItem(scriptAction); } ChangeListener[] listeners = pageSpinner.spinner.getChangeListeners(); if (listeners.length > 1) { for (ChangeListener cl : listeners) { if (!(cl instanceof JSpinner.DefaultEditor)) { actionComboBox.setSelectedItem(cl); } } } else { AbstractChange c = (AbstractChange) actionComboBox.getSelectedItem(); minField.setValue(c.getMinimum()); maxField.setValue(c.getMaximum()); valueField.setValue(c.getValue()); stepField.setValue(c.getStepSize()); pageSpinner.removeChangeListeners(); pageSpinner.setMinimum(c.getMinimum()); pageSpinner.setMaximum(c.getMaximum()); pageSpinner.setStepSize(c.getStepSize()); pageSpinner.setValue(c.getValue()); } } } }
d523dd54-1909-4e85-be9f-3e5662cc6617
6
private boolean validateXML(Document dom) { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = null; for (int i = 0; i < schemaLocations.length; i++) { try { schema = factory.newSchema(schemaLocations[i]); } catch (Exception e) { if (i < schemaLocations.length - 1) { continue; } else { logger.error("... validation failed. Could not open the schema definitions.", e); return false; } } } try { Validator validator = schema.newValidator(); validator.validate(new DOMSource(dom)); } catch (SAXException se) { logger.error("... validation failed! ", se); return false; } catch (IOException ioe) { logger.error("... validation failed! ", ioe); return false; } catch (Exception e) { logger.error("... validation failed! ", e); return false; } return true; }
2184318b-5df4-43b1-a528-8516628fa05b
1
public List<String[]> solveNQueens(int n) { String []board= new String[n]; char[] init = new char[n]; Arrays.fill(init,'.'); for (int i =0; i < n ;i++ ) { board[i]= new String(init,0,n); } nextQueens(board,0,n); return list; }
102bc467-2eb2-44c7-948a-c7a33465323f
8
private TreeNode initTree() { DefaultMutableTreeNode tmodel = new DefaultMutableTreeNode("Thème"); try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); } catch (ClassNotFoundException ex) { JOptionPane.showMessageDialog(this, "Driver" + ex.getMessage(), null, JOptionPane.ERROR_MESSAGE); return tmodel; } Connection connexion = null; try { connexion = DriverManager.getConnection(sqlConnexion); } catch (SQLException ex) { JOptionPane.showMessageDialog(null, "Erreur connexion !!" + ex.getMessage(), null, JOptionPane.ERROR_MESSAGE); return tmodel; } try { String query = "SELECT theme.id_theme, theme_nom, id_soustheme, soustheme_nom " + "FROM theme " + "LEFT JOIN soustheme on theme.id_theme=soustheme.id_theme " + "ORDER BY theme_nom, soustheme_nom "; Statement stmt = connexion.createStatement(); ResultSet rs = stmt.executeQuery(query); DefaultMutableTreeNode tnTheme = null; DefaultMutableTreeNode tnSousTheme = null; String lastTheme = ""; String lastSousTheme = ""; while (rs.next()) { Theme th = new Theme(); th.setTheme(rs.getString("theme_nom")); th.setId_theme(rs.getInt("id_theme")); if (!lastTheme.equalsIgnoreCase(rs.getString("theme_nom"))) { lastTheme = rs.getString("theme_nom"); tnTheme = new DefaultMutableTreeNode(th); tmodel.add(tnTheme); } if (rs.getInt("id_soustheme")!= 0) { SousTheme sTh = new SousTheme(); sTh.setSousTheme(rs.getString("soustheme_nom")); sTh.setIdSousTheme(rs.getInt("id_soustheme")); if (!lastSousTheme.equalsIgnoreCase(rs.getString("soustheme_nom"))) { lastSousTheme = rs.getString("soustheme_nom"); tnSousTheme = new DefaultMutableTreeNode(sTh); tnTheme.add(tnSousTheme); } } } rs.close(); stmt.close(); } catch (SQLException ex) { JOptionPane.showMessageDialog(this, "Erreur SQL" + ex.getMessage(), null, JOptionPane.ERROR_MESSAGE); return tmodel; } try { connexion.close(); } catch (SQLException ex) { JOptionPane.showMessageDialog(this, "Erreur fermeture" + ex.getMessage(), null, JOptionPane.ERROR_MESSAGE); return tmodel; } return tmodel; }
19fa8f41-4433-485d-8b11-dd29df7acb84
3
PetiRound valueOf(RoundingMethod roundingMethod) { switch (roundingMethod) { case DOWN: return PetiRound.DOWN; case UP: return PetiRound.UP; case HALF_UP: return PetiRound.HALF_UP; default: throw new IllegalArgumentException("Unexpected roundingMethod: " + roundingMethod); } }
106a91f5-550b-4d40-967f-9b4475889521
4
public boolean TableExists(Connection conn, String tname) { DatabaseMetaData md; ResultSet rs; try { md = conn.getMetaData(); } catch (SQLException e) { // This shouldn't really happen plugin.Warn("Unable to read DatabaseMetaData from DB connection!"); e.printStackTrace(); return false; } try { plugin.Debug("Getting list of database tables"); rs = md.getTables(null, null, tname, null); } catch (SQLException e) { // This shouldn't really happen plugin.Warn("Unable to getTables from DatabaseMetaData!"); e.printStackTrace(); return false; } try { if (rs.next()) { // Table exists return true; } } catch (SQLException e) { // This shouldn't really happen plugin.Warn("Unable to iterate table resultSet!"); e.printStackTrace(); } return false; }
531f52aa-866b-4215-97b3-344af8907133
0
public void start(int interval, final boolean beep) { class TimePrinter implements ActionListener { public void actionPerformed(ActionEvent event) { Date now = new Date(); System.out.println("At the tone, the time is " + now); if (beep) Toolkit.getDefaultToolkit().beep(); } } ActionListener listener = new TimePrinter(); Timer t = new Timer(interval, listener); t.start(); }
454f3516-d14b-47c6-86b6-af6bd564d678
7
public static void OBRADI_odnosni_izraz(boolean staviNaStog){ String linija = mParser.ParsirajNovuLiniju(); int trenLabela = mBrojacLabela++; if (linija.equals("<aditivni_izraz>")){ OBRADI_aditivni_izraz(staviNaStog); return; } if (linija.equals("<odnosni_izraz>")){ OBRADI_odnosni_izraz(true); linija = mParser.ParsirajNovuLiniju(); // ucitaj (OP_LT | OP_GT | OP_LTE | OP_GTE) UniformniZnak uz_operator = UniformniZnak.SigurnoStvaranje(linija); linija = mParser.ParsirajNovuLiniju(); // ucitaj <aditivni_izraz> OBRADI_aditivni_izraz(true); mIspisivac.DodajKod("POP R1", "odnosni izraz " + uz_operator.mLeksickaJedinka + ": pocetak"); mIspisivac.DodajKod("POP R0"); if (uz_operator.mNaziv.equals("OP_LT")){ mIspisivac.DodajKod("CMP R0, R1", "usporedba"); mIspisivac.DodajKod("JR_SLT OI_ISTINA_" + trenLabela, "skoci na OI_ISTINA_ ako je R0 manji"); }else if (uz_operator.mNaziv.equals("OP_GT")){ mIspisivac.DodajKod("CMP R0, R1", "usporedba"); mIspisivac.DodajKod("JR_SGT OI_ISTINA_" + trenLabela, "skoci na OI_ISTINA_ ako je R0 veci"); }else if (uz_operator.mNaziv.equals("OP_LTE")){ mIspisivac.DodajKod("CMP R0, R1", "usporedba"); mIspisivac.DodajKod("JR_SLE OI_ISTINA_" + trenLabela, "skoci na OI_ISTINA_ ako je R0 manji ili jednak"); }else if (uz_operator.mNaziv.equals("OP_GTE")){ mIspisivac.DodajKod("CMP R0, R1", "usporedba"); mIspisivac.DodajKod("JR_SGE OI_ISTINA_" + trenLabela, "skoci na OI_ISTINA_ ako je R0 veci ili jednak"); } mIspisivac.DodajKod("MOVE %D 0, R0", "izraz nije istinit"); mIspisivac.DodajKod("JR OI_DALJE_" + trenLabela, "preskoci postavljanje R0 u 1"); mIspisivac.PostaviSljedecuLabelu("OI_ISTINA_" + trenLabela); mIspisivac.DodajKod("MOVE %D 1, R0", "izraz je istinit"); mIspisivac.PostaviSljedecuLabelu("OI_DALJE_" + trenLabela); // makni 2 sa stoga i stavi novi ako je potrebno NaredbenaStrukturaPrograma_G.mStog.remove(NaredbenaStrukturaPrograma_G.mStog.size()-1); NaredbenaStrukturaPrograma_G.mStog.remove(NaredbenaStrukturaPrograma_G.mStog.size()-1); if (staviNaStog){ mIspisivac.DodajKod("PUSH R0", "odnosni izraz: postavi rezultat na stog"); Ime_Velicina_Adresa novi = new Ime_Velicina_Adresa(); novi.mIme = null; novi.mAdresa = false; novi.mVelicina = 4; NaredbenaStrukturaPrograma_G.mStog.add(novi); } return; } }
c615a081-e0f2-407d-9a84-70a1a2969044
2
private void sendIncorrectMessage(Player p, boolean hasPermission, boolean invalidArgs) { if (!hasPermission) plugin.tell(p, "You do not have permission to use this command."); if (!invalidArgs) plugin.tell(p, "Invalid arguments. Use &e/hunger help&r for a list of commands."); }
c21032aa-6a4d-4304-a023-e4a195e3f881
6
private void dfs(TreeNode node, int level) { if(node.left == null && node.right == null) { minDepth = level < minDepth ? level : minDepth; return; } if(level > minDepth) return; if(null != node.left) { dfs(node.left, level + 1); } if(null != node.right) { dfs(node.right, level + 1); } }
82a07012-5128-4a67-9cf4-018011aff7fc
9
public static boolean validadePlaca(String placa) throws PlacaInvalidaException{ PlacaInvalidaException a = new PlacaInvalidaException(); //checar tamanho if(placa.length()!=8){ throw a; //checando se h� numeros onde deve haver n�meros }else{ for(int i = 0; i <placa.length(); i++){ if(i>=4){ if(placa.charAt(i)>=48 && placa.charAt(i)<=57){ return true; }else{ throw a; } } //checando se h� letras onde deve haver letras if(i<=2){ if(placa.charAt(i)>=65 && placa.charAt(i)<=90){ return true; }else{ throw a; } } } //checando se o hifen est� na posicao correta String exemploPlaca = "AAA-0000"; int c = exemploPlaca.charAt(3); if(c == 45){ return true; }else{ throw a; } } }
aef3c18f-85d1-4f3f-993b-e3796393fd6a
6
@Override public void execute(Stack<Double> st, String userInput, Map<String, Double> def) { String[] mas = userInput.split(" "); try{ double pushValue = 0.0; boolean flag = false; // check the presence of parameter in def and, if found, define pushValue if (!def.isEmpty()){ for (String str: def.keySet()){ if (str.equals(mas[1])){ pushValue = def.get(str); flag = true; } } } if (flag){ st.push(pushValue); }else { st.push(new Double(mas[1]) ); } }catch (NumberFormatException e ){ throw new NumberFormatException("The parameter \""+mas[1]+"\" is not defined" ); }catch (ArrayIndexOutOfBoundsException e){ throw new ArrayIndexOutOfBoundsException("Number of arguments of PUSH command is wrong"); } }
3fe94023-6121-4f16-b235-ad94f25cdfd6
5
Class18(OpenGlToolkit var_ha_Sub2) { anInt286 = 1; aClass262_292 = new Deque(); aBoolean293 = true; aClass258_Sub3Array295 = new Class258_Sub3[2]; aBoolean297 = true; aBoolean294 = true; aBoolean299 = true; anInt302 = 0; anInt301 = -1; aBoolean303 = false; aHa_Sub2_290 = var_ha_Sub2; if (((OpenGlToolkit) aHa_Sub2_290).aBoolean7820 && ((OpenGlToolkit) aHa_Sub2_290).aBoolean7837) { aClass206_284 = aClass206_281 = new Class206(aHa_Sub2_290); if (((OpenGlToolkit) aHa_Sub2_290).anInt7713 > 1 && ((OpenGlToolkit) aHa_Sub2_290).aBoolean7815 && ((OpenGlToolkit) aHa_Sub2_290).aBoolean7807) aClass206_284 = aClass206_285 = new Class206(aHa_Sub2_290); } }
089e6618-19fe-4397-891f-39484f085deb
9
private boolean sendPacket() { boolean var1 = false; try { Packet var2; Object var3; int var10001; int[] var10000; if (!this.dataPackets.isEmpty() && (this.chunkDataSendCounter == 0 || System.currentTimeMillis() - ((Packet)this.dataPackets.get(0)).creationTimeMillis >= (long)this.chunkDataSendCounter)) { var3 = this.sendQueueLock; synchronized (this.sendQueueLock) { var2 = (Packet)this.dataPackets.remove(0); this.sendQueueByteLength -= var2.getPacketSize() + 1; } Packet.writePacket(var2, this.socketOutputStream); var10000 = field_28144_e; var10001 = var2.getPacketId(); var10000[var10001] += var2.getPacketSize() + 1; var1 = true; } if (this.field_20100_w-- <= 0 && !this.chunkDataPackets.isEmpty() && (this.chunkDataSendCounter == 0 || System.currentTimeMillis() - ((Packet)this.chunkDataPackets.get(0)).creationTimeMillis >= (long)this.chunkDataSendCounter)) { var3 = this.sendQueueLock; synchronized (this.sendQueueLock) { var2 = (Packet)this.chunkDataPackets.remove(0); this.sendQueueByteLength -= var2.getPacketSize() + 1; } Packet.writePacket(var2, this.socketOutputStream); var10000 = field_28144_e; var10001 = var2.getPacketId(); var10000[var10001] += var2.getPacketSize() + 1; this.field_20100_w = 0; var1 = true; } return var1; } catch (Exception var8) { if (!this.isTerminating) { this.onNetworkError(var8); } return false; } }
65ff8c06-838c-4a17-b022-771b5e01d419
6
private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < jj_2_rtns.length; i++) { JJCalls c = jj_2_rtns[i]; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } return token; } token = oldToken; jj_kind = kind; throw generateParseException(); }
1ea94dd7-14e4-43b9-876c-4cef6fc48088
3
@Override public void validate() { if (newrt == null) { addActionError("Please Enter New Rate"); } if (cfrt == null) { addActionError("Please Enter Confirm New Rate"); } else if (!cfrt.equals(newrt)) { addActionError("New Rate & Confirm New Rate Mismatch Please Enter Again"); } }
624f43ea-570b-4c1e-a30e-c1a182b3fdf8
0
@After public void tearDown() { }
8071203f-4c45-47ed-b3a9-55a03f70ab06
8
public int lengthOfLongestSubstring(String s) { int rstart = 0; int rend = 0; int mstart = 0; int mend = 0; if (s == null) return 0; if (s.length() == 0) return 0; if (s.length() == 1) return 1; for (int start = 0; start < s.length() - 1; start++) { rstart = start; java.util.HashSet<String> sub = new java.util.HashSet<String>(); sub.add(String.valueOf(s.charAt(start))); for (int end = start+1; end < s.length(); end++) { if (!sub.contains(String.valueOf(s.charAt(end)))) { sub.add(String.valueOf(s.charAt(end))); if (end == s.length() - 1) { rend = end; } } else { rend = end - 1; break; } } if ((rend - rstart) >= (mend - mstart)) { mend = rend; mstart = rstart; } } return (mend - mstart + 1); }
d8b99c17-69f9-4c47-b9a9-e9918177a4b8
2
public static void main(String[] args) { /** * Created 2 threads, and assign tasks (Processor(i).run) to the threads */ ExecutorService executor = Executors.newFixedThreadPool(2);//2 Threads for (int i = 0; i < 2; i++) { // call the (Processor(i).run) 2 times with 2 threads executor.submit(new Processor(i)); } executor.shutdown(); System.out.println("All tasks submitted."); try { executor.awaitTermination(1, TimeUnit.DAYS); } catch (InterruptedException ignored) { } System.out.println("All tasks completed."); }
7bacce45-ec09-45d9-8ab0-1092efbf9e0d
1
public void dispose() { if (program != 0) { disposeShaders(); GL20.glDeleteProgram(program); program = 0; } }
71625c24-df51-4f65-8127-9f0cb3624a36
7
@EventHandler public void SkeletonHarm(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.getZombieConfig().getDouble("Skeleton.Harm.DodgeChance") / 100; final double ChanceOfHappening = random.nextDouble(); if (ChanceOfHappening >= randomChance) { dodged = true; } if (damager instanceof Arrow) { Arrow a = (Arrow) event.getDamager(); LivingEntity shooter = a.getShooter(); if (plugin.getSkeletonConfig().getBoolean("Skeleton.Harm.Enabled", true) && shooter instanceof Skeleton && e instanceof Player && plugin.getConfig().getStringList("Worlds").contains(world) && !dodged) { Player player = (Player) e; player.addPotionEffect(new PotionEffect(PotionEffectType.HARM, plugin.getSkeletonConfig().getInt("Skeleton.Harm.Time"), plugin.getSkeletonConfig().getInt("Skeleton.Harm.Power"))); } } }
a381fbfe-6acd-4a67-8ff7-5109944e1016
2
public ArrayList<SignatureFile> getSelectedFiles() { ArrayList<SignatureFile> list = new ArrayList<SignatureFile>(); for (int i = 0; i < user.getFiles().size(); i++) { if (this.isSelected(i)) { list.add(user.getFiles().get(i)); } } return list; }
bb9679b4-fec1-4ada-86a5-d1399bb88a32
9
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); Point[] horizontal = new Point[n]; Point[] vertical = new Point[n]; HashSet<Long> set = new HashSet<Long>(); for(int i=0; i<n; i++){ st = new StringTokenizer(br.readLine()); int x = Integer.parseInt(st.nextToken()); int y = Integer.parseInt(st.nextToken()); horizontal[i] = new Point(x,y); vertical[i] = new Point(x,y); set.add((long)x*100001+y); } Arrays.sort(horizontal, new yxComparator()); Arrays.sort(vertical, new xyComparator()); int result=0; for(int i=0; i<n; i++){ int u = Arrays.binarySearch(vertical, horizontal[i], new xyComparator()); int j=i+1; int v=u+1; while(j<n && v<n && horizontal[j].y==horizontal[i].y && vertical[v].x==vertical[u].x){ if(horizontal[j].x-horizontal[i].x == vertical[v].y-vertical[u].y){ if(set.contains((long)horizontal[j].x*100001+vertical[v].y)) result++; j++; v++; } else if(horizontal[j].x-horizontal[i].x > vertical[v].y-vertical[u].y){ v++; } else{ j++; } } } System.out.println(result); }
f3e795a8-63d7-4411-8daa-e9963f678dcd
5
private boolean setPlus(int cardNumber, int playerNumber) throws ContradictionException { if (table[cardNumber][playerNumber] == Resolution.Minus) { Card card = cardSet.cards.get(cardNumber); String player = getCompartments().get(playerNumber); throw new ContradictionException("Card : " + card + ", Player : " + player + ". Expected Unknown or Plus, " + "encountered Minus."); } boolean tableModified = false; if (table[cardNumber][playerNumber] == Resolution.Unknown) { tableModified = true; } table[cardNumber][playerNumber] = Resolution.Plus; for (int i = 0; i < table[cardNumber].length; ++i) { if (i != playerNumber) { boolean setMinusValue = setMinus(cardNumber, i); tableModified = tableModified || setMinusValue; } } return tableModified; }
e65ba9ae-7177-4f93-bef3-b27d6701e943
7
private String convertProduct(Product product) { StringBuffer result = new StringBuffer(); //First the uriref for the subject String subjectURIREF = product.toString(); //rdf:type result.append(createTriple( subjectURIREF, createURIref(RDF.type), createURIref(BSBM.Product))); //rdfs:label result.append(createTriple( subjectURIREF, createURIref(RDFS.label), createLiteral(product.getLabel()))); //rdfs:comment result.append(createTriple( subjectURIREF, createURIref(RDFS.comment), createLiteral(product.getComment()))); //bsbm:productType if(forwardChaining) { ProductType pt = product.getProductType(); while(pt!=null) { result.append(createTriple( subjectURIREF, createURIref(RDF.type), pt.toString())); pt = pt.getParent(); } } else { result.append(createTriple( subjectURIREF, createURIref(RDF.type), product.getProductType().toString())); } //bsbm:producer result.append(createTriple( subjectURIREF, createURIref(BSBM.producer), Producer.getURIref(product.getProducer()))); //bsbm:productPropertyNumeric Integer[] ppn = product.getProductPropertyNumeric(); for(int i=0,j=1;i<ppn.length;i++,j++) { Integer value = ppn[i]; if(value!=null) result.append(createTriple( subjectURIREF, createURIref(BSBM.getProductPropertyNumeric(j)), createDataTypeLiteral(value.toString(), createURIref(XSD.Integer)))); } //bsbm:productPropertyTextual String[] ppt = product.getProductPropertyTextual(); for(int i=0,j=1;i<ppt.length;i++,j++) { String value = ppt[i]; if(value!=null) result.append(createTriple( subjectURIREF, createURIref(BSBM.getProductPropertyTextual(j)), createDataTypeLiteral(value, createURIref(XSD.String)))); } //bsbm:productFeature Iterator<Integer> pf = product.getFeatures().iterator(); while(pf.hasNext()) { Integer value = pf.next(); result.append(createTriple( subjectURIREF, createURIref(BSBM.productFeature), ProductFeature.getURIref(value))); } //dc:publisher result.append(createTriple( subjectURIREF, createURIref(DC.publisher), Producer.getURIref(product.getProducer()))); //dc:date GregorianCalendar date = new GregorianCalendar(); date.setTimeInMillis(product.getPublishDate()); String dateString = DateGenerator.formatDate(date); result.append(createTriple( subjectURIREF, createURIref(DC.date), createDataTypeLiteral(dateString, createURIref(XSD.Date)))); return result.toString(); }
ce52e38f-6757-425c-9f28-151a835a16a5
0
public void addCommand(Command command) { commands.put(command.getName(), command); }
5411e67f-ed00-4b9c-aba3-382e517a49d3
7
public void insert(Comparable c) { if (list.isEmpty()) { list.insertFront(c); return; } try { if (c.compareTo(list.front().item()) < 0) { list.insertFront(c); return; } if (c.compareTo(list.back().item()) > 0) { list.insertBack(c); return; } ListNode node = list.front(); while (node.isValidNode()) { int result; result = c.compareTo(node.item()); if (result == 0) return; if (result < 0) { node.insertBefore(c); return; } else node = node.next(); } } catch (InvalidNodeException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
f9fe9244-b052-4221-9dea-671251b4e3e3
9
public static void createFurnace(Player p){ createRecipesDirectory(); ItemStack in = null; //9, 10, 11, 18, 19, 20, 27, 28, 29 .. 17 in = (p.getInventory().getItem(29) != null) ? p.getInventory().getItem(29) : null; ItemStack out = (p.getInventory().getItem(17) != null) ? p.getInventory().getItem(17) : new ItemStack(Material.AIR, 1); FurnaceRecipe r = new FurnaceRecipe(out, out.getData()); if(in == null || out.getType() == Material.AIR){ p.sendMessage(ChatColor.RED + "Bad recipe contruction in inventory"); return; } String name = String.valueOf(getRecipes().size()); SerializableFurnaceRecipe r1 = new SerializableFurnaceRecipe(r); SerializedRecipe r2 = new SerializedRecipe(r1, name, false); regenerateRecipes(new CommandSender[] {p, RecipeCreator.instance.console}); if(recipeExists(r2)){ p.sendMessage(ChatColor.RED + "A recipe with that name or result already exists"); return; } try { ObjectHandler.write(r2, RecipeCreator.instance.getDataFolder() + File.separator + "recipes" + File.separator + name + ".rec"); } catch (IOException e) { e.printStackTrace(); } SerializedRecipe r3 = null; try { r3 = (SerializedRecipe)ObjectHandler.read(RecipeCreator.instance.getDataFolder() + File.separator + "recipes" + File.separator + name + ".rec"); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } RecipeCreator.instance.getServer().addRecipe(r3.getRecipe()); p.sendMessage(ChatColor.GREEN + "Furnace recipe '"+r3.getId()+"' created"); RecipeCreator.instance.console.sendMessage(ChatColor.GREEN + "Furnace recipe '"+r3.getId()+"' created"); }
f60a7fdc-efb5-4976-b8fa-79f82f354204
1
public Pass1(File source) { this.temp = new File(source.getName() + ".tmp"); // Create the temporary file this.tempLabel = new File(source.getName() + ".label.tmp"); lineNumber = 0; // Used to indicate what the line number of the file we are working on recursionCounter = 0; // Used to tell if we are in the middle of a recursive call (anything above 0 = recursion) whitespaceSymbols = Pattern.compile("(#|,)\\s(%|\\$)"); // Used to match a hash (#) or comma (,) followed by a whitespace and a percent/dollar sign (%/$) whitespace = Pattern.compile("\\s\\s", Pattern.CASE_INSENSITIVE); // Used to match any instance of two consecutive instances of whitespace; Allow unicode whitespace hexadecimal = Pattern.compile("([a-f]|[0-9])"); // Used to match a hexadecimal number directives = new String[] {"include", "includebin", "address", "byte", "word", // Listing of all directive commands "inesprg", "ineschr", "inesmir", "inesplc", "inesreg"}; mnemonics = new String[] {"adc", "and", "asl", "bcc", "bcs", "beq", "bit", "bmi", "bne", // listing of all 6502 mnemonics "bpl", "brk", "bvc", "bvs", "clc", "cld", "cli", "clv", "cmp", "cpx", "cpy", "dec", "dex", "dey", "eor", "inc", "inx", "iny", "jmp", "jsr", "lda", "ldx", "ldy", "lsr", "nop", "ora", "pha", "php", "pla", "plp", "rol", "ror", "rti", "rts", "sbc", "sec", "sed", "sei", "sta", "stx", "sty", "tax", "tay", "tsx", "txa", "txs", "tya"}; relativeMnemonic = new String[] {"bpl", "bmi", "bvc", "bvs", "bcc", "bcs", "bne", "beq"}; // Listing of all mnemonics that use relative addressing operandMap = new HashMap<String, boolean[]>(56); // Initialize the hash map w/ 56 entries // Accumulator - Immediate - Zero Page - Zero Page,x - Zero Page,y - Absolute - Absolute,X - Absolute,Y - Indirect - Indirect,X - Indirect,Y - Relative - Implied operandMap.put("adc", new boolean[]{false, true, true, true, false, true, true, true, false, true, true, false, false}); // Verified operandMap.put("and", new boolean[]{false, true, true, true, false, true, true, true, false, true, true, false, false}); // Verified operandMap.put("asl", new boolean[]{true, false, true, true, false, true, true, false, false, false, false, false, false}); // Verified operandMap.put("bcc", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, true, false}); // Verified operandMap.put("bcs", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, true, false}); // Verified operandMap.put("beq", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, true, false}); // Verified operandMap.put("bit", new boolean[]{false, false, true, false, false, true, false, false, false, false, false, false, false}); // Verified operandMap.put("bmi", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, true, false}); // Verified operandMap.put("bne", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, true, false}); // Verified operandMap.put("bpl", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, true, false}); // Verified operandMap.put("brk", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("bvc", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, true, false}); // Verified operandMap.put("bvs", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, true, false}); // Verified operandMap.put("clc", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("cld", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("cli", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("clv", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("cmp", new boolean[]{false, true, true, true, false, true, true, true, false, true, true, false, false}); // Verified operandMap.put("cpx", new boolean[]{false, true, true, false, false, true, false, false, false, false, false, false, false}); // Verified operandMap.put("cpy", new boolean[]{false, true, true, false, false, true, false, false, false, false, false, false, false}); // Verified operandMap.put("dec", new boolean[]{false, false, true, true, false, true, true, false, false, false, false, false, false}); // Verified operandMap.put("dex", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("dey", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("eor", new boolean[]{false, true, true, true, false, true, true, true, false, true, true, false, false}); // Verified operandMap.put("inc", new boolean[]{false, false, true, true, false, true, true, false, false, false, false, false, false}); // Verified operandMap.put("inx", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("iny", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("jmp", new boolean[]{false, false, false, false, false, true, false, false, true, false, false, false, false}); // Verified operandMap.put("jsr", new boolean[]{false, false, false, false, false, true, false, false, false, false, false, false, false}); // Verified operandMap.put("lda", new boolean[]{false, true, true, true, false, true, true, true, false, true, true, false, false}); // Verified operandMap.put("ldx", new boolean[]{false, true, true, false, true, true, false, true, false, false, false, false, false}); // Verified operandMap.put("ldy", new boolean[]{false, true, true, true, false, true, true, false, false, false, false, false, false}); // Verified operandMap.put("lsr", new boolean[]{true, false, true, true, false, true, true, false, false, false, false, false, false}); // Verified operandMap.put("nop", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("ora", new boolean[]{false, true, true, true, false, true, true, true, false, true, true, false, false}); // Verified operandMap.put("pha", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("php", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("pla", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("plp", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("rol", new boolean[]{true, false, true, true, false, true, true, false, false, false, false, false, false}); // Verified operandMap.put("ror", new boolean[]{true, false, true, true, false, true, true, false, false, false, false, false, false}); // Verified operandMap.put("rti", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("rts", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("sbc", new boolean[]{false, true, true, true, false, true, true, true, false, true, true, false, false}); // Verified operandMap.put("sec", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("sed", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("sei", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("sta", new boolean[]{false, true, true, true, false, true, true, true, false, true, true, false, false}); // Verified operandMap.put("stx", new boolean[]{false, false, true, false, true, true, false, false, false, false, false, false, false}); // Verified operandMap.put("sty", new boolean[]{false, false, true, true, false, true, false, false, false, false, false, false, false}); // Verified operandMap.put("tax", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("tay", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("tsx", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("txa", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("txs", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified operandMap.put("tya", new boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, true}); // Verified // Accumulator - Immediate - Zero Page - Zero Page,x - Zero Page,y - Absolute - Absolute,X - Absolute,Y - Indirect - Indirect,X - Indirect,Y - Relative iNES = new byte[16]; // Initialize the 16 byte iNES header array iNES[0] = (byte)0x4E; // 'N' iNES[1] = (byte)0x45; // 'E' iNES[2] = (byte)0x53; // 'S' iNES[3] = (byte)0x1A; // EOF Byte iNES[4] = (byte)0; // 8KB PRG Bank x 0 -- Default iNES[5] = (byte)0; // 8KB CHR Bank x 0 -- Default iNES[6] = (byte)0; // Horizontal Mirroring iNES[7] = (byte)0; // No 'PlayChoice' info iNES[8] = (byte)0; // 8KB PRG RAM -- Default 0 iNES[9] = (byte)0; // NTSC -- Default iNES[10] = (byte)0; // NTSC -- Default iNES[11] = (byte)0; // null iNES[12] = (byte)0; // null iNES[13] = (byte)0; // null iNES[14] = (byte)0; // null iNES[15] = (byte)0; // null try { out = new BufferedWriter(new FileWriter(temp)); // Used to write to the temp file outLabel = new BufferedWriter(new FileWriter(tempLabel)); // Used to write to the label temp file } catch (IOException e) { Error.fatalError(1); } // 1 -- Cannot write to designated file }
b3aa265c-09ae-4ec7-bc4c-9039e8f7d13d
7
public omaArrayList<Aim> getShortestRoute(Tile endPoint) { int distance = pathTable[endPoint.getRow()][endPoint.getCol()]; omaArrayList<Aim> path = new omaArrayList<Aim>(); Aim[] table = { Aim.NORTH, Aim.EAST, Aim.SOUTH, Aim.WEST }; Tile tile = endPoint; Tile newTile; while (distance > 0) { for (int i = 0; i < table.length; i++) { newTile = game.getTile(tile, table[i]); if (newTile.getRow() > -1 && newTile.getRow() < pathTable.length && newTile.getCol() > -1 && newTile.getCol() < pathTable[0].length) { if (pathTable[newTile.getRow()][newTile.getCol()] == (distance - 1)) { distance--; path.add(getOppositeDirection(table[i])); tile = newTile; } } } } return path; }
ad37cc0c-741d-4c30-aae3-7870109a1fd5
9
public void stringToBlockMap(String key){//Make it a 2D array instead of a long list int i = 0; if(key != null){ for(int z=0; z<depth; z++){ for(int y=0; y<height; y++){ for(int x=0; x<width; x++){ if(key.length() > i){ switch(key.charAt(i)){ case 'G': map[x][y][z] = (new BlockGrass(x*Utility.STANDARD_BLOCK_SIZE, y*Utility.STANDARD_BLOCK_SIZE, z)); System.out.println(" Grass Block created at ("+x*Utility.STANDARD_BLOCK_SIZE+","+y*Utility.STANDARD_BLOCK_SIZE+","+z+")"); break; case 'S': map[x][y][z] = (new BlockStone(x*Utility.STANDARD_BLOCK_SIZE, y*Utility.STANDARD_BLOCK_SIZE, z)); System.out.println(" Stone Block created at ("+x*Utility.STANDARD_BLOCK_SIZE+","+y*Utility.STANDARD_BLOCK_SIZE+","+z+")"); break; case 'D': map[x][y][z] = (new BlockDirt(x*Utility.STANDARD_BLOCK_SIZE, y*Utility.STANDARD_BLOCK_SIZE, z)); System.out.println(" Dirt Block created at ("+x*Utility.STANDARD_BLOCK_SIZE+","+y*Utility.STANDARD_BLOCK_SIZE+","+z+")"); break; case ' ': map[x][y][z] = (new BlockAir(x*Utility.STANDARD_BLOCK_SIZE, y*Utility.STANDARD_BLOCK_SIZE, z)); System.out.println(" Air Block created at ("+x*Utility.STANDARD_BLOCK_SIZE+","+y*Utility.STANDARD_BLOCK_SIZE+","+z+")"); break; default: map[x][y][z] = (new BlockVoid(x*Utility.STANDARD_BLOCK_SIZE, y*Utility.STANDARD_BLOCK_SIZE, z)); System.out.println("*****Invalid Block character: Void Block created at ("+x*Utility.STANDARD_BLOCK_SIZE+","+y*Utility.STANDARD_BLOCK_SIZE+","+z+")"); break; } i++; } else{ map[x][y][z] = (new BlockAir(x*Utility.STANDARD_BLOCK_SIZE, y*Utility.STANDARD_BLOCK_SIZE, z)); System.out.println("*****No value: Air Block created at ("+x*Utility.STANDARD_BLOCK_SIZE+","+ y*Utility.STANDARD_BLOCK_SIZE+","+z+")"); i++; } } } } } }
4d685405-1d16-488b-898b-21f65ba875d9
9
public static <F> DiscreteObjectChooser<F> estimate(FeatureExtractor<F> featureExtractor, List<List<F>> alternativeObjectss, int[] choices, int minFeatureCount, RegressionPrior prior, int priorBlockSize, AnnealingSchedule annealingSchedule, double minImprovement, int minEpochs, int maxEpochs, Reporter reporter) { if (reporter == null) reporter = Reporters.silent(); ObjectToCounterMap<String> featureCounter = new ObjectToCounterMap<String>(); for (List<F> alternativeObjects : alternativeObjectss) { for (F alternativeObject : alternativeObjects) { Map<String,? extends Number> featureMap = featureExtractor.features(alternativeObject); for (String feature : featureMap.keySet()) featureCounter.increment(feature); } } featureCounter.prune(minFeatureCount); MapSymbolTable featureSymbolTable = new MapSymbolTable(); for (String feature : featureCounter.keySet()) featureSymbolTable.getOrAddSymbol(feature); int numDimensions = featureSymbolTable.numSymbols(); Vector[][] alternativess = new Vector[alternativeObjectss.size()][]; for (int i = 0; i < alternativess.length; ++i) { List<F> alternativeObjects = alternativeObjectss.get(i); alternativess[i] = new Vector[alternativeObjects.size()]; for (int k = 0; k < alternativess[i].length; ++k) { Map<String,? extends Number> featureMap = featureExtractor.features(alternativeObjects.get(k)); alternativess[i][k] = Features.toVectorAddSymbols(featureMap,featureSymbolTable,numDimensions, ADD_INTERCEPT_FALSE); } } DiscreteChooser chooser = DiscreteChooser.estimate(alternativess, choices, prior, priorBlockSize, annealingSchedule, minImprovement, minEpochs, maxEpochs, reporter); return new DiscreteObjectChooser<F>(featureExtractor, featureSymbolTable, chooser); }
943e8fa7-a2b9-49bb-9be6-943082b92f64
4
@Override public Imagem aplica(Imagem imagem) { Imagem novaImagem = new Imagem(imagem.getWidth(), imagem.getHeight()); int metadeTamanho = (int) Math.floor((float)getTamanho() / 2); for(int x = metadeTamanho; x < imagem.getWidth() - metadeTamanho; x++) { for(int y = metadeTamanho; y < imagem.getHeight() - metadeTamanho; y++) { int[][] pixels = new int[getTamanho()][getTamanho()]; for(int x2 = 0; x2 < getTamanho(); x2++) { for(int y2 = 0; y2 < getTamanho(); y2++) { pixels[x2][y2] = imagem.getPixel(x + x2 - metadeTamanho, y + y2 - metadeTamanho); } } novaImagem.setPixel(x, y, Math.max(Math.min(calcula(pixels), 255), 0)); } } return novaImagem; }
be9defd3-354b-40d9-9751-432c94ed8f5a
5
protected void printWordTopicDistribution(_Doc d, File wordTopicDistributionFolder, int k) { _ParentDoc4DCM pDoc = (_ParentDoc4DCM) d; String wordTopicDistributionFile = pDoc.getName() + ".txt"; try { PrintWriter pw = new PrintWriter(new File( wordTopicDistributionFolder, wordTopicDistributionFile)); for (int i = 0; i < number_of_topics; i++) { MyPriorityQueue<_RankItem> fVector = new MyPriorityQueue<_RankItem>( k); for (int v = 0; v < vocabulary_size; v++) { String featureName = m_corpus.getFeature(v); double wordProb = pDoc.m_wordTopic_prob[i][v]; _RankItem ri = new _RankItem(featureName, wordProb); fVector.add(ri); } pw.format("Topic %d(%.5f):\t", i, pDoc.m_topics[i]); for (_RankItem it : fVector) pw.format("%s(%.5f)\t", it.m_name, m_logSpace ? Math.exp(it.m_value) : it.m_value); pw.write("\n"); } pw.flush(); pw.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } }
565ee27f-24aa-4340-92f3-1e48298387ed
1
public void request() { if (mState != null) { mState.handle(this); } }