method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5223775b-412f-4815-bf98-875deede91b1
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Item target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_UNWORNONLY); if(target==null) return false; if(mob.isMine(target)) { mob.tell(L("You'd better put it dow...
77cc8781-b941-40dd-98e6-f6b693c2c967
7
public void Moverse() { if (movimiento == false) { // ESCALADA getRobot1().inicializarMapa(getAnchoEntorno(), getAltoEntorno()); while (robot1.getPuntoActual().equals(robot1.getPuntoDestino()) == false && robot1.getPararMovimiento() == false) { try { Thread.sleep(1000); } catch (Interrupted...
447a3d32-25ae-40ee-8cab-0d47bc9be247
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Item target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_ANY); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false...
06a9060c-dce0-4cb5-8456-e653dbbf14cd
3
private Sign findSign(Inventory inventory) { if (inventories.containsValue(inventory)) { for (Map.Entry<Block, Inventory> entry : inventories.entrySet()) { if (entry.getValue().equals(inventory)) { Block block = entry.getKey(); return (Sign) bl...
f6646ad0-5f38-4e23-b829-c6ab01ff3e54
1
public void visit_fsub(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
83c892d7-774d-49db-8b6f-7bc34f9790fb
6
public final static URL getMbReleasesOfArtist(String artistID) throws MusicbrainzUrlException { if(artistID == null || artistID.equals("")) throw new MusicbrainzUrlException("The artistID is null or empty"); URL url= null; URI uri= null; try { //lookup of musicbrainz uri= new URI("http...
85e6a1ee-97b3-47d8-84b0-753f9e2c7ced
8
public boolean equals( Object other ) { if ( ! ( other instanceof TObjectIntMap ) ) { return false; } TObjectIntMap that = ( TObjectIntMap ) other; if ( that.size() != this.size() ) { return false; } try { TObjectIntIterator iter = this...
5923a332-f5f7-4ca0-8a2f-7104da9f96b7
7
private static boolean inDB(String nameText) throws Exception { String[] spl1 = nameText.split(",\\s", 2); for(String s : spl1) { if(s.matches("^[0-9]+$")) { System.out.println("Nur Nummer!? -> " + nameText); return false; } } String name = spl1[0].replaceAll("[.,;:!?]", ""); String ...
27d31f7a-9a87-4c54-a180-ae11557adeec
5
private long removeRefContactNym(long lIndex) { // // loop through the elements in the actual container, in order to find the one // at lIndex. Once it is found, then loop through the reference list and remove // the corresponding reference for that element. // ContactNym refActualElement = GetContactNym(lIndex)...
be6073d0-f0a6-4186-9815-f76255b197f6
2
static int rank (int[] N, int key) { if (N.length == 0 || N.equals(null)) { throw new IllegalArgumentException("Cannot process empty or null array"); } int iterative = rank_iterative(N, key); int recursive = rank_recursive(N, key, N.length - 1, 0); assert iterative == recursive; return iterative;...
ebd3deeb-32bf-4c9b-95f1-8487a412d871
7
@Override public void onBrowserEvent(Event event) { // If we're not yet dragging, only trigger mouse events if the event occurs // in the caption wrapper switch (event.getTypeInt()) { case Event.ONMOUSEDOWN: case Event.ONMOUSEUP: case Event.ONMOUSEMOVE: ...
4a840e9c-70e1-41df-bc1f-8136bafc3d7f
7
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
d5fd348e-848c-4430-9ef5-46cb5773cb71
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 Uf)) { return false; } Uf other = (Uf) object; if ((this.coduf == null && other.coduf != null) || (this.coduf !...
4b433c6f-10a4-40e2-80d0-1a0d51d0c1d5
1
public Type getSuperType() { return (this == tObject) ? tObject : tRange(tObject, this); }
72789e81-8b3e-49cb-a784-d398cd0a9308
5
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; try { if (value.equals("0") || !value.endsWith("0")) { Double.parseDouble(value); isValueNumeric = true; } } catch (NumberFormatException e) { ...
df67011a-3172-46b5-812e-20e962971852
4
public void loadPM(long playerName, int world) { //synchronized(c) { if(c.getOutStream() != null && c != null) { if(world != 0) { world += 9; } else if(!Config.WORLD_LIST_FIX) { world += 1; } c.getOutStream().createFrame(50); c.getOutStream().writeQWord(playerName); c.ge...
91b2b35b-40c5-4627-aabc-a1ce5a66f3ef
8
public void moveEntityWithHeading(float par1, float par2) { if (this.isInWater()) { this.moveFlying(par1, par2, 0.02F); this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.800000011920929D; this.motionY *= 0.800000011920929D; ...
fea16fbf-76fd-4c0b-9de1-991319b9f3ad
5
public static void sendFileReq ( Socket sckIn , String strId , EzimFileOut efoIn ) throws Exception { if ( efoIn != null && strId != null && strId.length() > 0 ) { EzimDtxSemantics.initByteArrays(); long lSize = 0; FileInputStream fisTmp = null; try { OutputStream osTmp = ...
17047df3-620e-44ab-b8aa-169f5493b88d
4
public String encriptar(String textoParaEncriptar, String metodoEncriptacion) { String encriptadoString = ""; try { if (!textoParaEncriptar.equalsIgnoreCase("")) {//Pasamos el password obtenido del caja de password MessageDigest md = MessageDigest.getInstance(metodoEncriptaci...
d3d3ddcd-7c1e-4edc-af8b-8d721b012f71
7
@Override public MethodResult ExecuteNonQuery(String rawSql) { MethodResult res = new MethodResult(); Connection conn = null; try { if ((conn = this.getConnection()) != null) { Statement statement = conn.createStatement(); if (DEBUG) { ...
7854aa54-a6ad-4162-b1d1-1f3a70040b0e
0
@Override public String toString(){ return "" + this.armorItem.toString(); }
5fb2cd84-57b9-41b0-aab3-91aed7778cb7
5
public void characters(char ch[], int start, int length) throws SAXException { if(inHits) { try { hits = Integer.parseInt(new String(ch, start, length)); } catch (NumberFormatException e) { System.err.println("Breakout: Could not parse level_width"); System.exit(1); } } if(inScore) ...
076c5343-d030-4213-9cd0-ad5e9cf1f0cc
9
public boolean isAutarkic(IGroup g) { if (g.getGroupType() == GroupType.PACKAGE) { return false; } if (g.getGroupType() == GroupType.INNER_ACTIVITY) { return true; } if (g.getGroupType() == GroupType.CONCURRENT_ACTIVITY) { return true; } if (g.getGroupType() == GroupType.CONCURRENT_STATE) { re...
c3557edc-4a23-44c9-bd32-fb8ff590d68f
7
public ShopItem getItemByName(String... names) { if (names != null && names.length > 0) for (ShopItem nextItem : items) { String name = nextItem.getName(); if (!isStringValid(name)){ continue; } else for (String nextName : names) if (isStringValid(nextName) && name.equalsIgnor...
84ec2a76-919d-4a79-b5de-6d680a012334
1
public static synchronized Singleton_2 getInstance() { // 这个方法比上面有所改进 if (instance == null) { // 实例化 instance = new Singleton_2(); } return instance; }
1a44db68-011b-43a7-b40e-7f0f4592590e
3
@Override public ArrayList<Map<String, String>> getUnexpiredAuctions() { ArrayList<Map<String,String>> auctions = new ArrayList<Map<String,String>>(); TypedQuery<Auction> unexpiredAuctionsQuery = emgr.createNamedQuery( "Auction.findAllUnexpiredAuctions", Auction.class); unexpiredAuctionsQuery.setParameter("a...
f179a202-2f11-4f2f-9d1e-a31bd8116392
6
public boolean checkMainDiagonal() { //upper left to lower right (main diagonal) for (int col = 0; col < numColumns - 3; col++) { for (int row = 0; row < numRows - 3; row++) { int curr = gameGrid[col][row].getState(); if (curr > 0 && cu...
f86e33c7-ae84-4975-8fe1-0b8c93111470
3
public UserScreen() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(new Rectangle(0, 0, 1365, 799)); getContentPane().setFont(new Font("Times New Roman", Font.PLAIN, 12)); getContentPane().setForeground(new Color(255, 255, 204)); getContentPane().setLayout(null); JPanel panel = new JPanel(); ...
c2a978f5-d15b-4974-bc3b-325554c7a224
5
public LinkCache(String directory) throws IOException { if (directory == null) { throw new IllegalArgumentException("directory is null."); } File file = new File(directory); if (!(file.exists() && file.isDirectory() && file.canWrite() && file.canRead())) { throw ne...
9887fa89-b0aa-4afa-80b7-1f2eb1c5c31a
8
public void removegroup (int i0, int j0) // completely remove a group (at end of game, before count) // note all removals { if (Pos.haschildren()) return; if (P.color(i0, j0) == 0) return; Action a; P.markgroup(i0, j0); int i, j; int c = P.color(i0, j0); Node n = Pos.node(); if (n.contains("B") || n....
9cb3f005-6838-4f92-8813-7c98109cd481
2
private static String convertToString(String[] data, char identifier) { StringBuilder sb = new StringBuilder(); sb.append(identifier + "" + DATA_DIVIDER); for(int i = 0; i < data.length; i++) { sb.append(data[i]); //No divider on last data value if(i < data.length - 1) { sb.append(DATA_DIVIDER); }...
4579a188-b2a8-4963-921f-3f6fc0968635
5
private void computeAnswer() { long ans = getSumOfKthPowers(N); int coeff;//coeff of current subset contribution in inclusion exclusion sum for (int mask = 1; mask < (1 << primeCount); mask++) { long x = 1l; coeff = 1; for (int i = 0; i < primeCount; i++) { ...
c5fc6bc5-b754-4a56-bfb5-15c33a6509ae
6
private void initiate(){ System.out.println("Initializig SIB"); OntModel model = ModelFactory.createOntologyModel(); InputStream in = this.getClass().getResourceAsStream(this.ontologyFile); if (in == null) { throw new IllegalArgumentException( "File: " + this.ontologyFile + " not found" ); } //...
e3d9593b-3c2c-410c-8716-6b3a6555bdd7
1
public void config(String name, String remote_addr, int listen_on, String log_dir, Properties[] filter_configs) { try { final Route route = new Route(name, listen_on, remote_addr, new File(working_directory, log_dir), filter_configs); synchronized (routes) { routes.add(route); } new Thread(route, name).s...
852dbb4f-c79b-4783-9677-2cc66033d9b0
0
public void go() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { Being child = being.split(); Supervisor.getSupervisor().registerBeing(child); }
8b31b61c-d3b9-496c-8a61-fc0e04411042
5
public boolean checkUser(String login, String password) { result = "?"; ArrayList<User> users; try { users = DataBase.getInstance().getUsers(); for (Iterator it = users.iterator(); it.hasNext();) { User user = (User) it.next(); if (user.get...
443e9849-15f7-4858-a3fa-eac1465b5a5b
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 ...
b329b606-8520-45a4-9758-f1fd9cd9a9b6
4
public void dump() { for (int i = 0; i < framePointers.size(); i++) { System.out.print("["); int endFrame = runStack.size(); if (i < framePointers.size() - 1) { endFrame = framePointers.get(i + 1); } for (int j = framePointers.get(i); j...
5de4d3ed-9968-460d-80e3-30f5a04d8d89
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
4b9db98b-a1b6-4195-ba91-8c2dda9f8cfe
0
@Override public void restoreTemporaryToCurrent() {tmp = cur;}
e24cb83c-06e8-48d8-94b4-b3d928bf3bd9
7
public static void addBook(Messagable ui, String isbn, String category, String author, String title, float dailyLateFee, float maxLateFee, int numberOfCopies){ boolean itemAdded = true; if(Book.bookExists(isbn)){ itemAdded = false; ui.sendMessage("ERROR: Item already exists"); } if(numberOfCopies < 1){ ...
f31238d2-d829-414e-93b2-f97bb7757bac
4
private void setUpNextAndPreviousButtons() { // create the image icons for the buttons Icon prevIcon = new ImageIcon(DigitalPicture.class.getResource("leftArrow.gif"), "previous index"); Icon nextIcon = new ImageIcon(DigitalPicture.class.getResource("rightArrow.gif"), ...
487e9b28-5500-48f0-b63c-500b955b1749
5
public static String userOS() { String os = System.getProperty("os.name").toUpperCase(); if (os.indexOf("WIN") >= 0) { return "Windows"; } else if (os.indexOf("MAC") >= 0) { return "MacOSX"; } else if (os.indexOf("SUNOS") >= 0) { return "Solaris"; } else if (os.indexOf("NIX") >= 0 || os.indexOf("NUX") >= 0) { ret...
ff87e5a3-bb35-4870-9df7-3b45fb7a43a3
6
private void updateCreature(Creature creature, long elapsedTime) { //creature.updateRotation(elapsedTime); // change x float dx = creature.getVelocityX(); float oldX = creature.getX(); float newX = oldX + dx * elapsedTime; Point tile = getTileCollisi...
06aeb3c1-f9a3-4f86-99b1-70e6a6ca38f5
9
private void updateStateWaitingName(List<Keyword> keywords, List<String> terms) { //We came here since we didn't get a jump, if we got a jump we're in RECIPE_FOUND if (keywords == null || keywords.isEmpty()) { if (terms != null && !terms.isEmpty()) { //Will save first term no matter what user said. recipeName...
48767ec3-2044-442b-be3f-93dc5986e853
3
public static void main(final String[] args) { PrintStream origErr = System.err; PrintStream origOut = System.out; System.setErr(origOut); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { System...
790617fe-9c19-448b-884c-eb6c041da7c7
1
@Test public void throwException() { C c = new C(); c.in = "1"; try { c.execute(); fail("Exception expected"); } catch (ComponentException E) { assertEquals(c.op2, E.getSource()); assertEquals("crash", E.getCause().getMessage()); } }
1cfd2cdb-bcb1-4f64-8e2a-bbdf888b8fc8
8
private void grow() { HugeLongArray oldAddresses = addresses; // instead of just doubling the size - this gives more prime number sizes which tend to distribute hash codes better int newCapacity = oldAddresses.size() <= 1 ? 2 : oldAddresses.size() * 2 - 1; initialize(newCapacity); for (int oldAddressInd...
1385751f-c1e4-4a8a-b323-267da508ac34
1
public void upgrade() { if(tier < 19) { fuelCapacity += 20; fuelLevel += 20; tier++; } else { tier = 20; fuelCapacity = 500; fuelLevel = 480; } }
be15652e-b292-4698-9384-92d868230f96
3
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (cmd.getName().equalsIgnoreCase("kits")) { if ((sender instanceof Player)) { Player player = (Player) sender; if(player.hasPermission("EasyPvpKits.Kits")) { ...
19ac1ecc-768d-4be2-b9fb-3ae8eae963ab
9
void display() { String s; switch( cardRanks[0] ) { case 1: s = "high card"; break; case 2: s = "pair of " + Card.rankAsString(cardRanks[1]) + "\'s"; break; case 3: s = "two pa...
68c471e2-da51-48fc-a8ba-8e4db1d36a53
4
public void updateSubTypes() { int offset = 0; if (!isStatic()) { subExpressions[offset++].setType(Type.tSubType(getClassType())); } Type[] paramTypes = methodType.getParameterTypes(); for (int i = 0; i < paramTypes.length; i++) { Type pType = (hints != null && hints[i + 1] != null) ? hints[i + 1] ...
547a86e6-a178-44db-908b-bbf3b637c695
3
public void arrivalCheck(int currentPhase){ for(int i = 0 ; i < this.TrainList.size() ; i++){ Train tmpTrain = this.TrainList.get(i); if(tmpTrain.endTime == currentPhase){ Train tmpTrain2 = this.TrainList.remove(i); i--; ArrayList<Customer> tmpClist = tmpTrain2.customerList.dequeueAll(); ...
523ebdd9-ac1e-4afc-9ce9-7ba43510c76d
9
public final void run(EventTaskRunner runner) { try { if(Log.ON){Log.d("taskrunner","["+mid+"]"+"action:"+toString());} action(runner); if (isKeep()) { if(Log.ON){Log.d("taskrunner","["+mid+"]"+"action: next keep");} runner.start(this); } else if(runner != null&&mNextAction != null&&isNext()) ...
8fec0dd6-cd97-4d28-8c24-c1b858705b77
7
public static void testSwap(String f, int[][] grid, int[][] grid0, int myType, int i, int j, int k, int l) { if ((i == k) && (j == l)) { if (grid[i][j] != myType) { System.out.printf("Failed on %s @ (%d, %d) should not have moved\n", f, i, j); ...
54d8a808-c0f4-4406-a5e8-79b84d9cfdb5
8
public void hashify(Node n) { if(n==null){return;} if (n.parent == n && n != null) { hashInsert(n, n.label.charAt(0), n); for (Node child : n.children) { hashify(child); } } else if (n.parent != n && n != null) { if (n.label != null) { hashInsert(n.parent, n.label.charAt(0), n); for (Node ...
d6f4a989-9588-4e78-91f0-e27da520e578
0
@Override public int create(Secteur unSecteur) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. }
94ce8872-07b0-4218-8611-1f5d1d381a6d
2
@Override public Ingredient addIngredient(String s) { Ingredient c = getIngredient(s); if (c != null) { return c; } else { try (Connection connection = DriverManager.getConnection(connectionString);) { int idNewCategory = getNextIdAndIncrement(); PreparedStatement statement = connection.prepareStat...
8e2f5d83-5862-4f70-a1f9-346ccf1b45ca
0
@Override public String toString() { return "Medicament{" + "depotlegal=" + depotlegal + ", nomcommercial=" + nomcommercial + ", code=" + code + ", composition=" + composition + ", effets=" + effets + ", contrindic=" + contrindic + ", prix=" + prix + '}'; }
e2bf63d7-8be0-4564-acd3-fe1c86f72643
8
@Override public void collidedWith(Participant p1, Participant p2) { if (p1 instanceof Asteroid && p2 instanceof Ship) { asteroidCollision((Asteroid)p1); shipCollision((Ship)p2); } else if (p1 instanceof Ship && p2 instanceof Asteroid) { asteroidCollision((Asteroid)p2); shipCollision((Ship)p1); } ...
9e0214b2-b49b-43cc-8d45-b802b90ee1c4
1
WorldTile(BufferedImage image, boolean passable, int minimapColor, int cost) { this.passable = passable; if (image == null) { logger.error(new NullPointerException(), "Attempted to add a null tile image to the map!"); } this.image = image; tileWidth = image.getWidth(); tileHeight = image.getHeight(); ...
88f9efde-c4f0-4687-ba2a-49b4fbcd2e50
0
public Communicate() { // TODO Auto-generated constructor stub }
e5a4b828-33c9-4fde-a535-b7778eb3ae08
2
public void run() { while (true) { ServerSocket serverSocket = null; try { serverSocket = new ServerSocket(7); Socket socket = null; System.out.println("Waiting for connection...."); socket = serverSocket.accept(); System.out.println("Connection successful"); System.out.println("Waiting...
93414cbc-152e-463c-9293-d05d747f2d6b
7
public static boolean allKeyArgumentsBoundP(Proposition goal) { if ((goal.kind == Logic.KWD_FUNCTION) || Proposition.singleValuedPredicateP(goal)) { if (((Vector)(KeyValueList.dynamicSlotValue(goal.dynamicSlots, Logic.SYM_LOGIC_IO_VARIABLES, null))) != null) { { boolean alwaysP000 = true; ...
eb9fd3b6-44b4-4984-8f1f-db738d527fb2
9
@Test public void testUpdateEditorsPick() { Integer testISBN = 800; Set<StockBook> books = new HashSet<StockBook>(); books.add(new ImmutableStockBook(testISBN, "Book Name", "Book Author", (float) 100, 1, 0, 0, 0, false)); try { storeManager.addBooks(books); } catch (BookStoreException e) { e.print...
e006c08e-b46d-4a82-807b-86cac2bbedcc
1
private Object get(final int local) { maxLocals = Math.max(maxLocals, local); return local < locals.size() ? locals.get(local) : Opcodes.TOP; }
1abd5a86-671d-47f4-a437-f39ef30567d7
3
@Override public void tick() { if (target.isAlive()) { if (target.getPos().distance(pos) < 10 && isAlive) { this.hit(); // pos = target.getPos(); } else { Vector2d diff = target.getPos().difference(pos); diff.setLength(speed); pos = pos.sum(diff); } } else { isAlive = false; } }
6acd253a-21a4-4a31-b73a-14cc71e085a5
3
static private float[] subArray(final float[] array, final int offs, int len) { if (offs+len > array.length) { len = array.length-offs; } if (len < 0) len = 0; float[] subarray = new float[len]; for (int i=0; i<len; i++) { subarray[i] = array[offs+i]; } return subarray; }
47601456-9bc5-479d-912b-301e9d4c359a
9
void setVisibilityFlags(BitSet bs) { /* * set all fixed objects visible; others based on model being displayed * */ for (int i = dipoleCount; --i >= 0;) { Dipole dipole = dipoles[i]; dipole.visibilityFlags = ((dipole.modelIndex < 0 || bs .get(dipole.modelIndex)) &...
04d926d7-16ee-4655-9ee6-29a9d8f28820
1
private JFileChooser createFileChooser() { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileFilter(new TextFileFilter()); if (defaultDirectory != null) { fileChooser.setCurrentDirectory(defaultDirectory); } return fileChooser; }
bafa4dc8-e21b-4b19-9665-c490f7323bd2
1
private String suffer(int i) { String message = this.letter+" loses "+i +" hitpoints."; hitpoints = hitpoints - i; if (hitpoints <= 0) { this.board.removePawn(this); message += this.letter+" is dead."; } return message; }
d5071957-503e-45a5-9023-329110c416ff
4
protected void generateForce () { double currentLength = getCurrentLength(); boolean isContract = currentLength <= myRestLength; double distance = Math.abs(currentLength - myRestLength); double amplitude = distance * myStifness; if (amplitude == 0) return; do...
ea527333-9de7-42ac-a501-75d1ad2b7b2e
1
@SuppressWarnings("unchecked") public Vector arbitrary(Random random, long size) { int length = (int) Arbitrary.random(random, 0, Math.min(Integer.MAX_VALUE, size)); Vector list = new Vector(length); for (int i = 0; i < length; ++i) { li...
5065b6da-e33f-48fa-96e9-0e67cf16102e
4
protected boolean isConnected(Node from, Node to) { // Antennas are hardwired - we exclude links between pairs of antennas. // MobileNodes are not connected among themselves if(from instanceof Antenna && to instanceof MobileNode || to instanceof Antenna && from instanceof MobileNode) { double dist = from.g...
e26205b5-4e20-4f35-9818-b1fe64d157f1
8
public static int getXfromString(String location) { if ((location.charAt(0) == 'a')) { return 0; } if ((location.charAt(0) == 'b')) { return 1; } if ((location.charAt(0) == 'c')) { return 2; } if ((location.charAt(0) == 'd')) { return 3; } if ((location.charAt(0) == 'e')) { return 4; ...
be239de2-095e-4933-b637-7eb720f3e733
9
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); HttpSession session = request.getSession(true); String id = request.getParameter("driverId"); String pwd = request.getParameter("driverPwd"); PrintWriter...
03ded8fe-5b8f-44dd-9ce9-ce2a12bc2632
2
public static Inventory deserialize(byte[] bytes) { NbtTagCompound root = NbtFactory.toCompound(NbtSerializer.toTag(bytes)); if (root.getInt(VERSION_KEY) != NBT_VERSION) throw new IllegalArgumentException("Incompatible NBT-version!"); NbtTagList<NbtTagCompound> items = root.getList...
88bcc6c2-44cb-40c5-9c19-f50026ab0a86
5
@Override protected boolean perform(final CommandSender sender, final Command command, final String label, final List<String> args, final Region region) { final String owner = RegionExecutor.parse(args, 0, "<Owner>", sender); if (owner == null) return false; if (!region.owners.contains(owne...
1c67a2b2-ef4c-4b9c-82da-30a0b308e5f0
9
private void generateSqlProperties() { StringBuilder sbr = new StringBuilder(); sbr.append("JNDI.CONNECTION java:comp/env/jdbc/" + this.jndi + "\n\n"); sbr.append("CLASS.BROKER.IMPL br.com.topsys.database.jdbc.TSDataBaseBrokerImpl\n\n"); switch (this.database) { case DBModel.DB_ORACLE: sbr.append("CL...
b7789374-184c-4b75-8d34-c653a6ca043c
1
public void makeSelection() { if(!list.getSelectedValue().startsWith("-1")) { selection = list.getSelectedValue().substring(0, list.getSelectedValue().indexOf(";")); dispose(); } }
1d692d0e-f326-43e0-849f-c8a65c1de127
0
public static void main(String[] args) { new WashStart().run(); }
b0363de0-fc30-464a-a63a-e122d3345333
7
public static void main(String[] args) { //Define loop for number of eggs in the basket for (int eggs = 0; eggs > -1; eggs++) { //Check if the number of eggs in the basket has the correct remainder when removing eggs if (eggs % 2 == 1 && eggs % 3 == 2 && eggs % 4 == 3 && eggs % 5 == 4 && eggs % 6 == 5 && eggs...
ec652e71-7da3-447f-a018-76c9a86d5c79
7
@SuppressWarnings("unchecked") private void parseQuery(String query, Map parameters) throws UnsupportedEncodingException { if (query != null) { String pairs[] = query.split("[&]"); for (String pair : pairs) { String param[] = pair.split("[=]"); ...
5df985b7-7210-42eb-965e-f8c527f71b9b
9
public byte[] data() { if (buffer == null) { buffer = new byte[FastConfig.HeaderLength]; } int count = 0; byte[] temp = MiscUtils.toByteArray(high); for (int i = 0; i < temp.length; i++) { buffer[count] = temp[i]; count++; } te...
4e678d88-2224-40a7-b1f2-7b471e6c1657
2
private static BasicBlock getBBlock(Mark m) { BasicBlock b = m.block; if (b != null && m.size > 0) { b.exit = m.jump; b.length = m.size; b.stop = m.alwaysJmp; } return b; }
cb45186b-9869-497e-9347-5490898e008c
8
@Override public void e(float sideMot, float forMot) { if (this.passenger == null || !(this.passenger instanceof EntityHuman)) { super.e(sideMot, forMot); this.W = 0.5F; // Make sure the entity can walk over half slabs, // instead of jumping return; } EntityHuman human = (EntityHuman) this.passe...
e3a6627c-5f91-4fac-9b99-92b8657870eb
5
private void removeJSR(FlowBlock tryFlow, FlowBlock subRoutine) { for (Jump jumps = tryFlow.removeJumps(subRoutine); jumps != null; jumps = jumps.next) { StructuredBlock prev = jumps.prev; prev.removeJump(); if (prev instanceof EmptyBlock && prev.outer instanceof JsrBlock && ((JsrBlock) prev.outer).is...
aefff3e2-b888-4c77-bc0b-250d5c55621d
8
public void mergeArray(int low, int middle, int high) { /** * Copying the whole set of values first. */ for (int i = low; i <= high; i++) { this.auxArray[i] = this.array[i]; this.arrayAccess += 2; } /** * Copying the indices for the le...
87e5dff7-ed32-44a1-8ecc-3c862a8444b4
4
private synchronized boolean handleReservationJob(Gridlet gridlet) { int reqPE = gridlet.getNumPE(); SSGridlet sgl = new SSGridlet(gridlet); long runTime = super.forecastExecutionTime(ratingPE, sgl.getLength()); ServerReservation sRes = reservTable.get(gridlet.getReservationID()); //--...
61bd3715-5f64-4f98-808d-2b1c00bfd47b
3
public HashSet<String> generateCSVFromXML(String fileName, String csvFileName){ HashSet<String> stopwords = new HashSet<String>(); HashSet<String> productNameToWords = new HashSet<String>(); WordCleaner wc = new WordCleaner(); String stopwordFile = "xbox/stopwords.txt"; stopwords = getStopwords(stopwords, sto...
09ee9508-7687-4577-9955-81b38bcd7c4f
2
public static TestSettings findStoryboardById(ArrayList<TestSettings> storyboards, int id) { for(TestSettings storyboard:storyboards) { if(storyboard.getId()==id) { return storyboard; } } return new TestSettings(); }
f50c6f61-1e88-42c0-99b1-67f6568fa708
8
public Player(int _playerId) { playerId = _playerId; playerRights = 0; for (int i=0; i<playerItems.length; i++) { playerItems[i] = 0; } for (int i=0; i<playerItemsN.length; i++) { playerItemsN[i] = 0; } for (int i=0; i<playerLevel.length; i++) { if (i == 3) { playerLevel[i] = 10; } else {...
97b6b4f0-a8c8-4c05-b983-025898d275c7
6
private void usernameKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_usernameKeyPressed if(evt.getKeyCode() == KeyEvent.VK_ENTER){ try { String name=username.getText(); String pass=password.getText(); String checkname = null; Strin...
1c525f0a-188f-4eaf-a8cb-3f3e8db7427f
6
public static double getSpeedMod(WeaponMaterial type) { //Higher numbers means slower switch (type) { case COPPER: return 1.1; case BRONZE: return 1.1; case SILVER: return 1.2; case IRON: return 1; ...
7527f1a9-161b-4c96-94ab-c2ab31ddc2b5
5
private static <E> void merge(E[] array, E[] temp,int begin, int end, Comparator<E> comparator){ int i = begin; int tracker = begin; int middex = (begin+end)/2; int rightstart = middex+1; // Goes through and compares the two segments of the array that we are focusing on...
cb64e953-7178-46ec-8dbc-367227cf3fba
8
private void writeExamples() throws Exception { int i; Vector<String> v = m_parent.getTagTextVector(m_doc, Constants.TAG_EXAMPLE, true); Vector<String> vc = m_parent.getTagTextVector(m_doc, Constants.TAG_EXAMPLE_CODE, true); Vector<String> vd = m_parent.getTagTextVector(m_doc, Constants.TAG_EXAMPLE_DESCRIPTION,...
05ae5348-32f0-47f7-ba94-cb8f11076691
2
private void init(Class<?> clazz, String conventionalName) { final URL resource = clazz.getResource(conventionalName); loader.setLocation(resource); try { loader.load(); } catch (IOException e) { throw new IllegalStateException("Cannot load FXML login screen", e); } }
8b380f37-ac5e-4683-aa12-65795e98e256
6
public Vector<String> readScriptFile(File f) { Vector<String> actions = null; BufferedReader reader = null; try { if (f.canRead()) { actions = new Vector<String>(); reader = new BufferedReader(new FileReader(f)); String line = reader.readLine(); while (line != null) { actions.add(line); ...
042ad3c5-1417-4943-876f-a1ff7f52ebea
4
public static void gotoNextLevel(GameStateManager gsm){ //save world we are currently in World cw = (World)gsm.getGameState(gsm.getCurrentState()); Save.writeWorld(cw, index); Save.writePlayerData(cw.getPlayer()); //get gametime to transfer to the new world and continue counting int time = cw.GameTime; ...
d7e69203-a923-40e0-ae03-e04fd27b0c18
3
public String render(){ StringBuilder res = new StringBuilder(); if(statusCode != 0) res.append("HTTP/1.0 ").append(statusCode).append(" \n"); if(header == null) res.append(body.render()); else if(body == null) res.append(header.render()); else...