method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0f23df15-e4a3-48f7-a3b2-b55db0c3f0a0
2
private boolean isSkill(final String checkSkill) { for (String skill : SKILLS) { if (skill.equalsIgnoreCase(checkSkill)) return true; } return false; }
6dbb5dcf-b945-4923-915a-03b7b16f746f
2
public String createMessage(String forumId, String subForumId, User user, String title, String content) { Forum forum = this.getForum(forumId); if (forum != null) { SubForum subforum = forum.getSubForumById(subForumId); if (subforum != null) return subforum.createMessage(user, title, content); } re...
501eec7c-213e-474a-b3e0-f9dcaf33f089
6
private void initUsermenuImageMenu(Color bg) { this.usermenuImageMenu = new JPanel(); this.usermenuImageMenu.setBackground(bg); this.usermenuImageMenu.setLayout(new VerticalLayout(5, VerticalLayout.LEFT)); // size int[] size = new int[] { this.skin.getUsertileImageWidth(), this....
16354ed0-4269-4373-baca-d7c49bb8ce63
8
private boolean isFullHouse(ArrayList<Card> player) { ArrayList<Integer> sortedHand=sortHand(player); int doubleCounter=0; int tripleCounter=0; for(int i=0;i<player.size()-1;i++) { if(sortedHand.get(i)==sortedHand.get(i+1)) { if(tripleCounter==1) { sortedHand.remove(i+1); sortedHand.remove(i); ...
d9a2be8a-40d0-4055-bbe1-8aef6296290f
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 Utilisateur)) { return false; } Utilisateur other = (Utilisateur) object; if ((this.mail == null && other.mail ...
64521956-5402-4eb2-ac51-626f8b92f481
5
private void actionBtStart() { // test de source et dest if(dirSource==null) { JOptionPane.showMessageDialog(null, "Veuillez sélectionner un dossier SOURCE.", "ERREUR",JOptionPane.ERROR_MESSAGE); return; } if(!(new File(dirSource.getPath())).isDirectory()) // cas où le dossier est suppr par le user...
75fa0669-7206-4334-a307-d69f651b6a19
2
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { RequestDispatcher rd = null; try { producten.changeMinVoorraad(Integer.parseInt(req.getParameter("onderdeelId")), Integer.parseInt(req.getParameter("minVoorraad"))); } catch (SQLException e)...
8bafc16c-90b3-45fd-a1a4-7118fa9426ea
1
public double bonusDefense(Territoire t, Peuple attaquant) { return t.has(Laboratoire.class) ? 2.0 : 0.0; }
757f2986-ae50-4cac-afaf-b077bc00673a
9
public static void floodfill(Room r, int x, int y) { if(x < 0 || x >= h) { return; } if(y < 0 || y >= w) { return; } if(roomA[x][y] == null) { roomA[x][y] = r; r.incrementSize(); // west wall if(castle[x][y]%2 == 0) { floodfill(r, x, y-1); } // north wall if((castle[x][y]/2)%2 == 0) { ...
82b9b646-98c3-4a3d-9015-66c543779654
1
public void testConstructor_Object2_Chronology() throws Throwable { LocalTime test = new LocalTime("T10:20"); assertEquals(10, test.getHourOfDay()); assertEquals(20, test.getMinuteOfHour()); assertEquals(0, test.getSecondOfMinute()); assertEquals(0, test.getMillisOfSecond()); ...
297f0569-d1af-417b-8fca-c513d7197a87
9
private boolean r_Step_4() { int among_var; int v_1; // (, line 140 // [, line 141 ket = cursor; // substring, line 141 among_var = find_among_b(a_7, 18); if (among_var == 0) ...
f5556184-438f-4493-b2dc-b3f3c5959091
3
public synchronized void saveAllImages() { if (history.isEmpty()) { System.out.println("No images to save"); return; } JFileChooser jfc = new JFileChooser(); jfc.setCurrentDirectory(new java.io.File(".")); jfc.setDialogTitle("Choose a Directory"); jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY...
056ad4af-e697-466c-9600-baca5d5c79ff
8
public void optimizeParam(int numItns) { assert wordTopicHist != null; // update histograms int njMax = wordTopicCountsNorm[0]; for (int j=1; j<T; j++) if (wordTopicCountsNorm[j] > njMax) njMax = wordTopicCountsNorm[j]; wordTopicNormHist = new int[njMax + 1]; for (int j=0; j<...
de6f3b5b-7368-4621-8683-5a3233a64730
9
void RendreVelo(Utilisateur user) { Velo velo = null; for (Velo s : ConfigGlobale.velos) { if (s.getId_velo() == user.getFk_id_velo()) { velo = s; break; } } ArrayList<Borne> listeBorneStation = new ArrayList<Borne>(); Ite...
72427f8e-680c-4534-af64-92cab62261f4
4
public static <T> boolean contains( final T[] array, final T v ) { for ( final T e : array ) if ( e == v || v != null && v.equals( e ) ) return true; return false; }
9549bce6-12fb-414b-9b16-3bc5f72739b6
3
private BigDecimal processBudgetItemsList(Budget budget, List<? extends BudgetItem> budgetItems) throws BudgetItemsMissingException { if(budget.getCoreBudgetItemList() != null && budget.getSocialBudgetItemList() != null) { return calculateTotalBudgetItems(budgetItems); } else { ...
57daa6e4-1b02-4052-94ec-06803c8fd4fa
2
private ArrayList<Tilausrivi> paivitaTuote(HttpServletRequest request, ArrayList<Tilausrivi> tilausrivit) { // otetaan vastaan tuotteen muokattavat tiedot int tilausriviNumero = Integer.parseInt(request.getParameter("btn").substring(5)); int kplmaara = Integer.parseInt(request.getParameter("kpl-maara")); ...
6cbf2295-fba7-4c64-ad87-67e7246eec7e
9
public final static boolean isArchiveFileName(String name) { int nameLength = name == null ? 0 : name.length(); int suffixLength = SUFFIX_JAR.length; if (nameLength < suffixLength) return false; // try to match as JAR file for (int i = 0; i < suffixLength; i++) { char c = name.charAt(nameLength - i - 1); ...
486924ac-07c3-44e7-93d3-e7633bce3f82
4
public static Date getDateFromRange(String dropdownValue) { if (dropdownValue == null) { throw new IllegalArgumentException("Logic Error: input argument may not be null"); } int nDays = -1; for (Range d : dateRanges) { if (dropdownValue.equals(d.choiceValue)) { nDays = d.days; break; } } if...
b37dc0d3-2204-4e96-8bd6-acf0f682f7f3
4
@Override final public void compute() { // // reset time. // final int last = this.frameidx; this.setFrameIdx(0); // for (int t = 0; t <= last; t++) { // if (t > 0) { this.copyOutput(this.frameidx - 1, this.frameidx); ...
4cbb522e-32d9-4b42-95b1-f0b322c2e346
2
private void writeMsgLength(OutputStream out) throws IOException { int msgLength = messageLength(); int val = msgLength; do { byte b = (byte) (val & 0x7F); val >>= 7; if (val > 0) { b |= 0x80; } out.write(b); } while (val > 0); }
2b16e969-8487-40d0-8417-7b4066904fcb
4
void parstt() { double[] xMax = new double[numOfParams]; double[] xMin = new double[numOfParams]; double[] xMean = new double[numOfParams]; double delta = Math.pow(10, -20); // double delta = 10E-20; double peps = Math.pow(10, -3); // minimum standard deviation // d...
c16d8947-a368-43be-9634-cc6e7fe775af
1
private void endFormals() { if (hasFormals) { hasFormals = false; buf.append('>'); } }
2cc48e76-5f33-46c9-8c79-ca664e0bd959
7
@Override protected boolean hasRightNumberOfPieces(Map<PieceType, Integer> redPieceCount, Map<PieceType, Integer> bluePieceCount) { int redOffby = 0; int blueOffby = 0; for(PieceType piece : validPieceCount.keySet()) { int requiredNumber = validPieceCount.get(piece); Integer redCount = redPieceCou...
622295e8-2b0b-450b-917e-6c28c3b95823
4
private int findNextStartIndex(String[] words, int start, int L, List<String> lines) { // find end index for a line int i = start; List<String> lineWords = new ArrayList<String>(); int len = 0; while (len < L && i < words.length) { String word = words[i]; ...
0e22f653-e69d-4d3a-8273-29ec760f0858
8
public ArrayList<String> search(String title){ boolean find = false; byte count = 0; ArrayList<String> res = new ArrayList<String>(); ArrayList<String> html=null; try { html = getHTML("http://www.lyricsmania.com/searchnew.php?k="+URLEncoder.encode(title,"UTF-8")+"&x=0&y=0");//"http://webservices.lyrdb...
3b75a3eb-d86e-4499-9db2-d7512c5ec4b4
5
private List<LastFMEventMetaData> processingSearchResults( JSONObject response) { JSONObject responseEvents = (JSONObject) response.get("events"); List<LastFMEventMetaData> container = new ArrayList<LastFMEventMetaData>(); if (responseEvents.containsKey("event") && responseEvents.containsKey("event")) { ...
2477c16f-effc-4a9c-a770-b42d40eb100d
4
public JSONObject apiHome(String endpoint, String urlParameters, String method){ String YOUR_REQUEST_URL = "http://chicosystems.com:3000/api/"+endpoint; // String YOUR_REQUEST_URL = "http://chicosystems.com:3000/api/imgurdl/adduse"; URL imgURL; String os = System.getProperty("os.name"); String ver = ge...
2b3bc109-c239-4585-af4b-4c4eb75b9467
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(ID())!=null) { mob.tell(target,null,null,L("<S-NAME> <S-IS-ARE>...
308e729e-9fb5-46cd-ba94-b93fefadc987
3
public int binair_zoeken(char target) { int top = rij.length -1; //Maximale arry index positie of maximale positie na een breuk int bottom = 0; //start positie of laagste positie na een breuk while (bottom <= top) // zolang de bottom waarde kleiner is dan top waarde herhaalt de loop zich. ...
2d2b237f-2236-439f-83a1-94dcb3a3ef54
5
private void checkFilename(String filename, int len) throws BadHttpRequest { for (int i = 0; i < len; ++i) { char c = filename.charAt(i); if (!Character.isJavaIdentifierPart(c) && c != '.' && c != '/') throw new BadHttpRequest(); } if (filenam...
604c89f5-3506-4dad-afe1-160a83302e84
2
private List<AchievementRecord> readAchievements(InputStream in) throws IOException { int achievementCount = readInt(in); List<AchievementRecord> achievements = new ArrayList<AchievementRecord>(achievementCount); for (int i = 0; i < achievementCount; i++) { String achName = readString(in); int diff...
75ed4ffe-00fe-4300-b594-c587f276fec2
1
public static void listDatabase() { for(String s : database) { System.out.println(s); } }
f2bdedca-d68f-4762-85ad-215bf21d1a4b
3
public DuplexLink get_link(int port) { if (this.links.containsValue(port)) { Iterator<DuplexLink> itr = this.links.keySet().iterator(); while (itr.hasNext()) { DuplexLink link = itr.next(); if (this.links.get(link) == port) return link; } } return null; }
12189be7-c88e-496a-adfd-a084170704a7
3
public void deleteElement(ValueType value) throws NotExistException { ListElement<ValueType> previous = head; ListElement<ValueType> current = head.next; if (exist(value)) { while (current != tail.next) { if (current.value == value) { previous.next...
4037789b-013a-4af8-9966-f9bb3d86df64
3
public void setString(PString node) { if(this._string_ != null) { this._string_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); ...
b71a7d4c-b323-4e24-bb79-4f8ab02bec2e
2
@Override public boolean stopVideoProcessing() { // First clean created data ... cleanUp(); // Then attempt to stop the processThread if (processThread == null || !processThread.isAlive()) return false; // Didn't find any better way to kill the thread pr...
a7c4c0ca-a338-4bcd-a31a-ec48d42b195f
1
protected String[] doparse(String str) { List<String> list = new LinkedList<String>(); for (String s : str.split(",")) { list.add(s); } String[] result = new String[list.size()]; list.toArray(result); return result; }
f42feba6-7ae7-4cc1-8441-8226e368f8bb
0
public void onPriceChanged(int price) { setText(INIT_TEXT + price); }
57fd1ad9-d823-4a80-924a-b29b9306b8b3
7
private String GetPrecision(String value) { String precision = "undefined"; // 1991-12-23 // 1992-9-3T10:00.... if (value.matches("^(1[6789][0-9]{2}|20[0-9]{2})-[0-9]{1,2}-[0-9]{1,2}(T.*)?$")) { precision = "day"; } // 1991-...
beabd6fc-1efa-4794-a06d-12499ca55805
1
public void salvar() { if (dao.Salvar(entidade)) { exibirMensagem("Salvo"); entidade = new Pessoa(); } else { exibirMensagem("Erro!"); } }
7fc19b25-29e9-411f-b26d-00a64fee8a35
7
@Override public void build(String catadata) { List<XMLLibrary.XMLTag> V=null; if((catadata!=null)&&(catadata.length()>0)) { V=CMLib.xml().parseAllXML(catadata); final XMLTag piece=CMLib.xml().getPieceFromPieces(V,"CATALOGDATA"); if((piece!=null)&&(piece.contents()!=null)&&(piece.contents().siz...
4580b91d-061b-4216-b484-2e41a8f1da4e
6
public static Stella_Object finishWalkingArgumentListTree(Slot self, Cons tree, StandardObject firstargtype, Object [] MV_returnarray) { if (self.slotName == Stella.SYM_STELLA_ALLOCATE_ITERATOR) { { Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get(); try { Native.setBooleanSpecia...
23a9bc7f-7d09-48a6-8f9e-8eec1bb5ccff
5
public void removeItem(DrawableItem item) { if (item == null) { return; } if (item instanceof PathItem) { boolean active = false; if (((PathItem) item).getPanel() != null) { for (PathItem pi : ((PathItem) item).getPanel().getLines()) { ...
53490b96-2954-44fb-99a0-ff6023c9b01e
1
public long previousTransition(long instant) { return (instant > transition ? transition : transition - 180L * DateTimeConstants.MILLIS_PER_DAY); }
10b415fb-4433-49c1-a81f-9fbe75135248
2
public static MonthOfYearEnum fromValue(String v) { for (MonthOfYearEnum c: MonthOfYearEnum.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
ca84c1eb-8a86-49ab-80d4-1a720e6320da
9
private void visit(GraphRelationship graphRel, GraphNode graphNode, List<GraphComponent> currentPathList) { if (currentPathList.contains(graphNode)) { // we've come round to a node that we've already visited so add at end of list and return currentPathList.add(graphNode); // no further action ...
7f1625be-910d-4dbc-b0c1-a103b9b8d0f4
1
@SuppressWarnings("deprecation") void pauseExecution() { for(ThreadsInformation threadInfo : ThreadsAgent) threadInfo.threadInfo.suspend(); }
48fe22fa-b7bb-4013-bf97-a058403e42fa
9
public void update() { // If master volume has been changed, update all volumes if(adjustVolume) { // Sound effects for(int x = 0; x<soundEffects.size(); x++) { soundEffects.get(x).adjustVolume(masterVolume); } // Tracks for(int x = 0; x<tracks.size(); x++) { tracks.get(x).adjustVolume(master...
c8dc4858-6c18-45de-b8d1-888fbb1406d1
3
private byte[] trim(byte[] in) { // remove the extra space of a byte array byte[] temp = in; int realLength = 0; for (int i = 0; i < temp.length; i++) {// count length if (temp[i] != 0) { realLength = i + 1; } } byte[] out = new byte[realLength]; for (int j = 0; j < out.length; j++) {// copy dat...
64d90537-c67b-4b84-a534-3307e502e73c
4
public void run(SensesPackage senses) { //TODO this code is potentially buggy because it doesn't check collision always. if (senses.playerVisible()) { //Check if the player is visible and update the path as necessary path = Pathfinding.pathTo(parent.getPos(), senses.getPlayerLocation(), senses); ...
751409db-49e9-4791-a5f9-c81c90d56dc5
2
private static void createDirt(int width, int height) { for(int x = 0; x < width; x++) { for(int y = dirtBoundary + 1; y < stoneBoundary; y++) { blockSheet[x][y] = World.DIRT; } } }
7b80e6bf-9994-4d96-955e-4bcb00bf773c
3
private static final Object[] decodeString(byte[] bencoded_bytes, int offset) throws BencodingException { StringBuffer digits = new StringBuffer(); while(bencoded_bytes[offset] > '/' && bencoded_bytes[offset] < ':') { digits.append((char)bencoded_bytes[offset++]); } ...
2273285d-82d8-4d94-a5e7-66f0cb95617f
7
public boolean hasAccount(String account) { Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; boolean exists = false; try { conn = iConomy.getiCoDatabase().getConnection(); ps = conn.prepareStatement("SELECT * FROM " + Constants.SQLTable + "_BankRelations WH...
b33bc90a-0872-49b7-80b9-4d09f7bde43a
3
private final void writeAbcTrack(final OutputStream out, final DropTarget<JPanel, JPanel, JPanel> abcTrack, final Map<DragObject<JPanel, JPanel, JPanel>, Integer> abcPartMap) { for (final DragObject<JPanel, JPanel, JPanel> midiTrack : abcTrack) { final Integer pitch = BruteParams.PITCH.getLocalValue(midiTra...
c8e47b8e-270a-4ff2-ac34-39a8ec7c832f
1
public Element(Grid grid) { if (grid == null) throw new IllegalArgumentException("The given Grid is invalid!"); this.grid = grid; }
8f9742e2-6ff4-4522-90e8-f80578a3fd07
5
void solve() { NHL nhl = new NHL(in); double e1 = 0, c = 0, e2 = 0; double minProfit = -0; int cBets = 0; double prPerBank = 0; nhl.deep = 6; for (double eps1 = 0.5; eps1 <= 0.5; eps1 += 0.25) for (double eps2 = 0.5; eps2 <= 0.5; eps2 += 0.25) ...
51e74f73-2624-4661-b03c-e253a7e1b765
3
@SuppressWarnings("unchecked") private AsyncComponent<T> getAsyncComponent() { if (asyncComponent == null) { // distinguish components that are already wrapped with AsyncComponent if (this instanceof AsyncComponent<?>) { asyncComponent = ((AsyncComponent<T>) this); } else { asyncComponent = new Asy...
d5a63d66-bb1b-4199-b37d-4eb8a4d6c18e
0
public CommandListener(Trd_match plugin) { this.plugin = plugin; }
8f05cabc-5996-4176-b252-db2bb7729345
3
public static int getArgumentSize(String methodTypeSig) { int nargs = 0; int i = 1; for (;;) { char c = methodTypeSig.charAt(i); if (c == ')') return nargs; i = skipType(methodTypeSig, i); if (usingTwoSlots(c)) nargs += 2; else nargs++; } }
e0ef72e5-7db0-448f-ac30-52bef9f8eeb8
2
public void skipTag(String name) throws IOException { String marker; if (SHOW_SKIPPED_TAGS) { Log.warn("Skipping tag: " + name); //$NON-NLS-1$ } require(XMLNodeType.START_TAG, name); marker = getMarker(); do { next(); } while (withinMarker(marker)); }
8dd840e9-5c01-4813-ab74-5af856f22144
6
private void populateList(String[] list){ for(int i = 0; i < list.length; i++){ if(list[i].endsWith(".jpg") || list[i].endsWith(".gif") || list[i].endsWith(".png") || list[i].endsWith(".jpeg") || list[i].endsWith(".tiff")){ downloadedFiles.add(list[i]); System.err.println(list[i]); } } }
eea9eb87-3c80-4fa9-b167-77b6c7109fca
1
public boolean passable() { return this == TILE_TREASURE || this == TILE_FLOOR; }
17f2dce7-661c-4044-82e7-25ec8f7259d1
5
public void set(String path, Object value) { Configuration root = getRoot(); if (root == null) { throw new IllegalStateException("Cannot use section without a root"); } final char separator = root.options().pathSeparator(); // i1 is the leading (higher) index ...
9efc4e6d-9d41-4f4c-af3b-bc9a6478c723
4
@EventHandler public void onPlayerInteract(PlayerInteractEvent event){ if(event.getClickedBlock()==null) return; if(!(event.getClickedBlock().getState() instanceof Chest)) return; Chest chest = (Chest) event.getClickedBlock().getState(); Player player = event.getPlayer(); if(!plugin.isCoffer(che...
3e0fca11-6456-481a-aef5-06886ff52ee6
3
public boolean isEdgeIgnored(Object edge) { mxIGraphModel model = graph.getModel(); return !model.isEdge(edge) || !graph.isCellVisible(edge) || model.getTerminal(edge, true) == null || model.getTerminal(edge, false) == null; }
87e3082b-c88d-4723-9489-e7fb422273e0
5
private Constants.Error createTemporaryData() { { LOGGER.debug("Creating Temporary Data!"); } Constants.Error ret = null; ret = createBackUpFiles(); if (ret == null) { try { FileUtil.createDirectory(Constants.PROGRAM_TMP_PATH); ...
f2d8c4bd-de78-4263-8ecf-9577bfbb36f4
8
public E put(E obj, int x, int y, int z) throws ConstraintException { if (obj == null) { return null; } if (x > sideLength || y > sideLength || z > sideLength || x < 0 || y < 0 || z < 0) { throw new ConstraintException("Cannot place a data value at that point!"); ...
9b889047-66f8-40ed-9ae8-8e69d5c9e044
1
public int getUpperLeftY() { if (y1 > y2) { return y1; } else { return y2; } }
20cf51ab-1d2f-4df0-a966-dcbc059af2c2
8
public void checkLasers(){ for (Iterator<Laser> iterator = lasers.iterator(); iterator.hasNext(); ) { Laser b = iterator.next(); if(collisionCircle(getX(),getY(),h/2+h/4,(int)b.getX(),(int)b.getY(),2)&&b.kind!=kind){ health-=b.getDamage(); for(int y=0;y<...
4145fd72-c473-4058-a462-7f43368dcc93
7
public static <GSource, GTarget> Collection<GTarget> translatedCollection(final Collection<GSource> items, final Translator<GSource, GTarget> translator) throws NullPointerException { if (items == null) throw new NullPointerException("items = null"); if (translator == null) throw new NullPointerException("transla...
844ecc54-3b2a-4d36-a922-64928fe88ade
0
private PieceMessage(ByteBuffer buffer, int piece, int offset, ByteBuffer block) { super(Type.PIECE, buffer); this.piece = piece; this.offset = offset; this.block = block; }
aefc5fd7-f48c-4edd-a8c1-0ef4e915c442
5
private void doBankCommand(Command command) throws RemoteException, RejectedException { CommandName inputCommand = command.getCommandName(); String userOrItemName = command.getUserOrItemName(); Float amount = command.getAmount(); account = bankobj.getAccount(clientname); switch (inputCommand) { case bal...
8fa979af-992a-41c5-b859-9f6c714b4bc2
8
public boolean bodyCall(Node[] args, int length, RuleContext context) { checkArgs(length, context); BindingEnvironment env = context.getEnv(); Node n1 = getArg(0, args, context); Node n2 = getArg(1, args, context); if (n1.isLiteral() && n2.isLiteral()) { Object v1 = n...
1d5f1589-f4c4-42dc-8bfe-7882e8a108b2
0
@FXML private void handleTextFieldAction() { target = addrField.getText(); }
39e2f7ed-c57a-480c-a7a7-ef042977fc01
8
public Unit getUnitAt(Position p) { if ( p.getRow() == 2 && p.getColumn() == 3 || p.getRow() == 3 && p.getColumn() == 2 || p.getRow() == 3 && p.getColumn() == 3 ) { return new StubUnit(GameConstants.ARCHER, Player.RED); } if ( p.getRow() == 4 && p.getColumn() == 4 ) { return new StubUnit(GameConstan...
41e55c94-493b-4796-8d6f-a9851e0c1b20
2
protected List<Teleporter> getTeleporterList(int amount) { final List<Teleporter> teleports = new ArrayList<Teleporter>(); for (int i = 0; i < amount; i++) teleports.add(getTeleporter()); for (Teleporter tp : teleports) tp.setDestination(getRandomDestination(tp, teleports)); return teleports; }
6f56d8e9-c065-4f16-b010-39172dcc6a9e
1
public void deposit(int value) { if(value >= 0) { notifyPropertyChangeListeners(money, money + value); money += value; } else { throw new IllegalArgumentException("You can't deposit a negative number of dollars!"); } }
27be73b7-804c-4fae-b6d2-a69b4c81fed5
9
@Override public String toString() { String result = getClass().getSimpleName() + " "; if (name != null && !name.trim().isEmpty()) result += "name: " + name; if (city != null && !city.trim().isEmpty()) result += ", city: " + city; if (country != null && !country.trim().is...
1d8e9379-7171-41cf-be3f-81f6b1e26177
2
public static void clear() { try { root.clear(); String[] children = root.childrenNames(); for (int i = 0; i < children.length; i++) { Preferences node = root.node(children[i]); node.removeNode(); } root.sync(); } catch(BackingStoreException e) { vlog.error(e....
7a746010-1c93-4240-bf8f-6dc92e37bc95
0
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new BounceFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } ...
a66189cb-65eb-4741-9c3f-5a15a3a4be2d
1
@Override public void adjust() { boolean enable = false; Duplicatable duplicatable = getTarget(Duplicatable.class); if (duplicatable != null) { enable = duplicatable.canDuplicateSelection(); } setEnabled(enable); }
7fc15760-fa4e-4972-9624-76f1740c64d8
1
public void removePush() { StructuredBlock[] subBlocks = getSubBlocks(); for (int i = 0; i < subBlocks.length; i++) subBlocks[i].removePush(); }
106b08dc-5bf0-466d-af5a-19a2ba81bab6
4
@EventHandler public void onInteract(PlayerInteractEvent event) { if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getPlayer().hasPermission("decapitation.info") && event.getClickedBlock().getType() == Material.SKULL) { Skull s = (Skull) event.getClickedBlock().getState(); ...
d4bd59a7-3b18-457a-b439-105db0571340
4
Dimension getThumbDimensions(){ Dimension returnDim = null; switch(fullType){ case Original: returnDim = originalImage.thumbDimensions; case Filtered: returnDim = filteredImage.thumbDimensions; case Icon: returnDim = ico...
35c1d530-f7fb-493c-ba30-370c6b0daf76
2
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((wordid1 == null) ? 0 : wordid1.hashCode()); result = prime * result + ((wordid2 == null) ? 0 : wordid2.hashCode()); return result; }
20fd2865-a7ef-4bd5-808c-639dfd117101
7
static void dradf4(int ido, int l1, float[] cc, float[] ch, float[] wa1, int index1, float[] wa2, int index2, float[] wa3, int index3){ int i, k, t0, t1, t2, t3, t4, t5, t6; float ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4; t0=l1*ido; t1=t0; t4=t1<<1; t2=t1+(t1<<...
7f95afd7-b3a1-424d-8072-2d3ae5ffe19f
4
@Test public void missingSubPatternReplacementTest() throws URISyntaxException { patternReplacer = new PatternReplacer( "{scheme:3} {host:0} {port} {path:0} {fragment:0}") .setScheme(SCHEME_PATTERN) .setHost( HOST_PATTERN ) .setPath( PATH_PATTERN ) .setFragment( FRAGMENT_PATTERN ); try { pattern...
c67c7edb-48ca-4259-b774-0cf11c0370f0
3
@Override public void printWay() { ArrayList<Coordinate> finderWay = new ArrayList<Coordinate>(); while(finderDuo_1.fHistory.top > 0 ) finderWay.add(finderDuo_1.fHistory.popLocation()); for(int i = finderWay.size()-1 ; i >= 0 ; i--) System.out.println(finderWay.get(i)); while(finderDuo_2.fHistory...
04657e61-71b6-4ba2-8127-24b85325f495
6
private ArrayList<String> validPossible(String s) { ArrayList<String> possible = new ArrayList<String>(); if (s.length() >= 1) { possible.add(s.substring(0, 1)); } if (s.length() >= 2) { String xx = s.substring(0, 2); if (!xx.startsWith("0")) { ...
820735cf-729f-4869-b77b-94e88a782f3b
5
private static List<ItemStack> parseItems(List<String> raw) { List<ItemStack> result = new ArrayList<ItemStack>(raw.size()); for (String string : raw) { String[] split = string.split(","); if (split.length == 0 || split.length == 1) { result.add(new ItemStack(Inte...
2be38cc5-995e-4489-88b7-f206b5cb72e7
5
public static void main(String[] args) { IConsumes BMW = new Car_luxury("Registered E92"); IConsumes Oldsmobile = new Car_oldies("Unregistered Alero"); Car Lastun = new Car_oldies("Unregistered Dacia"); Car Ferrari = new Car_luxury("Registered 599 GTO"); Car_luxury Mercedes = new Car_luxury("Registered Mer...
34d04568-ed16-45fd-9916-fb7987c77072
7
public void processMyoEvent(MyoEvent me){ //System.out.println(me.frame.pose); if(me.frame.pose.contains("fingersSpread")) { System.out.println("All off received"); reset(); /* while(track.size() > 0) { for(int i = 0; i < track.size(); i++) { track.remove(track.get...
70d8b47c-e733-4369-9922-98c299703af5
8
public final void quant(final float[] lsp, final float[] qlsp, final int order, final Bits bits) { int i; float tmp1, tmp2; int id; float[] quant_weight = new float[MAX_LSP_SIZE]; for (i=0;i<order;i++) qlsp[i]=lsp...
d3c57bfd-a4e9-449d-adad-43e55bf66a8a
9
public static void printHandHidden(Hand hand) { // print hand header ArrayList<String> attrs = new ArrayList<String>(3); if(!hand.getDescription().equals("")) attrs.add(hand.getDescription()); if(hand.getBet() > 0.0f) attrs.add("bet: $" + hand.getBet()); output.println(hand.getPlayer().getName() + "\'...
9768a0e3-33d7-4934-95ab-3892326e8f5d
9
public int[] twoSum(int[] numbers, int target) { int[] clone = Arrays.copyOf(numbers, numbers.length); Arrays.sort(clone); int i = 0, j = clone.length - 1; while (clone[i] + clone[j] != target) { if (clone[i] + clone[j] > target) { j--; } else if (...
3a96fe8b-2666-4d94-a5b8-a02eeec8eedf
7
public boolean isWhitelistedItem(ItemStack item, String group) { List<String> whitelist = plugin.getWhitelistedItems(group); @SuppressWarnings("deprecation") int dataValue = item.getTypeId(); @SuppressWarnings("deprecation") int damageValue = item.getData().getData(); for (String whitelistedItem : whiteli...
403b29d3-f065-4937-a87d-546a15e5c3ac
5
@Override public <X> X getScreenshotAs(OutputType<X> outType) { try { if (driver instanceof FirefoxDriver) { return ((FirefoxDriver) driver).getScreenshotAs(outType); } else if (driver instanceof ChromeDriver) { return ((ChromeDriver) driver).getScreen...
9af2c5ce-ee64-4164-8c18-d6f9005a0445
2
public static Properties getProperties() { if (config == null) { // Create once config = new Properties(); try { config.load(Configuration.class.getResourceAsStream(Constants.CONFIG_FILENAME)); } catch (IOException ex) { Logger.getL...
af42d038-9a86-4b39-8111-99ec884bcadf
5
private static void ReadAttrisGrp(Element attrisgrpnode, GeneratorAttriGrp attrisgrp) { NodeList nodelist; Node node; Element elem; String name; int i; nodelist = attrisgrpnode.getChildNodes(); for (i = 0; i < nodelist.getLength(); i++) { node = nodelist.item(i); //find a attribute node if ...