method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1eabdef9-6ca6-423c-920e-ef043c0e10f5
1
public StagShopPlayer(StageManager stageManager, Map<String, String> data) { super(stageManager, data); PlayerData.load(); players = new ArrayList<>(); buttons = new BufferedImage[2][2]; try { addPlayer("/graphics/entity/MCPlayerAnimation.xml", ImageIO.read(getClass().getResourceAsStream("/graphics/entity/MCPlayer.png"))); addPlayer("/graphics/entity/TetrisPlayerAnimation.xml", ImageIO.read(getClass().getResourceAsStream("/graphics/entity/TetrisPlayer.png"))); background = ImageIO.read(getClass().getResourceAsStream("/graphics/level/background/BlueBackgroundPixel.png")); coin = ImageIO.read(getClass().getResourceAsStream("/graphics/entity/coin/coin.png")); buttons[0][0] = ImageIO.read(getClass().getResourceAsStream("/graphics/menue/PlayButtonBreitSelected.png")); buttons[0][1] = ImageIO.read(getClass().getResourceAsStream("/graphics/menue/PlayButtonBreitUnpressed.png")); buttons[1][0] = ImageIO.read(getClass().getResourceAsStream("/graphics/menue/BackButtonBreitSelected.png")); buttons[1][1] = ImageIO.read(getClass().getResourceAsStream("/graphics/menue/BackButtonBreitUnpressed.png")); } catch (IOException e) { e.printStackTrace(); } recs[0] = new Rectangle(20, GamePanel.HEIGHT - 50, buttons[0][0].getWidth(), buttons[0][0].getHeight()); recs[1] = new Rectangle(220, GamePanel.HEIGHT - 50, buttons[0][0].getWidth(), buttons[0][0].getHeight()); }
13142705-f06a-4cae-9010-afb7c7742432
7
@Override public Object getValueAt(int rowIndex, int columnIndex) { ComponentIn in = ins.get(rowIndex); switch (columnIndex) { case 0: return in.getComponent().getId(); case 1: return in.getDate(); case 2: return in.getCount(); case 3: return in.getPrice(); case 4: return in.getCompany().getName(); case 5: return in.getActionId(); case 6: return in.getMark(); } return ""; }
43c2bfd4-0280-4e06-96f7-a14e9488bce5
5
@EventHandler public void onArenaStart(PAStartEvent e){ FileConfiguration config = Main.getConfig(); HashSet<ArenaTeam> Teams = e.getArena().getTeams(); for (ArenaTeam t : Teams) { HashSet<ArenaPlayer> Players = t.getTeamMembers(); if (t.getName().equalsIgnoreCase(config.getString("PVPArena.BlueTeamName"))){ BluePlayers = Players.size(); } else if (t.getName().equalsIgnoreCase(config.getString("PVPArena.RedTeamName"))) { RedPlayers = Players.size(); } else { Main.getLogger().info("Unkown Team: " + t.getName()); } } Main.getRedstoneChips().getChannelManager().getChannelByName(config.getString("PVPArena.GameIsRunningChannel"), false).transmit(true, 0); BroadcastChannel ReverseChannel = Main.getRedstoneChips().getChannelManager().getChannelByName(config.getString("PVPArena.ReverseChannel"), false); ReverseChannel.transmit(true, 0); BroadcastChannel BlueChannel = Main.getRedstoneChips().getChannelManager().getChannelByName(config.getString("PVPArena.BlueChannel"), false); for (int i = 0; i < BluePlayers; i++){ BlueChannel.transmit(true, 0); BlueChannel.transmit(false, 0); } BroadcastChannel RedChannel = Main.getRedstoneChips().getChannelManager().getChannelByName(config.getString("PVPArena.RedChannel"), false); for (int i = 0; i < RedPlayers; i++){ RedChannel.transmit(true, 0); RedChannel.transmit(false, 0); } ReverseChannel.transmit(false, 0); }
e099bde6-48ba-4b4f-be0a-9476a15a2e1b
5
@Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (tagLabel != null ? tagLabel.hashCode() : 0); result = 31 * result + (parentLink != null ? parentLink.hashCode() : 0); result = 31 * result + (creationDate != null ? creationDate.hashCode() : 0); result = 31 * result + (archived != null ? archived.hashCode() : 0); return result; }
de00a344-bb01-4970-8905-89575f66e1b7
3
public void run() { try { // this will handle our XML voyageHandler voyagesHandler = new voyageHandler(); // get a parser object SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); // get an InputStream from somewhere (could be HttpConnection, for example) HttpConnection hc = (HttpConnection) Connector.open("http://localhost/smartPhp/getXmlAnnonce.php"); DataInputStream dis = new DataInputStream(hc.openDataInputStream()); parser.parse(dis, voyagesHandler); // display the result voyages = voyagesHandler.getVoyages(); //get_personne if (voyages.length > 0) { int j = 1; for (int i = 0; i < voyages.length; i++) { // lst.append(voyages[i].getDestination(), null); listeannonces.append(" Annonce N°" + j + " Destination: " + voyages[i].getDestination() + "Nbr de places " + voyages[i].getNb_place(), null); // listeannonces.append(" Annonce N°" + j, null); //listeannonces.append(voyages[i].getDestination(), null); // listeannonces.append("Nbr de places "+voyages[i].getNb_place(), null); /// lst.append(voyages[i].getNb_place()+"", null); //// listeannonces.append("Date "+voyages[i], null); j++; } } } catch (Exception e) { System.out.println("Exception:" + e.toString()); } disp.setCurrent(listeannonces); }
4752e874-2d19-4afa-8225-6029d38c002e
6
public final void levelDone() { if (!inGameState("InGame") || inGameState("LevelDone") || inGameState("LifeLost") || inGameState("GameOver") ) return; // System.err.println( // "Warning: levelDone() called from other state than InGame." ); //} clearKey(key_continuegame); removeGameState("StartLevel"); removeGameState("StartGame"); seqtimer=0; if (leveldone_ticks > 0) { if (leveldone_ingame) addGameState("LevelDone"); else setGameState("LevelDone"); new JGTimer(leveldone_ticks,true,"LevelDone") {public void alarm() { levelDoneToStartLevel(); } }; } else { levelDoneToStartLevel(); } }
5ff7e486-396b-43ab-bfe3-f7fec3533c01
7
public Move giveMove(){ //update the weights for the new state double[][] w = newGenerateWeights(super.currentGameState.getStatus()); //double[][] w1 = generateWeights(super.currentGameState.getStatus()); Iterator<String> i = super.currentGameState.getDict().iterator(); for(int j =0; j<5;j++){ Letterpress.p(Arrays.toString(w[j])); } //walk through the possible moves and get the best weighted move LMove bestMove = null; double bestWeight = 0.0; while(i.hasNext()){ String move = i.next(); //calculate the word value for the given board //build the move boolean [][]used = new boolean[5][5]; for (int j = 0; j <used[0].length; j++){ Arrays.fill(used[j], false); } LMove mv = new LMove(); mv.setWord(move); for (int k=0;k<move.length();k++){ char c = move.charAt(k); LCoord bestLtr = getBestLtr(w,used,c); used[bestLtr.getRow()][bestLtr.getCol()] = true; mv.addLCoord(bestLtr); } //score the move vs. best weight double moveWeight = 0.0; Iterator<LCoord> it = mv.iterator(); while (it.hasNext()){ LCoord c = it.next(); moveWeight += w[c.getRow()][c.getCol()]; } if (moveWeight > bestWeight){ bestMove = mv; bestWeight = moveWeight; } } //get letter positions for the best move if (bestMove == null){ return new LMove(); } else { //Letterpress.p(bestMove.getWord()); Letterpress.p("Move Weight: "+bestWeight); return bestMove; } }
df2f1384-3ae9-4895-bb2f-cace02905393
4
public static void main(String[] args) { //TODO think if we want to remove it System.setProperty("java.net.preferIPv4Stack" , "true"); try { prop.load(new FileInputStream(CONFIG_FILE)); startSMTPNotifictionThread(); startLisning(); } catch (NumberFormatException e) { System.out.println("Plz check 'port' value in config.ini"); e.printStackTrace(); } catch (FileNotFoundException e) { System.out.println("config fle not found"); e.printStackTrace(); } catch (IOException e) { System.out.println("could not read config file - or port 8080 could not be obtained - or could not start a new thread"); e.printStackTrace(); } catch (InterruptedException e) { System.out.println("we had a problem in the Requst queue"); e.printStackTrace(); } }
88810608-1b84-402b-a4a6-10fafe8c4661
4
public boolean isMove() { return (fromTable!=null && toTable!=null&& toName != null && fromName!= null && toName.equals(fromName)); }
cf1949e2-98e2-4f99-bbb5-651dbbe60159
1
public void onStart() { preStop = false; preStart = false; isStarted = true; DodgeballPlayer parray[] = new DodgeballPlayer[1]; parray = playerList.toArray(parray); Player pl = (parray[rand.nextInt(parray.length)]).getPlayer(); pl.setItemInHand(new ItemStack(Material.SNOW_BALL, 3)); for(DodgeballPlayer p: parray) { setPlayerAtRandomLocation(pl); p.getPlayer().sendMessage(ChatColor.GREEN + "Minigame Started!"); } }
4795252e-153a-4e74-a29a-3606567379b3
0
public void setAmount(double amount) { this.amount = amount; }
b603fdfd-7537-458e-8d3b-3db2ee303303
9
@SuppressWarnings("unused") private void i(String input[]) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, InstantiationException { if (inspObject.isNull() || inspObject.isPrimitive() || input.length < 2 || input.length > 3) { InfoPrinter.printNothingToDo(); return; } String name = input[1]; Field field = null; Class<?> actualClass = inspObject.getObjectClass(); /** * If there are three arguments, we enter shadow mode and look for * attribute on a specific superclass, otherwise we try all superclasses */ if (input.length == 3) { int level = Integer.parseInt(input[2]); for (int i = 0; i < level && actualClass != Object.class; i++) { actualClass = actualClass.getSuperclass(); } field = getFieldOnClass(name, actualClass); } else { field = getFieldInAnyClass(name); } if (field != null) { boolean originalAcess = field.isAccessible(); field.setAccessible(true); Object fieldObj = field.get(inspObject.getObject()); field.setAccessible(originalAcess); InspectedObject obj = new InspectedObject(fieldObj, field.getType()); updateObject(obj); historyGraph.addToHistory(inspObject); } else { InfoPrinter.printNullInfo("inspect"); } }
fc3f081b-e3ee-4641-bd3f-ff1bde69c00b
7
public List<String> getmenuItemsCourseType() { List<String> menuItemsCourseType = new ArrayList<String>() { private static final long serialVersionUID = 3109256773218160485L; { try { //Connect to database conn = DriverManager.getConnection(url, userName, password); stmt = conn.createStatement(); ResultSet rset = null; PreparedStatement pstmt = null; pstmt = conn.prepareStatement("select distinct type from Course order by type asc"); rset = pstmt.executeQuery(); while (rset.next()) { add(rset.getString("type")); } } catch (SQLException e) { response = "SQLException: " + e.getMessage(); while ((e = e.getNextException()) != null) { response = e.getMessage(); } } finally { try { if (stmt != null) { stmt.close(); } if (conn != null) { conn.close(); } } catch (SQLException e) { response = "SQLException: " + e.getMessage(); while ((e = e.getNextException()) != null) { response = e.getMessage(); } } } } }; return menuItemsCourseType; }
706cb321-b42d-4c1e-ad1f-44f4f9747ce2
0
public Iterable<String> keysWithPrefix(String prefix) { Queue<String> q = new LinkedList<String>(); Node x = get(root, prefix, 0); collect(x, new StringBuilder(prefix), q); return q; }
70e9122a-cd75-42bb-add5-2707721040da
2
public Quantity sub (Quantity target) throws IllegalArgumentException { if(target.unit == null || !target.unit.equals(this.unit)) { throw new IllegalArgumentException(); } Quantity result = new Quantity (this.value - target.value, target.numerator, target.denominator); return result; }
b8aa18c7-c6a7-4520-9899-253c0063c4ef
7
private final MaplePortal getFreePortal() { final List<MaplePortal> freePortals = new ArrayList<MaplePortal>(); for (final MaplePortal port : town.getPortals()) { if (port.getType() == 6) { freePortals.add(port); } } Collections.sort(freePortals, new Comparator<MaplePortal>() { @Override public final int compare(final MaplePortal o1, final MaplePortal o2) { if (o1.getId() < o2.getId()) { return -1; } else if (o1.getId() == o2.getId()) { return 0; } else { return 1; } } }); for (final MapleMapObject obj : town.getAllDoor()) { final MapleDoor door = (MapleDoor) obj; if (door.getOwner().getParty() != null && owner.getParty().containsMembers(new MaplePartyCharacter(door.getOwner()))) { freePortals.remove(door.getTownPortal()); } } return freePortals.iterator().next(); }
e50af1c7-76d6-4eb9-bed7-1e244718cb87
2
private Tree compoundStatementPro(){ Tree statements = null; if(accept(Symbol.Id.PUNCTUATORS,"\\{")!=null){ statements = statementsPro(); if(accept(Symbol.Id.PUNCTUATORS,"\\}")!=null){ return statements; } } return null; }
5383bbd7-c69e-4416-95b5-b2c2c184ede1
7
public void receive(Message msg) { Address sender=msg.getSrc(); if(bridge.getAddress().equals(sender)) // discard my own messages return; RelayHeader hdr=msg.getHeader(id); switch(hdr.type) { case DISSEMINATE: // should not occur here, but we'll ignore it anyway break; case FORWARD: sendOnLocalCluster(msg.getRawBuffer(), msg.getOffset(), msg.getLength()); break; case VIEW: try { ViewData data=Util.streamableFromByteBuffer(ViewData.class, msg.getRawBuffer(), msg.getOffset(), msg.getLength()); // replace addrs with proxies if(data.remote_view != null) { List<Address> mbrs=data.remote_view.getMembers().stream().collect(Collectors.toCollection(LinkedList::new)); data.remote_view=new View(data.remote_view.getViewId(), mbrs); } boolean merge=remote_view == null; stopRemoteViewFetcher(); data.global_view=generateGlobalView(local_view, data.remote_view, merge); sendViewOnLocalCluster(data, false, null); } catch(Exception e) { log.error(Util.getMessage("FailedUnmarshallingViewFromRemoteCluster"), e); } break; case BROADCAST_VIEW: // no-op // our local view is seen as the remote view on the other side ! sendViewToRemote(ViewData.create(local_view, null), true); break; default: throw new IllegalArgumentException(hdr.type + " is not a valid type"); } }
0127bf81-dd93-4860-872c-b16d56a01f1a
4
public void generation(String srcWord, int length) { generated.add(srcWord); System.out.println(srcWord); //processQueue(srcWord); checkOneLetterOff(srcWord); if(length != 0) { if(tmp4.size() > location) { if(!(tmp4.get(location).isEmpty()) && location <tmp4.size()-1) { location++; } }else{ System.out.println("Can generate: " + generated.size() + " Links"); System.out.println(generated); userInter.optionSelect(); } String tempWrd = tmp4.get(location); length--; tmp4.clear(); // System.out.println(tempWrd); generation(tempWrd, length); } System.out.println("Can generate: " + generated.size() + " Links"); System.out.println(generated); userInter.optionSelect(); }
dc2fcfa5-4bc3-42cd-bae1-469dfdac3cd4
7
public static void makeCompactGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout)parent.getLayout(); } catch (ClassCastException exc) { System.err.println("The first argument to makeCompactGrid must use SpringLayout."); return; } //Align all cells in each column and make them the same width. Spring x = Spring.constant(initialX); for (int c = 0; c < cols; c++) { Spring width = Spring.constant(0); for (int r = 0; r < rows; r++) { width = Spring.max(width, getConstraintsForCell(r, c, parent, cols). getWidth()); } for (int r = 0; r < rows; r++) { SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols); constraints.setX(x); constraints.setWidth(width); } x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad))); } //Align all cells in each row and make them the same height. Spring y = Spring.constant(initialY); for (int r = 0; r < rows; r++) { Spring height = Spring.constant(0); for (int c = 0; c < cols; c++) { height = Spring.max(height, getConstraintsForCell(r, c, parent, cols). getHeight()); } for (int c = 0; c < cols; c++) { SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols); constraints.setY(y); constraints.setHeight(height); } y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad))); } //Set the parent's size. SpringLayout.Constraints pCons = layout.getConstraints(parent); pCons.setConstraint(SpringLayout.SOUTH, y); pCons.setConstraint(SpringLayout.EAST, x); }
21e76c95-41a1-437b-8b88-82c92551df38
0
public void start () { engine.start(); }
652da659-7c94-4dd6-8c01-896bd419efbe
9
public void processQueries(String strInputFilePath, String strOutputFilePath) throws IOException { oBufferedReader = new BufferedReader(new FileReader(strInputFilePath)); oBufferedWriter = new BufferedWriter(new FileWriter(strOutputFilePath)); calcuateTFIDF(oBufferedReader); oBufferedReader.close(); oBufferedReader = new BufferedReader(new FileReader(strInputFilePath)); String strLine = null; String strNumber = null; Hashtable<String, Double> oTempTermVsTFIDF = new Hashtable<String, Double>(); while ((strLine = oBufferedReader.readLine()) != null) { if (strLine.trim().length() == 0) continue; if (strLine.trim().equalsIgnoreCase("</top>")) { writeTermsToFile(strNumber, oTempTermVsTFIDF); } else if (strLine.trim().startsWith("<num>")) { strNumber = strLine.substring(strLine.indexOf(":") + 1).trim(); } else if (strLine.trim().startsWith("<title>") || !strLine.trim().startsWith("<")) { if (strLine.startsWith("<title>")) strLine = strLine.substring(8).trim().toLowerCase(); for (String strTerm : strLine.split(" ")) { if (oTermVsTFIDF.containsKey(strTerm)) oTempTermVsTFIDF .put(strTerm, oTermVsTFIDF.get(strTerm)); } } } System.out.println(oTempTermVsTFIDF); oBufferedReader.close(); oBufferedWriter.close(); }
3d93df1d-c354-45f9-8bbc-3968fe8abd14
2
public void addDish(Dish dish) { if (storage.avaiable(dish)) { queue.add(dish); storage.prepare(dish); } if(queue.size()>10){ getFirstDish(); } }
28e3ab81-27bc-43b6-8a6f-76b94c56e599
9
private boolean checkRightDiagonalWin(int playerNumber) { int criticalNumber = 0; int i = 0; int j = gameField.getFieldSize() - 1; switch(playerNumber) { case 1: { while (i < gameField.getFieldSize()) { if(gameField.isX(i,j)) { criticalNumber++; i++; j--; continue; } if(gameField.isO(i,j)) { criticalNumber = 0; break; } i++; j--; } } case 2: { while (i < gameField.getFieldSize()) { if(gameField.isO(i,j)) { criticalNumber++; i++; j--; continue; } if(gameField.isX(i,j)) { criticalNumber = 0; break; } i++; j--; } } } if (criticalNumber == gameField.getFieldSize() - 1) { return true; } return false; }
66186027-8cde-4d90-9812-7bded636747b
4
public Gridlet getNextGridlet(int userID) throws NoMoreGridletsException { if ((_configs == null) || (_currentConfig == null)) throw new NoMoreGridletsException(); if (_currentConfigGridletsCount >= _currentConfig.getCount()) { if (!_itCurrentGC.hasNext()) throw new NoMoreGridletsException(); _currentConfig = _itCurrentGC.next(); _currentConfigGridletsCount = 0; } Gridlet g = new Gridlet(_currentGridletID, _currentConfig.getLength(), _currentConfig.getInputSize(), _currentConfig.getOutputSize()); g.setUserID(userID); ++_currentGridletID; ++_currentConfigGridletsCount; return g; }
ebe03a2b-bdb3-42ad-99c9-5501de955f7f
0
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { System.out.println("Blip3.readExternal"); s = (String)in.readObject(); i = in.readInt(); }
33a5f13d-782b-43ac-a93e-ffb4be65d479
6
@EventHandler(priority= EventPriority.NORMAL) public void onInventoryOpenEvent(InventoryOpenEvent e){ if(e.getPlayer().hasPermission("pexp.everywhere")){ return; } if(!(e.getPlayer() instanceof Player)){ if(e.getView().getType() == InventoryType.ENCHANTING){ if(this.plugin.config.method.equalsIgnoreCase("bi") && this.plugin.config.limitcount > 0){ Player p = (Player) e.getPlayer(); if(p.isSneaking()){ e.setCancelled(true); } } } } }
151fbf7b-3bd1-4196-95be-563c1a2128f3
1
public static DataLayerManager getInstance() { if (instance == null) instance = new DataLayerManager(); return instance; }
817ed029-b322-4121-842e-e3b452e61ac9
6
public int getInt(String itemTxt) { int num = 0; if(itemTxt.equals("inv1")) { num = 1; } else if(itemTxt.equals("inv2")) { num = 2; } else if(itemTxt.equals("inv3")) { num = 3; } else if(itemTxt.equals("inv4")) { num = 4; } else if(itemTxt.equals("inv5")) { num = 5; } else if(itemTxt.equals("inv6")) { num = 6; } return num; }
c71a8b84-0708-4809-94f3-b9f88002f346
5
public void detectOther(Sprite other) { if(isRemovable) return; if( other == detected) return; detected = other; if(getCenter().distance(other.getCenter()) <= getWidth() / 2 + other.getWidth()/2){ collide(other); other.collide(this); }else{ if(other instanceof Prey)other = (Prey)other; if(other instanceof Predator)other = (Predator)other; other.detectOther(this); } }
30350fd3-8fb3-4a48-9016-4a69a9e795d4
0
public RedrawButtonListener(GraphDrawer d) { this.d = d; }
c9dc68c3-4bab-477a-92bf-97e55ad4f9d8
2
private Runnable createConsumer(final CloudNode cloudNode) { return () -> { logger.info("Consumer thread started."); while (!this.isMaster(cloudNode)) { try { final String task = HazelcastHelper.this.getTaskQueue().take(); logger.info("Retrieved task: {}", task); Thread.sleep(RandomUtils.nextInt(2500, 7000)); logger.info("Finished task: {}", task); } catch (final Exception ex) { logger.error("Exception occurred!", ex); } } }; }
5a2f0023-8012-476b-86dc-638fa255aa85
9
private void setShapeDefault(Attributes attrs) { // find the value to be set, then set it if (attrs.getValue(0).equals("fill")) shapeDef.setFill(Boolean.valueOf(attrs.getValue(1))); else if (attrs.getValue(0).equals("color")) shapeDef.setColor(new Color((Integer.valueOf(attrs.getValue(1) .substring(1), 16)))); else if (attrs.getValue(0).equals("thickness")) shapeDef.setThickness(Integer.valueOf(attrs.getValue(1))); else if (attrs.getValue(0).equals("alpha")) shapeDef.setAlpha(Float.valueOf(attrs.getValue(1))); else if (attrs.getValue(0).equals("starttime")) shapeDef.setStartTime(Integer.valueOf(attrs.getValue(1))); else if (attrs.getValue(0).equals("endtime")) shapeDef.setEndTime(Integer.valueOf(attrs.getValue(1))); else if (attrs.getValue(0).equals("onclick")) shapeDef.setOnClick(Integer.valueOf(attrs.getValue(1))); else if (attrs.getValue(0).equals("onclickurl")) shapeDef.setOnClickUrl(attrs.getValue(1)); else if (attrs.getQName(0).equals("filltype")) shapeDef.setFillType(Integer.valueOf(attrs.getValue(1))); }
9efec55b-765f-45bb-86b7-b4317ca0f74f
3
private Tree constructorCallPro(){ Tree argumentListOpt=null; Symbol identifier; if((identifier = accept(Symbol.Id.IDENTIFIER_NAME))!=null){ if(accept(Symbol.Id.PUNCTUATORS,"\\(")!=null){ argumentListOpt = argumentListPro(); if(accept(Symbol.Id.PUNCTUATORS,"\\)")!=null){ return new ConstructorCallExpression(identifier, argumentListOpt); } return null; } return new PrimaryExpression(identifier); } return null; }
765acdcd-c393-48a3-9eca-03701157a370
4
public Collection<Merchant> getMerchants(Token t) { HTTPClient client = GoCoin.getHTTPClient(); client.setRequestOption(HTTPClient.KEY_OPTION_PATH,"/merchants/"); client.addAuthorizationHeader(t); try { //make the GET request client.doGET(client.createURL(HTTPClient.URL_TYPE_API)); //check the response GoCoin.checkResponse(client); //return our merchants Collection<Merchant> merchants = new LinkedList<Merchant>(); //get the json array JSONArray array = new JSONArray(client.getResponse()); //add each merchant in the array if (array != null && array.length() > 0) { for(int i=0; i<array.length(); i++) { merchants.add(new Merchant(array.getJSONObject(i))); } } //return the merchants return merchants; } catch (Exception e) { GoCoin.log(e); return null; } }
71d920d2-d5d7-44a7-9d5e-25b67328d3e1
9
public Domain cap(Domain d) { if (!(d instanceof IntDomain)) return EMPTY; IntDomain new_d = new IntDomain(); IntDomain d0 = this; IntDomain d1 = (IntDomain) d; try { int[] interval; int min0, max0, min1, max1; int i0 = 0; int i1 = 0; while (i0 < d0.intervals.size() && i1 < d1.intervals.size()) { interval = d0.intervals.get(i0); min0 = interval[0]; max0 = interval[1]; interval = d1.intervals.get(i1); min1 = interval[0]; max1 = interval[1]; if (max0 < min1) { i0++; continue; } if (max1 < min0) { i1++; continue; } interval = new int[2]; interval[0] = Math.max(min0, min1); interval[1] = Math.min(max0, max1); new_d.intervals.add(interval); if (max0 <= max1) i0++; if (max1 <= max0) i1++; } } catch (IndexOutOfBoundsException e) { } new_d.updateSize(); new_d.updateMinMax(); if (new_d.isEmpty()) return EMPTY; return new_d; }
8071dcf1-5de3-4735-ad20-02464b02924f
9
public static void main(String[] args) throws Exception { { File json = new File("/home/markus/Country.json"); FileUtils.write(json, "{\n", true); Country[] countries = Country.values(); for (Country country : countries) { FileUtils.write(json, "\"" + country.toString() + "\" : \"" + country.getName() + "\",\n", true); } FileUtils.write(json, "}", true); } { File json = new File("/home/markus/Language.json"); FileUtils.write(json, "{\n", true); Language[] languages = Language.values(); for (Language language : languages) { FileUtils.write(json, "\"" + language.toString() + "\" : \"" + language.getName() + "\",\n", true); } FileUtils.write(json, "}", true); } { File json = new File("/home/markus/ProviderType.json"); FileUtils.write(json, "{\n", true); ProviderType[] values = ProviderType.values(); for (ProviderType value : values) { FileUtils.write(json, "\"" + value.toString() + "\" : \"" + value.toString() + "\",\n", true); } FileUtils.write(json, "}", true); } { File json = new File("/home/markus/LibraryOrganization.json"); FileUtils.write(json, "{\n", true); LibraryOrganization[] values = LibraryOrganization.values(); for (LibraryOrganization value : values) { FileUtils.write(json, "\"" + value.toString() + "\" : \"" + value.toString() + "\",\n", true); } FileUtils.write(json, "}", true); } { File json = new File("/home/markus/ConsortiumType.json"); FileUtils.write(json, "{\n", true); ConsortiumType[] values = ConsortiumType.values(); for (ConsortiumType value : values) { FileUtils.write(json, "\"" + value.toString() + "\" : \"" + value.toString() + "\",\n", true); } FileUtils.write(json, "}", true); } { File json = new File("/home/markus/PortalStatus.json"); FileUtils.write(json, "{\n", true); PortalStatus[] values = PortalStatus.values(); for (PortalStatus value : values) { FileUtils.write(json, "\"" + value.toString() + "\" : \"" + value.toString() + "\",\n", true); } FileUtils.write(json, "}", true); } { File json = new File("/home/markus/NameType.json"); FileUtils.write(json, "{\n", true); NameType[] values = NameType.values(); for (NameType value : values) { FileUtils.write(json, "\"" + value.toString() + "\" : \"" + value.toString() + "\",\n", true); } FileUtils.write(json, "}", true); } { File json = new File("/home/markus/LinkType.json"); FileUtils.write(json, "{\n", true); LinkType[] values = LinkType.values(); for (LinkType value : values) { FileUtils.write(json, "\"" + value.toString() + "\" : \"" + value.toString() + "\",\n", true); } FileUtils.write(json, "}", true); } { File json = new File("/home/markus/ProviderRelationType.json"); FileUtils.write(json, "{\n", true); ProviderRelationType[] values = ProviderRelationType.values(); for (ProviderRelationType value : values) { FileUtils.write(json, "\"" + value.toString() + "\" : \"" + value.toString() + "\",\n", true); } FileUtils.write(json, "}", true); } }
9e7d521a-5bca-4d61-abcb-9045d6046f62
1
public void print(){ for(Term term: this){ System.out.println("Iterator Found: " + term.getName()); } }
24c43e27-b252-4806-b94d-200f5bf5cd9a
8
public RulesMainCLI(String[] args) { if (args.length < 1) { System.out.println(HEADER); System.out.println(FOOTER); System.out.println("Use -h or --help for command line options."); return; } CommandLine cl = null; Options options = new Options(); options.addOption("p", "path", true, "Base path for the rule set"); options.addOption("o", "output", true, "File to write output XML"); options.addOption("r", "request", true, "Request to process against the rules"); options.addOption("h", "help", false, "Help"); options.addOption("l", "logging-level", true, "Logging level (0-disabled, 1-errors, 2-events, 3-warnings, 4-info, 5-debug)"); CommandLineParser parser = new GnuParser(); try { cl = parser.parse(options, args); } catch(Exception e) { logger.error("Failed to parse command line.", e); System.err.println("Failed to parse command line." + e); return; } // Display help if requested if (cl.hasOption('h')) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("do.sh", HEADER, options, FOOTER); return; } // Process command line input loggingLevel = Integer.parseInt(cl.getOptionValue("l","1")); if (loggingLevel < 0 || loggingLevel > 5) { System.out.println("Logging level of ("+loggingLevel+") is not valid, defaulting to 1"); loggingLevel = 1; } String[] basePaths = cl.getOptionValues('p'); if (null == basePaths) { System.err.println("Base path (-p) is required"); return; } basePath = basePaths[0]; String[] requestPaths = cl.getOptionValues('r'); if (null == requestPaths) { System.err.println("Request (-r) is required"); return; } requestPath = requestPaths[0]; String[] outputPaths = cl.getOptionValues('o'); if (null != outputPaths) { outputPath = outputPaths[0]; } }
1a0ad4e2-1732-4951-9d1b-ceb739dac4ca
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Perfil)) { return false; } Perfil other = (Perfil) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; }
a6c513e6-24e0-458a-8f81-5d0a918022de
8
private void gameRender() { if (dbImage == null) { dbImage = createImage(PWIDTH, PHEIGHT); g = dbImage.getGraphics(); } // clear screen g.setColor(Color.WHITE); g.fillRect(0, 0, PWIDTH, PHEIGHT); // green board g.setColor(new Color(62, 156, 76)); g.fillRect(BORDER, BORDER, PWIDTH - 2 * BORDER, PHEIGHT - 2 * BORDER); // draw grid lines g.setColor(Color.BLACK); for (int i = 0; i <= SIZE; i++) g.drawLine(BORDER, BORDER + (PHEIGHT - 2 * BORDER) * i / SIZE, PWIDTH - BORDER, BORDER + (PHEIGHT - 2 * BORDER) * i / SIZE); for (int i = 0; i <= SIZE; i++) g.drawLine(BORDER + (PWIDTH - 2 * BORDER) * i / SIZE, BORDER, BORDER + (PWIDTH - 2 * BORDER) * i / SIZE, PHEIGHT - BORDER); // draw discs for (int i = 0; i < SIZE; i++) for (int j = 0; j < SIZE; j++) { Disc d = board.getDisc(new Coordinate(i, j)); if (d != Disc.EMPTY) { int centerx = (int) (BORDER + (i + 0.5) * (PWIDTH - 2 * BORDER) / SIZE); int centery = (int) (BORDER + (j + 0.5) * (PWIDTH - 2 * BORDER) / SIZE); if (d == Disc.BLACK) g.setColor(Color.BLACK); else g.setColor(Color.WHITE); int r = (PWIDTH - 2 * BORDER) / SIZE / 3; g.fillOval(centerx - r, centery - r, 2 * r, 2 * r); } } // draw score g.setColor(Color.BLACK); g.drawString("Black: " + board.getDiscs(Player.BLACK), 10, 20); g.drawString("White: " + board.getDiscs(Player.WHITE), 10, 40); if (gameOver) gameOverMessage(g); }
d10da846-eb74-4ceb-8bce-4bfdfb7573c0
2
public Locale dequeue() throws Exception { Locale retVal = null; // Check for underflow. if (! this.isEmpty()) { retVal = arr[frontPtr]; // Shift every element towards the front. for(int i = 0; i < backPtr; i++) { arr[i] = arr[i+1]; } // Reinitialize the last element arr[backPtr] = null; // shift the back pointer towards the front. backPtr--; } else { // In case of underflow, throw an underflow exception. Exception underflow = new Exception("Queue Underflow"); throw underflow; } return retVal; }
def0a5f1-3279-480a-abe1-0a8cb325e7e3
9
private boolean isStandardProperty(Class clazz) { return clazz.isPrimitive() || clazz.isAssignableFrom(Byte.class) || clazz.isAssignableFrom(Short.class) || clazz.isAssignableFrom(Integer.class) || clazz.isAssignableFrom(Long.class) || clazz.isAssignableFrom(Float.class) || clazz.isAssignableFrom(Double.class) || clazz.isAssignableFrom(Character.class) || clazz.isAssignableFrom(String.class) || clazz.isAssignableFrom(Boolean.class); }
35cfdfc6-5d6e-4d8e-8120-0ea3bc31d94e
1
public ShellLink setLanguage(String s) { ConsoleFEData cd = (ConsoleFEData)extra.get(ConsoleFEData.signature); if (cd == null) { cd = new ConsoleFEData(); extra.put(ConsoleFEData.signature, cd); } cd.setLanguage(s); return this; }
3b0b7b38-9be3-4e9a-a8cd-2e4d0388e73c
8
private static void abortPhase(Registry registry, LogItem logItem) { try { boolean failedServer = false; ICoreServer primary = null; for (String serverName : registry.list()) { //For every server, check it is alright to commit, and pass it the log try { ICoreServer currentServer = ((ICoreServer)registry.lookup(serverName)); if (currentServer.inService()) { //Store a reference to the primary to tell it to start logging later if (currentServer.getState() == ServerState.PRIMARY) primary = currentServer; currentServer.abortCommit(logItem); } } catch (Exception e) { failedServer = true; try { //e.printStackTrace(); ServerHelper.removeServer(registry, serverName); } catch (NotBoundException e1) { System.out.println("Server already removed"); } } } //If we've come across any failed servers, prompt the primary to log if (failedServer) { if (primary != null) primary.startLogging(); } } catch (RemoteException e) {} }
504bde08-ea57-49b3-be11-ddcddec6adef
3
protected static boolean isSkeletonSpecial(OggPacket packet) { byte[] d = packet.getData(); // Is it a Skeleton Fishead or Fisbone packet? if (d.length < 52) return false; if (IOUtils.byteRangeMatches(MAGIC_FISHEAD_BYTES, d, 0)) return true; if (IOUtils.byteRangeMatches(MAGIC_FISBONE_BYTES, d, 0)) return true; // Not a known Skeleton special packet return false; }
c1295e91-ad13-4f13-8adc-ad2954c6616b
3
@Override public void onPlayerItemUse(ChunkyPlayerItemUseEvent event) { try { if (!Permissions.PLAYER_BUILD_ANYWHERE.hasPerm(event.getChunkyPlayer().getPlayer())) return; } catch (ChunkyPlayerOfflineException e) { return; } if (event.getAccessLevel().equals(AccessLevel.NONE)) event.setCancelled(true); }
6c7792e9-8236-47cf-9d0f-23e15a13f0b6
1
public void closeStatement(){ try { stmnt.close(); } catch (SQLException ex) { handleSqlExceptions(ex); } }
675b8882-517f-43cf-8697-404a37c3178e
9
public CalculateAccordingUser(ReadData data) throws IOException { FileOutputStream fos = new FileOutputStream("comments_2.csv"); OutputStreamWriter osw = new OutputStreamWriter(fos, "GBK"); BufferedWriter bw = new BufferedWriter(osw); HashMap<String, ArrayList<Comment>> userCommentMap = data.getUserCommentMap(); HashMap<String, Store> storeIDMap = data.getStoreIDMap(); int count = 0; for (String userID : userCommentMap.keySet()) { ArrayList<Comment> comments = userCommentMap.get(userID); if (comments.size() >= 3) { int sumPrice = 0; int countPrice = 0; System.out.println(comments.size()); for (Comment comment : comments) { if (comment.getPrice() < 0) { Store store = storeIDMap.get(comment.getStoreID()); if (store != null) { comment.setPrice(store.getPrice()); } } Store store = storeIDMap.get(comment.getStoreID()); if (store != null) { sumPrice += store.getPrice(); countPrice++; } } int averagePrice = (int)Math.round( (float)sumPrice / (float)countPrice ); for (Comment comment : comments) { Store store = storeIDMap.get(comment.getStoreID()); if (store != null) { String[] sLabels = store.getLabel().split(" "); String type = ""; if (sLabels.length > 1) type = sLabels[sLabels.length - 1]; bw.write(comment.toString() + "," + type + "," + averagePrice + "," + store.getName() + "," + comments.size() + "\n"); bw.flush(); } } } count++; } System.out.println(count); }
95448f84-8b42-4e26-b2f8-ad385da91155
4
private String makeBoardMove(CardGame game) { switch (moveTypeTo) { case TO_ACE_PILES: return game.moveCardOntoAceFromBoard(indexFrom, indexTo); case TO_KING_PILES: return game.moveCardOntoKingFromBoard(indexFrom, indexTo); case TO_HAND: return "Cannot move to hand."; case TO_DECK: return game.addToDeck(indexFrom); } return "ERROR"; }
5bd4a133-118c-49f5-9c84-58b02645ccad
2
private String[] getPersonData(String name) throws Exception { for (String[] item : data) { if (item[NAME_INDEX].trim().equals(name)) { return item; } } throw new Exception("Data for " + name + " not found!"); }
47bff214-98ef-437d-ac0a-d639785994f2
2
public Duck(HuntField field) { boolean searchPosition = true; this.field = field; while (searchPosition) { position = new Position(new Random().nextInt(field.getXLength()), new Random().nextInt(field.getYLength())); if (field.setItem(this, position)) { searchPosition = false; } } }
5d2d6773-710b-404f-a202-9f957dbca2a2
2
public int getUnreadMessage(){ int remaining = 0; try { PreparedStatement checkCount = connection.prepareStatement( "select min(msg_seq) from hl7_q where read_flag is null"); ResultSet rs = checkCount.executeQuery(); while (rs.next()){ remaining = rs.getInt(1); System.out.println("DBLoader.getUnreadMessage: " + remaining); } checkCount.close(); } catch (SQLException se) { System.out.println("Error in DBLoader.getUnreadMessage: " + se); } return remaining; }
0789da7a-45f3-4900-841b-523e9fa38360
7
public void uimsg(String msg, Object... args) { if (msg == "pop") { is_ready = true; final int xoff = 50; if (inputs != null) { for (Widget w : inputs) w.unlink(); for (Widget w : outputs) w.unlink(); } inputs = new LinkedList<Widget>(); outputs = new LinkedList<Widget>(); int i; Coord c = new Coord(xoff, 10); for (i = 0; (Integer) args[i] >= 0; i += 2) { Widget box = new Inventory(c, new Coord(1, 1), this); inputs.add(box); c = c.add(new Coord(31, 0)); new Item(Coord.z, (Integer) args[i], -1, box, null, (Integer) args[i + 1]); } c = new Coord(xoff, 65); for (i++; (i < args.length) && ((Integer) args[i] >= 0); i += 2) { Widget box = new Inventory(c, new Coord(1, 1), this); outputs.add(box); c = c.add(new Coord(31, 0)); new Item(Coord.z, (Integer) args[i], -1, box, null, (Integer) args[i + 1]); } } }
811a0de4-69e7-4cf2-87a1-65585949900f
5
public Matrix backSubstitution(Matrix y) { if(rows != cols) { throw new IllegalArgumentException("Matrica nije kvadratna!"); } if(y.rows != rows || y.cols != 1) { throw new IllegalArgumentException("Krivi format vektora!"); } double[] x = new double[rows]; for(int i = rows - 1; i >= 0; i--) { x[i] = y.get(i, 0); for(int j = i + 1; j < rows; j++) { x[i] -= x[j] * matrix[i][j]; } x[i] /= matrix[i][i]; } return new Matrix(x); }
dfff8686-d197-4b53-947a-dd04032461ce
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(!Chant.chantAlignmentCheck(this,mob,false,auto)) return false; final Room R=mob.location(); if((R!=null)&&(!auto)) { this.alwaysRandomArea=true; if(super.getPlanarAbility(R.getArea())==null) { final boolean hereok=mob.location().findItem(null,"DruidicMonument")!=null; if(!hereok) { mob.tell(L("There is no druidic monument here. You can only begin this chant in a druidic grove.")); return false; } } else { final Item otherPlant = Druid_MyPlants.myPlant(R, mob, 0); if(otherPlant == null) { mob.tell(L("There is none of your plants here. You can travel from here through one of your plants.")); return false; } } } if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; return true; }
5532804f-61b4-496a-9ec3-becdeccc73a1
8
public String encodeSolution() throws EncodeException { StringBuilder res = new StringBuilder(); if (this.solution != null && this.solution.length > 0) { if (solution[0] instanceof Integer) { res.append("int"); } else if (solution[0] instanceof Double) { res.append("dbl"); } else if (solution[0] instanceof Character) { res.append("chr"); } else if (solution[0] instanceof String) { res.append("str"); } else if (solution[0] instanceof Boolean) { res.append("bln"); } else { throw new EncodeException("Unsupported variable type"); } res.append("><"); for (Object value : this.solution) { res.append(value).append(':'); } res.replace(res.length()-1, res.length(), ""); } else { throw new EncodeException("Empty solution array"); } return res.toString(); }
68820129-e988-44b6-bbff-0d70f4d46071
8
@Override public Response serve(IHTTPSession session) { Method method = session.getMethod(); String uri = session.getUri(); Map<String, String> parms = session.getParms(); File rootDirectory = new File("www"); Response res = new NanoHTTPD.Response("jErgoViewer - Not Found"); if (uri.endsWith(".do")) { if (uri.equals("/list_kml.do")) { res = listKml(session); } else if (uri.equals("/stats.do")) { res = getStats(session); } } else { if (uri.equals("/")) { uri = "index.html"; } // static file File requestedFile = new File(rootDirectory, uri); if (requestedFile.exists()) { try { InputStream fileInputStream = new FileInputStream(requestedFile); String extension = ""; int i = requestedFile.getName().lastIndexOf('.'); if (i > 0) { extension = requestedFile.getName().substring(i+1); } String mimeType = mimeTypes.containsKey(extension) ? mimeTypes.get(extension) : "application/binary"; res = new NanoHTTPD.Response(Status.OK, mimeType, fileInputStream); } catch (FileNotFoundException e) { res = new NanoHTTPD.Response(Status.NOT_FOUND, "text/plain", "Error: " + e.getMessage()); } } } return res; }
df655aee-d1a6-45e0-8cb4-4482ed2bdb19
3
public void setRight(PExp node) { if(this._right_ != null) { this._right_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._right_ = node; }
4b2994d6-a074-49f8-a705-9009fc07c2fe
4
private static void scanNetworkInterfaces() { Enumeration<NetworkInterface> enumNI = null; NetworkInterface niTmp = null; EzimNetwork.nifs = new Hashtable<NetworkInterface, List<InetAddress>>(); try { enumNI = NetworkInterface.getNetworkInterfaces(); while(enumNI.hasMoreElements()) { niTmp = enumNI.nextElement(); if (! niTmp.isUp() || ! niTmp.supportsMulticast()) continue; EzimNetwork.nifs.put ( niTmp , new ArrayList<InetAddress> ( Collections.list(niTmp.getInetAddresses()) ) ); } } catch(Exception e) { EzimLogger.getInstance().severe(e.getMessage(), e); Ezim.exit(1); } }
1ac9c5fe-6597-4801-8ac5-f2e587d06303
4
public static Solucao eliminarRedundancia(Solucao solucao){ Multimap<Float, Integer> colunas = TreeMultimap.create(); for(Coluna coluna : solucao.getColunas()){ Float custo = coluna.getCusto(); colunas.put((custo*(-1)), coluna.getNome()); } Solucao testarsolucao = new Solucao(solucao); for(Float chave : colunas.keySet()){ Iterator iterador = colunas.get(chave).iterator(); while(iterador.hasNext()){ Solucao testar = new Solucao(testarsolucao); Coluna maiorcoluna = testarsolucao.getLinhasX().get(iterador.next()); testar.getLinhasCobertas().clear(); cobrirLinhas(maiorcoluna, testar); if(testar.getLinhasCobertas().size()==testar.getQtdeLinhas()){ testar.getColunas().remove(maiorcoluna); testar.setCustototal(testar.getCustototal()-maiorcoluna.getCusto()); testarsolucao = testar; } } } return testarsolucao; }
21039797-7a1a-4c49-a469-9496bd917e84
6
@EventHandler public void PlayerSlow(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.getPlayerConfig().getDouble("Player.Slow.DodgeChance") / 100; final double ChanceOfHappening = random.nextDouble(); if (ChanceOfHappening >= randomChance) { dodged = true; } if (plugin.getPlayerConfig().getBoolean("Player.Slow.Enabled", true) && damager instanceof Player && e instanceof Player && plugin.getConfig().getStringList("Worlds").contains(world) && !dodged) { Player player = (Player) e; player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, plugin.getPlayerConfig().getInt("Player.Slow.Time"), plugin.getPlayerConfig().getInt("Player.Slow.Power"))); } }
c696b8f9-31cd-4fda-847a-1ed5067f218b
2
public void redo() { if (!redo.empty()) { ArrayList<Delta> toDo = redo.pop(); for (Delta d : toDo) { d.unundo(colorArr); } undo.push(toDo); } }
28d12c45-dc73-4a8b-82c7-6155a7081bc3
2
public void init() throws IOException{ if(targetDirs.size() == 0){ logger.error("No target is set"); return; } this.filesInTargetsNotInSource = new ArrayList<ArrayList<Path>>(); this.filesInSourceNotInTargets = new ArrayList<ArrayList<Path>>(); for(Path targetDir : targetDirs){ this.filesInTargetsNotInSource.add(collectRelativeFilesInSrc1NotPresentInSrc2(targetDir,sourceDir)); this.filesInSourceNotInTargets.add(collectRelativeFilesInSrc1NotPresentInSrc2(sourceDir,targetDir)); } }
56f818ad-07f0-4fca-819a-819282b6e38c
5
@Test public void getBillLinesByStudentTest() throws InstanceNotFoundException { Calendar cb3 = Calendar.getInstance(); Booking b3 = new Booking(cb3, familyService.findStudent(0), bookingService.findDiningHall(0)); HashSet<Activity> activityForS = new HashSet<Activity>(); HashSet<Booking> bookingForS = new HashSet<Booking>(); activityForS.add(activityService.find(0)); activityForS.add(activityService.find(1)); bookingForS.add(b3); familyService.findStudent(0).setActivities(activityForS); familyService.findStudent(0).setBookings(bookingForS); familyService.findStudent(1).setActivities(activityForS); Household hh = null; try { hh = familyService.findHousehold(0); } catch (InstanceNotFoundException e) { fail("Household not found"); } billService.createBill(hh); assertEquals(1, hh.getBills().size()); ArrayList<Bill> ar = new ArrayList<Bill>(); ar.addAll(hh.getBills()); HashSet<BillLine> hs = null; HashSet<BillLine> hs2 = null; try { hs = (HashSet<BillLine>) billService.getBillLinesByStudent( ar.get(0), familyService.findStudent(0)); hs2 = (HashSet<BillLine>) billService.getBillLinesByStudent( ar.get(0), familyService.findStudent(1)); } catch (InstanceNotFoundException e1) { fail("Student not found"); } Iterator<BillLine> irl = hs.iterator(); Iterator<BillLine> irl2 = hs2.iterator(); int count = 0; while (irl.hasNext()) { count += irl.next().getUnits(); } while (irl2.hasNext()) { count += irl2.next().getUnits(); } try { //This +2 is because two activities need license. assertEquals(familyService.findStudent(0).getActivities().size() + familyService.findStudent(0).getBookings().size() + familyService.findStudent(1).getActivities().size() + familyService.findStudent(1).getBookings().size()+2, count); } catch (InstanceNotFoundException e) { fail("Student not found"); } }
2103fc9d-b5fb-4df1-b7fa-470546b99474
2
public void update() { for (GameObject obj : myObjects) { obj.update(); } for (GameObject obj : objects) { obj.update(); } }
30278bae-dae4-41b8-8b98-816396d0d3f4
9
public static void main(String args[]) throws Throwable { primes[0]=primes[1]=true; for(int i=0,c=0;i<MAX;i++) if(!primes[i]) { if(c<MAX_PRIMES) lstPrimes[c++]=i; for(int j=i+i;j<MAX;j+=i) primes[j]=true; } int MAX_SOL=10001; int[] euler=new int[MAX_SOL]; for(int i=0;i<MAX_SOL;i++) euler[i]=(isPrime(i*i+i+41)?1:0)+(i>0?euler[i-1]:0); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); for (String ln;(ln=in.readLine())!=null;) { StringTokenizer st=new StringTokenizer(ln); int A=parseInt(st.nextToken()),B=parseInt(st.nextToken()); System.out.printf(Locale.US,"%.2f\n",100.*(euler[B]-(A>0?euler[A-1]:0))/(B-A+1)); } }
f8922213-4e71-47d2-8b44-df9cba741db1
8
public void setStrokeParts(float w, int cap, int join, float limit, float[] ary, float phase) { if (w == NOWIDTH) { w = state.stroke.getLineWidth(); } if (cap == NOCAP) { cap = state.stroke.getEndCap(); } if (join == NOJOIN) { join = state.stroke.getLineJoin(); } if (limit == NOLIMIT) { limit = state.stroke.getMiterLimit(); } if (phase == NOPHASE) { ary = state.stroke.getDashArray(); phase = state.stroke.getDashPhase(); } if (ary != null && ary.length == 0) { ary = null; } if (phase == NOPHASE) { state.stroke = new BasicStroke(w, cap, join, limit); } else { state.stroke = new BasicStroke(w, cap, join, limit, ary, phase); } }
9bff5e1c-83ec-46ec-9757-a8bf1d97ac8a
3
@Override public ArrayList<String> getTerminationSprites() { ArrayList<String> result = new ArrayList<String>(); if(stype1 != null) result.add(stype1); if(stype2 != null) result.add(stype2); if(stype3 != null) result.add(stype3); return result; }
5890b75c-6ce9-4ad0-a532-abfeeda194fe
0
public Boolean isUsed() { return used; }
baf10b8c-7a5c-438a-9b4b-b957868f6e3a
9
public void run(){ //System.err.println(this+":run >"); Buffer buf=new Buffer(rmpsize); Packet packet=new Packet(buf); int i=-1; try{ while(isConnected() && thread!=null && io!=null && io.in!=null){ i=io.in.read(buf.buffer, 14, buf.buffer.length-14 -Session.buffer_margin ); if(i==0)continue; if(i==-1){ eof(); break; } if(close)break; //System.out.println("write: "+i); packet.reset(); buf.putByte((byte)Session.SSH_MSG_CHANNEL_DATA); buf.putInt(recipient); buf.putInt(i); buf.skip(i); getSession().write(packet, this, i); } } catch(Exception e){ //System.err.println("# ChannelExec.run"); //e.printStackTrace(); } Thread _thread=thread; if(_thread!=null){ synchronized(_thread){ _thread.notifyAll(); } } thread=null; //System.err.println(this+":run <"); }
962038e7-c8c2-4b53-9bd0-ef1e683015e5
0
public String getName() { return name; }
e268cf2f-3689-4393-bc41-f846da4869eb
3
private void refreshTable() { if (modelHR.getRowCount() > 0) { for (int i = modelHR.getRowCount() - 1; i > -1; i--) { modelHR.removeRow(i); } } try { populateTable(); } catch (Throwable e) { // TODO Auto-generated catch block e.printStackTrace(); } }
ea08df2f-91ac-404c-a57d-03c55f2deabd
9
public ChessPanel() { super(); this.mainPanel.setLayout(null); this.setContentPane(this.mainPanel); this.initBackground(this.mainPanel); this.initBlockLabel(this.mainPanel); this.mainPanel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { Component item = mainPanel.getComponentAt(e.getPoint()); if (item == null || !(item instanceof BoardBlockLabel)) { return; } BoardBlock block = ((BoardBlockLabel) item).getMode(); if (board.getSelectedBlock() != null) { board.moveTo(block.getPos()); } else if (!block.isBlank()) { board.setSelectedBlock(block); } } }); this.board.addListener(new ChessBoard.BoardListener() { @Override public void reset(ChessBoard board) { repaint(); } @Override public void move(Point from, Point to) { if (moveMark[0] != null) { moveMark[0].setMarked(false); } moveMark[0] = labels[from.y][from.x]; if (moveMark[1] != null) { moveMark[1].setMarked(false); } moveMark[1] = labels[to.y][to.x]; moveMark[0].setMarked(true); moveMark[1].setMarked(true); } }); this.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { char c = e.getKeyChar(); if (c == 'r') { loadRecord(record); } if (c == 'd') { nextStepInRecord(); } if (c == 'a') { stepBack(); } } }); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.pack(); this.setLocationRelativeTo(null); }
228bda3a-6401-44a8-8320-edd92ea903dd
4
protected void redirectToCo(String[] validatedInput, HttpServletResponse resp) throws IOException { // エンコード。"(" と ")" を戻している。 // 前工程で正規化が済んでいる点に注意。 String encodedInput1 = URLEncoder.encode(validatedInput[1], "utf-8") .replaceAll("%28", "(").replaceAll("%29", ")"); String encodedInput2 = URLEncoder.encode(validatedInput[2], "utf-8") .replaceAll("%28", "(").replaceAll("%29", ")"); // 以下のリダイレクトルールは、 // あくまで前工程で "リダイレクトが必要" と判定された上での物であり // 例えば、入力チェックする前からいきなり使うみたいなことはできない。 if (validatedInput[1].isEmpty() && validatedInput[2].isEmpty()) { // 両方とも空 resp.sendRedirect("/"); } else if (validatedInput[1].isEmpty()) // input[1] が空 resp.sendRedirect("/co?n=" + encodedInput2); else if (validatedInput[2].isEmpty()) // input[2] が空 resp.sendRedirect("/co?n=" + encodedInput1); else // 両方とも正規化済みのinput resp.sendRedirect("/co?n=" + encodedInput1 + "&m=" + encodedInput2); }
bbd7a2a3-c89a-409c-96ac-5b1cc029eb4a
3
public void paint(Graphics g) { switch (player.dir) { case 1: g.drawImage(image, player.getX()+30, player.getY()+15, player.gameScreen); break; case 2: g.drawImage(image, player.getX()+3, player.getY()+15, player.gameScreen); break; case 3: g.drawImage(image, player.getX()-5, player.getY()+15, player.gameScreen); break; default: break; } }
b44f553e-7385-469f-ae77-510e40db4a8b
4
public void remove(Packet p) { if(!activePackets.remove(p)) { if(!passivePackets.remove(p)) { // The packet was in neither list return; // nothing changed, the interference did not change } } if(Configuration.asynchronousMode && !Configuration.interferenceIsAdditive) { testForInterference(); } }
ae9c959f-352e-48a7-83ac-376e6c800820
5
public void keyPressed(KeyEvent e){ if (e.getKeyChar() >= '0' && e.getKeyChar() <= '9'){ if (answerLabel.getText() != ""){ answerLabel.setText(answerLabel.getText() + String.valueOf(e.getKeyChar())); } else{ answerLabel.setText(String.valueOf(e.getKeyChar())); } if(Integer.valueOf(answerLabel.getText()) == challenger.Answer()){ answerLabel.setText(""); challenger = null; challenger = new Challenger(0, 10, Operator.Addition, Type.Integer); questionLabel.setText(challenger.Question()); } } else{ if (e.getKeyCode() == 27){ answerLabel.setText(""); } } }
26a233d1-40c9-4a07-902f-ae93222a770d
7
@Override public Success<Expression> parse(String s, int p) { // Parse the '{'. if (s.charAt(p++) != '{') return null; p = optWS(s, p); // Handle empty sequences. if (s.charAt(p) == '}') return new Success<Expression>(new LiteralSequence(Expression.NONE), p + 1); // Parse the first element. List<Expression> elements = new ArrayList<Expression>(); Success<Expression> resElem = ExpressionParser.singleton.parse(s, p); if (resElem == null) throw new NiftyException("Failed to parse first element of literal sequence."); elements.add(resElem.value); p = resElem.rem; p = optWS(s, p); // Parse any following elements. for (;;) { // Parse the comma. if (s.charAt(p) != ',') break; p = optWS(s, p + 1); // Parse the next element. resElem = ExpressionParser.singleton.parse(s, p); if (resElem == null) throw new NiftyException("Expecting another expression after ',' in literal sequence."); elements.add(resElem.value); p = resElem.rem; p = optWS(s, p); } // Parse the '}'. if (s.charAt(p++) != '}') throw new NiftyException("Could not find end of literal sequence."); Expression result = new LiteralSequence(elements.toArray(new Expression[elements.size()])); return new Success<Expression>(result, p); }
cd6f70c2-0c22-44c2-b0b1-57ab15645f71
0
public String getGame() { return game; }
9085f82d-b902-4fcc-a71e-0fa6026a0486
1
public void setRemoteTarget(String remoteIP, int targetPacketRate) { try { ipAddr = InetAddress.getByName(remoteIP); packetRate = targetPacketRate; } catch (Exception e) { System.out.println(e.toString()); } }
7b237242-cd7f-4530-b5a4-2dac888872e0
4
private String createPlayersJson(List<OfflinePlayer> players) { StringBuilder json = new StringBuilder(); json.append("["); for (OfflinePlayer player : players) { if (player instanceof Player) { json.append(createPlayerJson((Player)player)).append(","); } else if (!player.isOnline()) { json.append(createPlayerJson(player)).append(","); } } // Remove the last comma int index = json.lastIndexOf(","); if (index > -1) { json.deleteCharAt(index); } json.append("]"); return json.toString(); }
d6cbdc63-26be-41c8-9bfd-8f8b957e6bc3
9
public void testMetaVariables() { System.out.println(); String[] testStrings = { ":X", ":XX", ":X-X", ":ABC-234", ":ABC-ABC", ":UIO-123-UIO", ":a"}; String[] testsThatShouldFail = { ":-", "::234", "", "XX", "qawerpiouasdf", "::", "::X", ":1", ":.", ":@", ":!", ":234a2354dsf", ":234-ABC", "::234-ABC" }; java.io.Reader reader = null; try { for (int j = 0; j < 2; j++) { if (j==0) { System.out.println("!!!!!!!!!!!!!!!!! These tests should succeed. !!!!!!!!!!!!!!!!!"); } else { System.out.println("!!!!!!!!!!!!!!!!! These tests should fail. !!!!!!!!!!!!!!!!!"); testStrings = testsThatShouldFail; } for (int i = 0; i < testStrings.length; i++) { try { String curTest = testStrings[i]; System.out.println("Input: " + curTest); reader = new java.io.StringReader(curTest); parser.ReInit(reader); Object result = parser.metaVariable(true); if (result == null) { System.out.println("Output: " + result); } else { System.out.println("Output: " + DefaultCycObject.cyclify(result) + " of type: " + result.getClass() + "."); } if (j == 0) { Assert.assertNotNull(result); Assert.assertTrue(result instanceof CycVariable); } else { Assert.fail(); } } catch (AssertionFailedError afe) { afe.printStackTrace(System.out); throw afe; } catch (Throwable e) { if (j == 0) { e.printStackTrace(System.out); Assert.assertNotNull(null); } else { System.out.println("Output: "); e.printStackTrace(System.out); } } finally { System.out.println(); } } } } catch (Exception e) { e.printStackTrace(); } }
f6d50b04-f97e-4a8c-b7b9-ea9619d78ffd
6
public DiceTaskXmlDriver(String xmlStr) throws DocumentException, XmlTypeErrorException { super(); if (!isDiceTaskXml(xmlStr)) { throw new XmlTypeErrorException("not a valid diceTask Xml"); } document = DocumentHelper.parseText(xmlStr); timestamp = document.selectSingleNode("//properties/timestamp") .getText(); fromCubeIdentifier = document.selectSingleNode( "//properties/operation/from").getText(); Element root = this.document.getRootElement(); List<?> list = root .selectNodes("//properties/operation/conditions/condition"); String dimensionName; final String levelName = ""; String start; String end; ConditionBean conditionBean; Node tmpNode; for (Iterator<?> iter = list.iterator(); iter.hasNext(); ) { Node node = (Node) iter.next(); dimensionName = node.selectSingleNode("dimensionName").getText(); if (null == (tmpNode = node.selectSingleNode("start"))) { start = ""; } else { start = tmpNode.getText(); } if (null == (tmpNode = node.selectSingleNode("end"))) { end = ""; } else { end = tmpNode.getText(); } conditionBean = new ConditionBean(dimensionName, levelName, start, end); conditionBeans.add(conditionBean); } }
d9f1e9bd-8e5e-4890-9c9d-a834cc538dc0
5
@Override public void addRecord( BiffRec rec, int[] rc ) { // check to see if there is a BiffRec already at the address add the rec to the Cell, // set as value if it's a val type rec rec.setSheet( this );// create a new BiffRec if none exists rec.setRowCol( rc ); rec.setIsValueForCell( true ); rec.setStreamer( streamer ); rec.setWorkBook( getWorkBook() ); if( !fastCellAdds ) { Row ro; ro = rows.get( rc[0] ); if( ro == null ) { ro = addNewRow( rec ); } } if( copypriorformats && !fastCellAdds ) { copyPriorCellFormatForNewCells( rec ); } try { addCell( (CellRec) rec ); } catch( ArrayIndexOutOfBoundsException ax ) { log.error( "Boundsheet.addRecord() failed. Column " + rc[1] + " is greater than Maximum column count" ); throw new InvalidRecordException( "Adding cell failed. Column " + rc[1] + " is greater than the maximum column limit." ); } }
3c401537-af73-48ff-bd09-0aeb704efb44
3
public Dimension getPreferredSize() { int x = 0, y = 0; for (int i = 0; i < zelements.size(); i++) { x = getElement(i).getX() + getElement(i).getWidth() > x ? getElement( i).getX() + getElement(i).getWidth() : x; y = getElement(i).getY() + getElement(i).getHeight() > y ? getElement( i).getY() + getElement(i).getHeight() : y; } return new Dimension(x + 30, y + 30); }
0e67a34c-0a8c-4bec-bb0c-3cc2d07c0f68
7
private String addContent(String content, boolean isHtml, String nodeContent, boolean isHtmlNode) { if (isHtml) { final String start[] = BODY_END.split(content, -2); content = start[0]; if (!isHtmlNode) { final String end[] = BODY_START.split(content, 2); nodeContent = end[0] + "<body><p>" + nodeContent + "</p>"; } } if (isHtmlNode & !content.equals("")) { final String end[] = BODY_START.split(nodeContent, 2); nodeContent = end[1]; if (!isHtml) { content = end[0] + "<body><p>" + content + "</p>"; } } if (!(isHtml || isHtmlNode || content.equals(""))) { content += " "; } content += nodeContent; return content; }
6df6f302-0950-4002-90fd-1c7a762ee621
9
void compress(int init_bits, OutputStream outs) throws IOException { int fcode; int i /* = 0 */; int c; int ent; int disp; int hsize_reg; int hshift; // Set up the globals: g_init_bits - initial number of bits g_init_bits = init_bits; // Set up the necessary values clear_flg = false; n_bits = g_init_bits; maxcode = MAXCODE(n_bits); ClearCode = 1 << (init_bits - 1); EOFCode = ClearCode + 1; free_ent = ClearCode + 2; a_count = 0; // clear packet ent = nextPixel(); hshift = 0; for (fcode = hsize; fcode < 65536; fcode *= 2) ++hshift; hshift = 8 - hshift; // set hash code range bound hsize_reg = hsize; cl_hash(hsize_reg); // clear hash table output(ClearCode, outs); outer_loop : while ((c = nextPixel()) != EOF) { fcode = (c << maxbits) + ent; i = (c << hshift) ^ ent; // xor hashing if (htab[i] == fcode) { ent = codetab[i]; continue; } else if (htab[i] >= 0) // non-empty slot { disp = hsize_reg - i; // secondary hash (after G. Knott) if (i == 0) disp = 1; do { if ((i -= disp) < 0) i += hsize_reg; if (htab[i] == fcode) { ent = codetab[i]; continue outer_loop; } } while (htab[i] >= 0); } output(ent, outs); ent = c; if (free_ent < maxmaxcode) { codetab[i] = free_ent++; // code -> hashtable htab[i] = fcode; } else cl_block(outs); } // Put out the final code. output(ent, outs); output(EOFCode, outs); }
62bcd007-9552-468d-a165-5ecb9ae861be
6
private void kasitteleSeuraava() throws IllegalStateException, IllegalArgumentException { if (seuraavanaLuku()) { kasitteleLuku(); } else if (seuraavanaNegatiiviMiinus()) { kasitteleNegatiiviMiinus(); } else if (seuraavanaLaskutoimitus()){ kasitteleLaskutoimitus(); } else if (seuraavanaFunktio()) { kasitteleFunktio(); } else if (syote.substring(paikka, paikka + 1).equals("(")) { lauseke.avaaUusiLohko(); paikka++; } else if (syote.substring(paikka, paikka + 1).equals(")")) { lauseke.suljeLohko(); paikka++; } else { throw new IllegalStateException(); } }
900b9d3c-9117-48af-a5c0-4bb2f277e35d
2
private void declareFrameTypes(final int n, final Object[] o) { for (int i = 0; i < n; ++i) { if (o[i] instanceof Label) { declareLabel((Label) o[i]); } } }
da65e449-822b-45f4-8f37-a8fc535f5236
0
public AbstractOutlinerMenuItem() { }
6a7c9854-8a16-444d-a33e-e54b054b5a91
0
public void setRegion(String region) { this.region = region; }
37d71e05-6e0f-45af-97c4-cb18cb92b1e4
8
public void paint( Graphics graphics ) { Dimension size = size(); graphics.setColor( getBackground() ); switch ( type ) { case SOLID: graphics.setColor( getForeground() ); for ( int i = 0; i < thickness; ++i ) graphics.drawRect( i, i, size.width - i * 2 - 1, size.height - i * 2 - 1 ); break; case RAISED: for ( int i = 0; i < thickness; ++i ) graphics.draw3DRect( i, i, size.width - i * 2 - 1, size.height - i * 2 - 1, true ); break; case LOWERED: for ( int i = 0; i < thickness; ++i ) graphics.draw3DRect( i, i, size.width - i * 2 - 1, size.height - i * 2 - 1, false ); break; case IN: graphics.draw3DRect( 0, 0, size.width - 1, size.height - 1, false ); graphics.draw3DRect( thickness - 1, thickness - 1, size.width - thickness * 2 + 1, size.height - thickness * 2 + 1, true ); break; case OUT: graphics.draw3DRect( 0, 0, size.width - 1, size.height - 1, true ); graphics.draw3DRect( thickness - 1, thickness - 1, size.width - thickness * 2 + 1, size.height - thickness * 2 + 1, false ); break; } }
ac1d9082-60df-4fe8-abc3-fcab1b634cb8
5
public static void ReadFromFile(String fileName){ BufferedReader br = null; try{ br = new BufferedReader(new FileReader(fileName)); String line = null; while((line = br.readLine()) != null){ HashMap<Integer, ArrayList<Double>> geneEntry = new HashMap<Integer, ArrayList<Double>>(); ArrayList<Double> gene = new ArrayList<Double>(); String[] values = line.split("\t"); if(Integer.parseInt(values[1]) > -1){ externalIndex.put(Integer.parseInt(values[0]), Integer.parseInt(values[1])); for(int i = 2; i < values.length; i++){ gene.add(Double.parseDouble(values[i])); } geneEntry.put(Integer.parseInt(values[0]), gene); geneList.add(geneEntry); } } br.close(); }catch(FileNotFoundException e1){ // TODO Auto-generated catch block e1.printStackTrace(); }catch(IOException e){ // TODO Auto-generated catch block e.printStackTrace(); } }
f33221cb-05d6-4422-908f-0a09feb53598
5
public int untransform(int info){ if(info==InteractivePanel.UP) return properties.getUpCtrl(); else if(info==InteractivePanel.LEFT) return properties.getLeftCtrl(); else if(info==InteractivePanel.RIGHT) return properties.getRightCtrl(); else if(info==InteractivePanel.SHOOT) return properties.getShootCtrl(); else if(info==InteractivePanel.POWER) return properties.getPowerCtrl(); return info; }
c3bfc033-28cd-4860-a69a-6fe5d541bbcc
2
public void setTableModel(TableModel tableModel) { if (this.tableModel != null) { this.tableModel.removeTableModelListener(tableModelListener); } this.tableModel = tableModel; if (this.tableModel != null) { this.tableModel.addTableModelListener(tableModelListener); } clearSortingState(); fireTableStructureChanged(); }
329298e9-78bf-4178-9a43-7d083bebb27f
2
public void loadPropertiesFromFile(File fileName) throws IOException { FileInputStream in = new FileInputStream(fileName); Properties properties = new Properties(); properties.loadFromXML(in); int x1 =(new Integer(properties.getProperty("x1"))); int y1 =(new Integer(properties.getProperty("y1"))); int r1 =(new Integer(properties.getProperty("r1"))); int x2 =(new Integer(properties.getProperty("x2"))); int y2 =(new Integer(properties.getProperty("y2"))); int r2 =(new Integer(properties.getProperty("r2"))); int n =(new Integer(properties.getProperty("n"))); if (canSetXY(x1, y1, x2, y2, r1, r2)){ setX1(x1); setX2(x2); setY1(y1); setY2(y2); setR1(r1); setR2(r2); setN(n); } try{ setPanelWidth(new Integer(properties.getProperty("PanelWidth"))); setPanelHeight(new Integer(properties.getProperty("PanelHeight"))); } catch (Exception e){ } in.close(); }
f88ab090-071b-486e-ad56-fc0600c8dcb5
6
public void initialisation(final int[][] keysTable) throws KeyTableSizeException, KeyValueException { if (keysTable.length != xSize || keysTable[0].length != ySize) { throw new KeyTableSizeException(); } else { for (int i = 0; i < xSize; ++i) { for (int j = 0; j < ySize; ++j) { switch (keysTable[i][j]) { case Game.SEA_KEY: squares[i][j] = new SeaSquare(i, j, SquareType.SEA); break; case Game.LAND_KEY: squares[i][j] = new LandSquare(i, j, SquareType.LAND); break; default: throw new KeyValueException(); } } } } }
caa3ccc4-a08d-4450-ac66-283ad626dcf1
7
* @return boolean */ public static boolean trueP(Proposition self) { { TruthValue truthvalue = ((TruthValue)(Stella_Object.accessInContext(self.truthValue, self.homeContext, false))); if (truthvalue == Logic.TRUE_TRUTH_VALUE) { return (true); } else if (truthvalue == Logic.DEFAULT_TRUE_TRUTH_VALUE) { if (!((Boolean)(Logic.$DONTUSEDEFAULTKNOWLEDGEp$.get())).booleanValue()) { return (true); } } else if ((truthvalue != null) && ((truthvalue.polarity == Logic.KWD_TRUE) && ((!((Boolean)(Logic.$DONTUSEDEFAULTKNOWLEDGEp$.get())).booleanValue()) || (truthvalue.strength == Logic.KWD_STRICT)))) { return (true); } return (false); } }
83924542-d224-4f64-b31e-b33a6b4c34fa
3
private boolean isFriendOrSelf(String name) { if (name == null) { return false; } for (int i = 0; i < friendsCount; i++) { if (name.equalsIgnoreCase(friendsNames[i])) { return true; } } return name.equalsIgnoreCase(Client.myPlayer.name); }