method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
95cd9aae-31ea-49b3-818d-005fe0c159d8
9
@Override public void run() { super.run(); try { pushCookie(); } catch (IOException ex) { Logger.getLogger(SinaWeiboAutoLogin.class.getName()).log(Level.SEVERE, null, ex); } catch (JSONException ex) { Logger.getLogger(SinaWeiboAutoLogin.class.getNa...
073f0971-25d1-41f2-a5fc-43625729bfc5
7
private final void updateVideoExistence() { boolean exists = (this.videncode.getVideoFileSource() != null); this.videoSourceCheckbox.setEnabled(exists); this.videoSourceCheckbox.setSelected(exists); this.updateVideoEncodeButtonAndBitrate(); this.videoEncodingDurationRangeslider.setEnabled(exists); for (i...
68a1101c-23c3-4c22-9e2f-1815e55d2e02
0
public void setState(State state) { this.state = state; }
7e99f862-e958-42e5-bb4a-074dc6563af1
0
public Node getNode() { return this.node; }
3697a426-8e1a-4ebc-9504-ff1ccf41fa21
6
public void start(String hashPrefix) throws IOException, NoSuchAlgorithmException, InterruptedException { ArrayBlockingQueue<List<String>> in = new ArrayBlockingQueue<List<String>>(100); ArrayBlockingQueue<List<String>> out = new ArrayBlockingQueue<List<String>>(100); int threadNum = Runtime.g...
a6eb9384-4683-41d7-b1f4-3a57631f9c0f
6
private static List<String> validateSetter(Method m) { List<String> errors = new ArrayList<String>(); if (m.isAnnotationPresent(BusinessLogic.class)) errors.add("@BusinessLogic is not valid here"); if (m.isAnnotationPresent(Xml.class)) errors.add("@Xml is not valid here, use it on getter"); if (m.isAnnotatio...
63244b27-866a-4ec6-ba26-8559d37550d1
5
public static String kick(DataOutputStream out, PassthroughConnection ptc, KillableThread thread, String message) { if(Main.craftGUI != null) { Main.craftGUI.safeSetStatus(message); } if(ptc != null && (!ptc.sendingKickMessage())) { return null; } PacketFFKick kick = new PacketFFKick((byte)(0xF...
c0b370a8-d56a-4589-9d90-39587c48102d
8
public GroupInfo getGroupInfo(String groupId) throws IOException { ZookeeperUtils zkUtils = createZookeeperUtils(); ZkClient zkClient = null; GroupInfo info = new GroupInfo(groupId); try { zkClient = zkUtils.getZkClient(zkServers); List<Broker> brokers = zkUtils....
fce4ebad-6694-4a96-b6d4-dd42bde99ba4
5
public int[] getUtility( int [] utility,boolean isMax)//might be problem here { int [] result=new int [2]; int curr=utility[0]; if(isMax)//find the max value in utility { for(int i=1;i<utility.length;i++) { if(utility[i]>curr){ curr=utility[i]; result[1]=i; } } } else { for...
e05deef9-711e-4746-b42a-bbd2938477de
9
private void hbCreateDecodeTables(int[] limit, int[] base, int[] perm, char[] length, int minLen, int maxLen, int alphaSize) { int pp, i, j, vec; pp = 0; for (i = minLen; i <= maxLen; i++) { for (j = 0; j < ...
4e0f3285-5ccc-4e8b-a3c2-8a6845726d84
6
@EventHandler public void MagmaCubeSlow(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.getMagmaCubeConfig().getDouble("MagmaCube.S...
4c1a9aa0-c235-4277-a95a-e9e1efc07a8a
7
private String domNodeDescription (Node node, int tablevel) { String domNodeDescription = null; String nodeName = node.getNodeName (); String nodeValue = node.getNodeValue (); if (!(nodeName.equals ("#text") && nodeValue.replaceAll ("\n", "").trim ().equals (""))) { domNodeDescription = tabs (tablevel) + no...
6f319473-cd4e-40fd-bf62-ed4b655fa6c7
4
private void look(Command command) { if (!command.hasSecondWord()) { printLocationInfo(); return; } String secondWord = command.getSecondWord(); if (secondWord.equals("inventory")) { player.printInventory(); return; } ...
c332cf58-0d77-43a4-af60-7b795b97a456
5
public void setSetTEmodeGratingOrder(int[] order){ this.gratingOrderTE = order; int m = order.length; if(this.setMeasurementsTEgrating)if(m!=this.numberOfTEmeasurementsGrating)throw new IllegalArgumentException("Number of grating orders entered, " + m + ", is not equal to the number of measureme...
6d1586da-ab16-4d00-b620-10aeea2ae340
3
@Override public void startEffect(ThePeanutButterJellyGame game, Player player) { if (sound != null) sound.play(); for (Player p : game.getPlayers()) { if (p != player) { p.removeBricks(); } } }
bed53863-2ee5-41da-a0d1-78045b922106
1
public static List<String> decodificarQuery(String queryString) { List<String> resultado = new ArrayList<String>(); JSONParser parser = new JSONParser(); try { Object objQuery = parser.parse(queryString); JSONObject queryJSON = (JSONObject) objQuery; JSONObject query = (JSONObject) queryJSON.get(QUERY); ...
c79888af-c5eb-445f-acb3-3cb2690e6172
2
public void removeTurma(int numero){ for (Turma t: this.turmas){ if (t.getNumero() == numero){ this.turmas.remove(t); break; } } }
a8e45c17-c220-4eb5-80d4-9395f6547451
9
@Override public void downloadAllFiles() { Map<String, WikiResourceMeta> newFileMetaList = new HashMap<String, WikiResourceMeta>(alreadyDownloadMeta); try { Map<String, WikiResourceMeta> fileMetaList = getPageUrls(); for (Map.Entry<String, WikiResourceMeta> fileMeta : fileM...
55afe12e-261a-4a5e-98d9-b81adf4e6d6a
2
public void update(InputHandler inhandler){ if(timer.isReady()){ if(timeVar<5){ timeVar++; timer= new Timer(40); }else{ Level.entities.remove(this); } } }
2e6fd7f2-b8f1-4ae8-8497-5248a5d5587f
4
private static long trace(long n) { long length = 1; long temp = n; while (temp != 1) { length++; temp = (temp % 2 == 0) ? (temp / 2) : (3 * temp + 1); if (temp < n) { try { length += l.get(temp); } catch (Exception e) { System.out.println("tracing " + n + " can't find " + temp); } ...
a502543a-1bd5-46ac-b3ce-865af628e06f
5
private void showStudent(int index) { final Student student = this.students[index]; // remove all previous entries in the fields list this.fields.clear(); // Remove all previous Components from the panel this.studentInfoPanel.removeAll(); this.studentInfoPanel.setLayout(new BorderLayout()); /* na...
d992b016-19b5-472d-86d5-116ebe2dd412
7
public static void readRegularGrammarFromFile(Set<String> nonTerminals,Set<String> terminals,List productions,StringBuilder startSymbol) { try { FileInputStream fstream = new FileInputStream("C:\\Users\\fgheorghe\\Dropbox\\Compilatoare\\src\\Files\\2.regularGrammar.txt"); DataInputStrea...
372697b1-d244-4ad6-81d9-7f68f60a8610
9
@Override public float eval(IRList l) { if (l == null || l.getQuery() == null || l.getPertinence() == null) return -1; ArrayList<Integer> relevants = l.getQuery().relevants; ArrayList<Integer> pertinence = l.getPertinence(); int currentLevel = nbLevels, nRelevants = rele...
5b81291c-7386-48ba-8cd0-658c17605fab
0
private boolean canCalculate(String expression){ //todo: not implemented return true; }
70a284a3-494d-42f0-940d-3369dbd0e9ba
8
private void install() { final ProgressMonitor monitor = new ProgressMonitor(this, "Installing", null, 0, 1); monitor.setMillisToPopup(0); monitor.setMillisToDecideToPopup(0); final Installer installer = new Installer(new DialogInstallAdapter(this, "Installing") { @Override...
9eb3ba2d-4994-494e-bf03-ffe07bbd1f5e
7
@Override protected void read(InputBuffer b) throws IOException, ParsingException { time = Util.getInt(b.get(0, 4)); stream = Util.getInt(b.get(4, 4)); b = b.getSubBuffer(8); services = getMessageFactory().parseNodeServicesMessage(b); b = b.getSubBuffer(services.length()); byte[] ipBytes = b.get(0, 16); ...
67babae8-e499-4250-bec6-33e92f1c7433
3
public void disconnect() { try { if (stmt != null) { stmt.close(); } if (conn != null) { conn.close(); } gui.setdisconnected(); } catch (SQLException e) { gui.handleSQLException(e); } }
3d21a757-cb3a-4e66-8b30-61673fd07ecf
2
@Override public boolean equals(Object o){ if (!(o instanceof Sense)){ return false; } Sense s = (Sense)o; return this.name.equals(s.name) && this.value.equals(s.value); }
bf4ebd70-e32e-4be2-923d-376bde3f08e2
9
public JavaMethod getMethodFromSignature(String signature) { if (signature == null || signature.equals("") || !signature.startsWith("(")) { return null; } final int closingIndex = signature.lastIndexOf(')'); if (closingIndex <= 0 || closingIndex >= signature.length() - 1) {...
68d49302-5952-4d76-b77b-70f1730d6b9e
3
private static void getChannelEncoding(byte[] pixel1, byte[] pixel2, int[] channels) { for (int c=0; c<3; ++c) { channels[c] = 0; for (int b=0; b<8; ++b) { byte p1 = (byte) ((pixel1[c] >> b)&0x01); byte p2 = (byte) ((pixel2[c] >> b)&0x01); if (p1 != p2) channels[c]++; } } }
8d85db4b-b791-4df7-a400-f2aef2452f3c
6
@PostConstruct public void initRecommender() { try { // get the file which is part of the WAR as URL url = getClass().getClassLoader().getResource(DATA_FILE_NAME); // create a file out of the resource File data = new File(url.toURI()); // create a map for saving the preferences (likes) for...
657d6158-ba32-4825-8a22-ba73173e7d9b
4
private static ItemStack deserializeBasicSection(String s) { String[] d = s.split(","); ItemStack is = new ItemStack(0); for(int i=0;i<d.length;i++) { switch(i) { case 0: is.setTypeId(Integer.parseInt(d[i])); break; case 1: is.setDurability(Short.parseShort(d[i])); break; case 2: is.set...
9fe7ab2c-3760-441b-8839-512e06cf489b
7
private void takeCommand(String input, Player hero) { String amount = parseLastInput(input); //The last word in the string input Integer amtToTake = 1; //If the player enters "take hp pot all" it will take all of the hp pots in the room if (amount.equalsIgnoreCase("all")) { ...
17ae47b8-b525-4023-bbb0-58953e845a80
8
public void shrink() { int[] nmin = new int[min.length]; int[] nmax = new int[min.length]; for (int i = 0; i < min.length; i++) nmin[i] = nmax[i] = -1; for (MultiColor c : freqTable.keySet()) if (inside(c)) for ...
61663655-625e-453e-be7b-c90aac534b64
8
public static void DFS(int node, int used, int parent, String path) { if (path.length() == size) ans.add(path); else { Stack<Integer> change = new Stack<Integer>(); for (int i = 0; i < ady[node].size(); i++) { int neigh = ady[node].get(i); if (check(used, neigh)) { if (parents[neigh] == 1) ...
3d096f8a-8b79-4db4-aa66-3d0e5ce2012f
5
RollbackToken(final String fullName, final String userName, final String token) { if ((fullName == null) || (fullName.length() == 0)) throw new IllegalArgumentException("fullName may not be null or empty"); if ((userName == null) || (userName.length() == 0)) throw new IllegalArgumentException("userName ma...
3f8dfade-c7fd-42bf-a6f9-7879f491775b
7
private void verificaPK() { try { if (this.primaryKey == null || this.primaryKey.length == 0) { throw new Exception("Nome da coluna de ID não informado na classe " + this.subClasse.getSimpleName()); } /* * Verificando se o nome da primary key informada está em algum dos * atributos da classe ...
91c24ede-14e1-4bfe-8541-fe21bcdd54de
4
private Shape getShape() { if (cachedShape == null || lastX != this.getPosition().getX() || lastY != this.getPosition().getY() || lastRadius != this.getRadius()) { cachedShape = createNewShape(); lastX = this.getPosition().getX(); lastY = this.getP...
6e2c3fa4-14a6-4a43-b290-34e987cd51ef
0
public static void main(String[] args) { w = new Worker(); }
7150fc69-2b91-4396-8670-c710dac7391b
7
@EventHandler (priority = EventPriority.HIGH, ignoreCancelled = true) public void onItemFrameBreakEvent(EntityDamageByEntityEvent event) { if (event.getEntityType() != EntityType.ITEM_FRAME) { return; } final Player player; if (event.getDamager() instanceof Arrow) { ...
4314a1ff-2c98-499b-963a-6bc53234215f
7
public static Vector<String> parseSemicolons(String s, boolean ignoreNulls) { final Vector<String> V = new Vector<String>(); if ((s == null) || (s.length() == 0)) return V; int x = s.indexOf(';'); while (x >= 0) { final String s2 = s.substring(0, x).trim(); s = s.substring(x + 1).trim(); if ((!ig...
c4fa856f-5024-45b0-8c47-eb250ceb1ec6
0
@Test public void testGenerateRandomContestWorld() { System.out.println("generateRandomContestWorld"); World instance = new World(); instance.generateRandomContestWorld(); }
8f0af57b-6f5b-40f7-822e-1169e103d8bb
5
public static Results averageResults(ArrayList<Results> res) { Results outResults = res.get(0); for (int i = 1; i < res.size(); i++) { Results tempRes = res.get(i); for (int j = 0; j < tempRes.getResults().size(); j++) { for (int k = 0; k < outResults.getResults(...
50abebc3-058f-485c-8d65-b3046e95c0f2
4
public synchronized void gridletMove(int gridletId, int userId, int destId, boolean ack) { // cancel the Gridlet first ResGridlet rgl = cancel(gridletId, userId); // If no found then print an error msg if (rgl == null) { System.out.println(super.resName_ + ...
b2f8df92-c3ae-482c-85a5-ec15ff90c310
4
private boolean connectToVault() { boolean blnRet = false; PluginManager pm = getServer().getPluginManager(); Plugin plugin = pm.getPlugin(TGPConstants.VAULT); //Check if the plugin is initialized and enabled if (plugin != null && plugin.isEnabled()) { /...
1a95cd30-6ca8-4c35-a707-840f6759b2f6
3
public static Line getMasterOutputLine() { for (Mixer mixer : getMixers()) { for (Line line : getAvailableOutputLines(mixer)) { if (line.getLineInfo().toString().contains("Master")) return line; } } return null; }
04facd38-6a3a-4038-a78f-eef4a47d5a01
4
public Maasto Maasto(int i, int j){ if((i>maxKoko || i<0) || (j> maxKoko || j<0)){ return null; } return kartta[i][j].maasto(); }
8b14111c-a39a-4e3e-a1c0-eae70740224d
9
private void bubbleDown() { int index = 1; if (comp==null){ while (hasLeftChild(index)) { int smallerChild = index*2; if (hasRightChild(index) && ((Comparable) data[index*2]).compareTo(data[(index*2+1)]) > 0) { smallerChild = (ind...
55974d13-8f44-4937-a29f-fa5b53cbf7a9
6
private void read(DataInputStream in) throws IOException { int i, n; int magic = in.readInt(); if (magic != 0xCAFEBABE) throw new IOException("bad magic number: " + Integer.toHexString(magic)); minor = in.readUnsignedShort(); major = in.readUnsignedShort(); c...
9fc1e5cf-d685-48f5-a4df-98271f6fd5a0
6
public static byte[] encrypt(byte[] in,byte[] key){ Nb = 4; Nk = key.length/4; Nr = Nk + 6; int lenght=0; byte[] padding = new byte[1]; int i; lenght = 16 - in.length % 16; padding = new byte[lenght]; padding[0] = (byte) 0x80; for (i = 1; i < lenght; i++) padding[i] = 0; ...
539127a3-f311-4920-9942-3f73cfe8e8e1
3
private void parseDefs(String fileName, int numProvs) throws FileNotFoundException, IOException { final BufferedReader reader = new BufferedReader(new FileReader(fileName)); try { reader.readLine(); // eat first line for (int i = 1; i < numProvs; i++) { ...
e0d22870-37c9-4773-beaf-79c0703225c7
3
public Point getDownConnection(String conn) { int pos = 0; for (int i = 0; i <= outLables.length; i++) { if(i == outLables.length){ return null; } if(outLables[i].equals(conn)){ pos = i; break; } } ...
3c269ad2-6b15-4d6c-8d24-75b577d850a9
2
public String encrypt(String message) { try { MessageDigest md = MessageDigest.getInstance("MD5"); return hex (md.digest(message.getBytes("CP1252"))); } catch (NoSuchAlgorithmException e) { } catch (UnsupportedEncodingException e) { } return null; }
baa4448e-7cb9-480e-a1e3-7e8db7cd1e8d
1
public static void log(Level level, String message) { if (level.ordinal() >= CURRENT_LEVEL.ordinal()) { System.out.println(message); } }
3cbccbee-b8f8-435d-8db3-841882e1d1c7
2
@SuppressWarnings("unchecked") ArrayList new58() /* reduce ANonTerminal$Methoddecl */ { @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList(); @SuppressWarnings("unused") ArrayList nodeArrayList2 = pop(); @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop(); L...
7cd102b5-1420-47b5-b2d6-8040f0be9511
0
@Override public IRemoteCallObject getResponseRemoteCallObject() { return response; }
b4f24a45-561b-48f9-849f-28eb02816711
5
@Override public byte[] generate(World world, Random rand, int chunkx, int chunkz) { // max-boxel-size set to 0 will result in non-limited worlds if (maxBoxelSize != 0) { if (chunkx > maxBoxelSize / 2) return Arrays.copyOf(borderChunk, borderChunk.length); if (chunkz > maxBoxelSize / 2) return Arra...
1af782e7-2227-47f3-93b9-e5f59293210d
3
public static void clearPanel() { if (jTable_Inbox != null && jTable_Outbox != null && jTable8 != null) { ((OTInboxTableModel) jTable_Inbox.getModel()).clearValue(); ((OTOutboxTableModel) jTable_Outbox.getModel()).clearValue(); ((OTReceiptTableModel) jTable8.getModel()).clear...
4685e809-1664-463a-9078-0ed404adbcda
0
@Override public void paint(Graphics g, Point position) { }
d3982f0e-9cbf-4af9-ad55-df60d2d523a5
2
public static AlbumLogger getInstance() throws LogException { if(AlbumLogger.log == null) { synchronized (AlbumLogger.class) { if(AlbumLogger.log == null) { AlbumLogger.instance= new AlbumLogger(); } } } return AlbumLogger.instance; }
ab91b482-b612-45e9-9fc0-6ea9c0547f73
1
public void stopPoint(String name) { if (this.goalMap.containsKey(name)) { Calculator cal = (Calculator) this.goalMap.get(name); cal.setStopTime(Calendar.getInstance().getTimeInMillis()); } else { log.error("沒有==" + name + "==的進入點"); } }
e3999630-e99d-42f4-9e0c-2cbd031dcfea
2
public void tickServer() { update++; if (!isLoaded()) ticksExisted++; else if (update % PAIR_CHECK_INTERVAL == 0) validatePairings(); }
8a37e407-3b50-4f06-8bf6-80e22602ee22
8
public boolean setBothParameter(String value,String value2) { if(type[0]!=null) { try { if(type[0].equals("int")) { number[0]=Integer.parseInt(value); }else if(type[0].e...
7474bd0e-76b2-440f-be3f-33b0d47405bd
6
public void update(){ if(isDead() && Game.SECONDS >= respawnTimer){ if(canRespawn()){ respawn(); }else{ respawnTimer += 3; } } if(isDead() && loot.size() == 0 && visible){ visible = false; solid = false; } }
25ba0555-f6ee-46e4-a6a6-0f42c379ba24
5
public synchronized static BaseReader create(SourceSwitcher switcher) throws ReaderConfigException { BaseReader reader = null; Class<?> cluss = null; String name = switcher.toString(); try { createByConfig(name); if(name.equals("NotificationSystem")){ cluss = XOIReader.class; reader = (BaseReader...
71405821-5a9c-4749-9800-65b4b5edcf1c
7
public void scan(int posX, int posY, int Range){ radarCheck.clear(); for (int i = 0; i < ocean.submarines.size() ; i++){ CoordinatesServer point = new CoordinatesServer(posX, posY, ocean.submarines.get(i).depth); if ((ocean.submarines.get(i).posX <= (posX+Range) && ocean.submarin...
9b0a5ad1-8187-426b-a1cc-b2de45713f18
3
public static String ParseDisplayName(Player p) { PermissionManager manager = null; String displayNameFormat = "%prefix%player%suffix"; if(Bukkit.getServer().getPluginManager().isPluginEnabled("PermissionsEx")) manager = PermissionsEx.getPermissionManager(); if(Bukkit.getServer().get...
5a2bc435-a755-4aef-bd67-cb9a184a68da
4
private void cache(final long chunk, final Region region) { final long existing = this.references.put(region, this.references.get(region) + 1); if (existing == 0) this.catalog.registerOptions(region); Set<Region> loaded = this.cache.get(chunk); if (loaded == null) loaded = new HashSet<R...
a440afd4-38ab-40ee-86c8-91128fdf5b35
3
public static void main(String[]args) { if(args != null){ if(args.length>0){ username = args[0]; } if(args.length>1){ sessionId = args[1]; } } java.awt.EventQueue.invokeLater(new Runnable() { public void run() ...
8cd7c36e-5698-43f9-a684-712d4125d45f
3
public static List<Planet> interestingPlanets(PlanetWars pw){ List<Planet> asw = new ArrayList<Planet>(); for (Planet p : pw.NotMyPlanets()){ if (p.NumShips()<p.GrowthRate()*2) // We've got 2 turns before an eventual attack; that's why rentability is calculated that way asw.a...
0d8f666c-ca27-4c26-90af-e23ee555fb2d
3
public static void createFile() throws FileNotFoundException { Scanner in = new Scanner(System.in); System.out.println(">Enter your new file name:"); String fileName = in.nextLine() + ".txt"; boolean exist = false; String[] files = FileLister.getFilesArrayString(); for (int i = 0; i < files.length; i++) ...
928d422f-0325-4407-94b1-5a674406cccc
8
public String patch_addPadding(LinkedList<Patch> patches) { short paddingLength = this.Patch_Margin; String nullPadding = ""; for (short x = 1; x <= paddingLength; x++) { nullPadding += String.valueOf((char) x); } // Bump all the patches forward. for (Patch aPatch : patches) { aPatc...
9a4a2595-4e45-4691-b830-29c1995cc68b
1
public static void main(String[] args) { System.out.println("Введіть к-сть значень --> "); Scanner in = new Scanner (System.in); int kst = in.nextInt(); int fn1=1, fn2=1, fn=0; System.out.print(fn1+" "+fn2+" "); for (int i=0; i<kst; i++) { fn = fn2 + fn1; fn2 = fn1; fn1 = fn; System.out.print(fn...
b25775a5-f44e-4119-9852-047af4ab2cdc
1
@Override public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException { Input input = gc.getInput(); if(input.isKeyPressed(Input.KEY_ENTER)) { sbg.enterState(Main.States.Play.ordinal()); } }
d8fa53a9-15b7-4570-9cba-79fc14142ca4
3
public void actionPerformed(ActionEvent e) { // Construct the regular grammar. RightLinearGrammar grammar = (RightLinearGrammar) environment .getGrammar(RightLinearGrammar.class); if (grammar == null) return; if (grammar.getProductions().length == 0) { JOptionPane.showMessageDialog(Universe .fram...
831b7599-51ab-4279-9bcb-e2fcaec03344
7
public void deletePage(int i) { if (this.numPages == 0) { return; } this.pages.get(i).destroyPage(); this.pages.remove(i); for (int x=0; x < this.pages.size(); x++) { this.pages.get(x).setIndex(x); } this.numPages--; this.curPage--...
4fce34f2-9f9e-450d-aa51-4e8422cc5a4f
9
public String prettyPrint() { String result = ""; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { boolean b1 = i == 0 ? false : true; boolean b2 = j == 0 ? false : true; List<Boolean> symbols = new ArrayList<Boolean>(); symbols.add(b1); symbols.add(b2); result += "P(" + b2 +...
0fa74167-3aed-4613-92e1-e6290a6cb18c
1
private String[] getScannedLine(Scanner scanner){ String line = scanner.nextLine(); line = line.replace("/", ""); line = line.replace("\\", ""); line = line.replace("_", ""); line = line.replace(" ", ""); line = line.replace("\t", ""); if(line.equals("")){ ignoredLines++; return new String[0]; } Stri...
2682ab21-ffb9-47f0-8cce-abba713191cc
0
public void mouseReleased(MouseEvent e) { }
14a86d92-be29-48c8-9b38-9c657b90b9a8
1
public void gameLoop() { while(1==1) { System.out.println(theTime.getParsedTimeDay()); //Show current time and day before... System.out.println("You are in " +thePlayer.currentLocation.name +" - " +thePlayer.currentLocation.room); //...Showing the current location. ...
a0fa467b-b32e-43d6-96e9-02ac57f05f1f
3
private void btnBookMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnBookMouseClicked // TODO add your handling code here: SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy"); try{ Calendar start = GregorianCalendar.getInstance(); start.setTime(f...
45188fc2-be05-42be-81ad-c53609c5a3b2
9
public static void initDisplay() { // Get the original display mode (the display mode before the program is // run) origDisplayMode = Display.getDisplayMode(); System.out.println("RacingApp.initDisplay(): Current display mode is: " + origDisplayMode); try { // If the program settings indicate it to u...
27ff9686-d895-4d56-ba45-04e8fb48ef2d
8
public void updateThisField (JTextField textField, boolean updateRemaining) { try { tempLong = usFormat.parse(textField.getText()).longValue(); textField.setText(usFormat.format(tempLong)); switch (textField.getName()) { case "Screen Cups": todaysBean.setAvailableScreenCups(tempLong); break...
ab5148a4-1465-4a70-ac1e-fcdcae10d621
9
@Override public double score(NewsEvent event, long forecast) { String content = event.getContent(); Matrix pdv = index.getPseudoDocumentVector(tokenizer.tokenize(content)); Matrix similarity = matrix.mtimes(pdv); Matrix delta = MatrixFactory.dense(1, news.size()); for(int i = 0; i < news.size(); i++) ...
c5a5fc22-2349-4a1d-ad1f-4da392fd78b2
7
@Override public void draw(Graphics g) { Tile tile = super.getTile(); int x = tile.getWidth() * tile.getXPos(); int y = tile.getHeight() * tile.getYPos(); //g.setColor(Color.RED); //g.fillOval(x, y, tile.getWidth(), tile.getHeight()); try { BufferedImage img =...
9925f336-bcc9-4524-aefd-7f6cfd630f2c
9
private void ElseIfStatement(boolean ran) { nextToken(); ArrayList<Token> exp = LogicalExpression(); ArrayList<Token> stmts = getStatements(); if(exp == null || stmts == null) { return; } BooleanParser bp = new BooleanParser(exp); boolean run = bp.getAnswer(); if(run && !ran) { StatementsPa...
17edd6d1-ba46-434a-948b-012a45b5625f
7
public ArrayList<Polynomial> multiplyExpressions(ArrayList<Polynomial> expression1, ArrayList<Polynomial> expression2) { int sizeOfExpressions = expression1.size() + expression2.size();// Size of the result array, needs to be dynamically sized int k = 0;//Index of the result ArrayList<Polynomial> temp = new Ar...
af6d935e-0705-44f2-bf05-2d5cce8333bc
8
public static void main(String[] args) throws Exception { int sendport = 6001; DatagramSocket socket = new DatagramSocket(6001); long server_isn = 9000L; long mws = 0L; long mss = 0L; String filename = null; long sendbase = 0L; TreeSet<MyPacket> windows = new TreeSet<MyPacket>(); long originalbase = 0...
32f797c0-513d-4a32-b9e1-b529c8cff4e5
5
public void saveStatusBlocks(){ if (customConfigurationFile == null) { customConfigurationFile = new File(plugin.getDataFolder(), "status.yml"); } customConfig = new YamlConfiguration(); List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); for (Location blockLoc : plugin.statusBlock...
30c084a0-7270-4289-a39c-74111d523fff
9
private int c2i(char c) { switch (c) { case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9; } return 0; }
40a797ea-49c8-4ffa-83f1-764828e31e92
2
public static Boolean getBoolParam(SessionRequestContent request, String name) { String param = (String) request.getParameter(name); if (param != null && !param.isEmpty()) { Boolean currParam = Boolean.parseBoolean(param); return currParam; } return null; }
90dfa511-2626-4409-bbc8-edc13f27e31e
9
ClosedArea append(LineSegmentInt other) { if (isClosed()) { throw new IllegalStateException(); } if (getSegments().contains(other)) { throw new IllegalArgumentException(); } final ClosedArea result = new ClosedArea(); for (LineSegmentInt seg : segmentsList) { result.addSegment(seg); } if (resul...
09604d14-d3d3-41d9-bcb1-6093bfd90725
4
@Test public void gameIsResetted() { rp.resetGame(); assertTrue(rp.getEntities().getList(Rat.class).size() == 1 && rp.getEntities().getList(Ball.class).size() == Const.ballAmountInFirstLevel && rp.getEntities().getList(Cheese.class).size() == Const.cheeseamount &&...
51e4e017-573a-443e-bb28-ec0e4f39a973
3
public ChatMessage[] loadMessages(ChatChannel channel, Date joinDate){ ChatMessage[] chatMessages = null; try { Socket socket = new Socket(SERVER_ADDRESS_CHAT, CHAT_PORT); socket.setSoTimeout(TIMEOUT); OutputStream outputStream = socket.getOutputStream(); ObjectOutputStream objectOutputStream = ...
b7d71878-599f-4cda-bc50-cdc4009bb73d
7
public static void generateInvertedIndex(boolean includeApproximateMatches, String tokenizationType, File directory) { //NB Change nGramSize to tokenizationType dictionaryMap.clear(); inverseDocFreqMap.clear(); //read all files in a directory //http://stackoverflow.com/questions/491732...
2f54416d-ceb2-4673-a7b2-013cedb81adc
8
public void setPortBLabels(int t) { int a = t & 0b00000001; int b = t & 0b00000010; int c = t & 0b00000100; int d = t & 0b00001000; int e = t & 0b00010000; int f = t & 0b00100000; int g = t & 0b01000000; int h = t & 0b10000000; if (a > 0) { label_45.setText("1"); } else { label_45.setText("0")...
e47f03ca-21dc-47ba-a0dd-8fc2ca053ec1
9
@Override protected boolean isValueAcceptable(String key, String bdbValue, String hadoopValue) { if (bdbValue.equals(hadoopValue)) { return true; } String[] bdbValueSplitContents = bdbValue.split(AnalyseConstants.FINAL_VALUE_SPLITTER); String[] hadoopValueSplitContents = ...
004872b9-1839-4436-810a-a592e0014172
6
private void writeObject(JSONObject jsonobject) throws JSONException { // JSONzip has two encodings for objects: Empty Objects (zipEmptyObject) and // non-empty objects (zipObject). boolean first = true; Iterator keys = jsonobject.keys(); while (keys.hasNext()) { if (probe) { ...
5b043f9a-aef9-4789-ac29-dd94bb5ca4fa
9
private void checkRight(int x, int y) { boolean test = false; if (test || m_test) System.out.println("ConnectFour::checkRight() - BEGIN"); Grid grid = getGrid(); Game.PlayerTurn Player = grid.getCoordinate(x, y).getValue(); if (Player != Game.PlayerTurn.NONE) { if (x < GAME_WIDTH - COUNT3) { if ((g...
672ac88c-fe4e-4d8d-ac81-37d25641a6c8
5
public void abrir() throws Exception { if(id.length() > 0 && !id.equals("0")){ long cod = Long.parseLong(id); if(venda == null || (venda != null && venda.getId() != cod ) ) setVenda(ejb.Open(cod)); } }