method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a8e42325-f9be-46cc-961c-c92fdc96df25
4
@Override public void actionPerformed(ActionEvent e) { String u, p; if (e.getSource()==signbtn) { u = usertxt.getText(); p = pwtxt.getText(); if (u.equals("admin") && p.equals("123")) { MainWindow s = new MainWindow("หน้าหลัก"); } else JOptionPane.showMessageDialog(null, "Login Fa...
77583eda-6919-443a-9740-dd23d0a6241f
0
public String getName() { return name; }
bad5e3fa-2ec4-42f8-ac2c-527eba70ff68
4
public static Boolean isEnOrCn(String str) { Boolean result = true; for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); Boolean isEn = CharUtil.isEnChar(ch); Boolean isCn = CharUtil.isChineseChar(ch); Boolean isBlank = CharUtil.isBlankChar(ch); if ((isEn || isCn || isBlank) == false) {...
de941dcf-5a8a-4185-a3de-c4cc8aa1bd74
5
@Override public ReduceUnit next() { List<String> values = new ArrayList<String>(); RecordReaderWrapper rrw = priorityQueue.poll(); String key = rrw.record.getKey(); values.add(rrw.record.getValue()); //System.out.println("next Key:" + key); while(true){ ...
f5536303-beb5-4e04-9818-662f8546f984
1
public void resetWallObject(int x, int z, int y) { GroundTile grondGroundTile = groundTiles[z][x][y]; if (grondGroundTile != null) { grondGroundTile.wallObject = null; } }
7eef6209-1482-4163-8710-899a9f0ceb0a
4
public static int getMapping(String key) { String value = props.getProperty(key).toUpperCase(); if (value.length() == 1) return value.charAt(0); else if ("MOUSE_LEFT".equals(value.toUpperCase())) return InputEvent.BUTTON1_DOWN_MASK; else if ("MOUSE_RIGHT".equals(value.toUpperCase())) return InputEvent...
41dacd9d-40e8-44f9-a0f7-0fc2f956d8da
0
public String getCap() { return cap; }
e2eae9f6-9298-4beb-ae29-f65473be931c
6
private void addNewNeuron(){ Neuron worst_neuron1=null, worst_neuron2=null; /* * We search for the worst neuron */ double worst_dist1 = erreurs.get(0); worst_neuron1 = neurons.get(0).get(0); for (int i = 1 ; i < neurons.get(0).size() ; i++) { if (erreurs.get(i) > worst_dist1) ...
31a30d72-f93c-4dfe-8c55-3fa6dc2aff11
2
@Override public void liiku() { for (KentallaOlija osa : osat){ osa.liiku(); } for (Raaja raaja : raajat){ raaja.kasvataKulmaa(); } paivitaMinMax(); }
8b2e54ec-1129-44f7-bfa8-11dbad1d9785
0
public void mouseReleased(MouseEvent e) { }
4c9138e3-c09b-428c-916f-fd17d1cfa9df
3
private static byte val(byte foo){ if(foo == '=') return 0; for(int j=0; j<b64.length; j++){ if(foo==b64[j]) return (byte)j; } return 0; }
6472a93c-09f9-42b5-af62-d6f6162b65bc
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...
cd5e7257-df97-4fb2-bc96-9de110f9fdd2
6
public static String camelFromUnderscore(String str) { if (str == null || str.length() == 0) { return str; } char[] ar = str.toCharArray(); int backref = 0; ar[0] = Character.toLowerCase(ar[0]); for (int i = 0; i < ar.length; i++) { if (ar[i] == '_...
4a3c3c9f-8889-4f5b-958a-f4cfeb52e0e4
4
public void dfsVisit(GraphNode GN, int depth){ GN.colour(depth); buffer.add(GN); ArrayList<GraphNode> children = GN.getChildren(); for(int i=0; i<children.size(); i++){ if((children.get(i).getColour()==0)&&(children.get(i).getChildren()!=null)){ dfsVisit(children.get(i), depth...
0434fb4c-b09c-45d2-ae4e-e7b754ef252b
4
public final JSONWriter key(String s) throws JSONException { if (s == null) { throw new JSONException("Null key."); } if (this.mode == 'k') { try { stack[top - 1].putOnce(s, Boolean.TRUE); if (this.comma) { this.writer.w...
d2f9f09d-11df-45c9-8471-3bca6e116e1c
7
public static String extractModuleNameFromStream(InputStream stream) { { Stella_Object tree = null; SExpressionIterator iter000 = InputStream.sExpressions(stream); int i = Stella.NULL_INTEGER; int iter001 = 1; int upperBound000 = 20; for (;iter000.nextP() && (iter001 <...
64550388-b492-4961-aa57-ba344f2e161e
5
static boolean recruit(Clan recruiter, WarQuest root) { if (recruiter.myOrder() != null) { Set<Clan> followers = recruiter.myOrder().getFollowers(recruiter, false, false); //TODO should get all DefendPatrons first... otherwise guy with some defenders but lots of non defendes has low chan for (Iterator<Clan> ...
43558dd4-6bfe-4655-9f0d-bbcfdf8f7bc9
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); addActionListener(this); }
265b512c-c852-433b-b954-df33231a9b09
7
public String affiche(){ String res = ""; if(this.mapDeterminise != null){ res += "Map determinisation :\n"; Set<EnsEtat> listEns = mapDeterminise.keySet(); for(EnsEtat ens : listEns){ res += "["+ens.listEtats()+"="+mapDeterminise.get(ens).hashCode()+"]"; } res += "\n"; } if(this.mapUnio...
2e9df6a6-b326-42e0-84a3-027d5a54bf56
5
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); d: do { line = br.readLine(); if (line == null || line.length() == 0) break d; int times = Integer.parseIn...
1ca01c1a-296f-45ab-a1c1-fa36e671ece1
1
public void suivant() { String numeroString = (String) this.vue.getjTextFieldNum().getText(); indicePraticienCourant = Integer.parseInt(numeroString)-1; if (indicePraticienCourant == lesPraticiens.size()-1) { indicePraticienCourant = 0; } else { indicePra...
33dd90e6-3b54-4b88-a558-56aa9236ba8d
6
public void keyPressed(KeyEvent e) { int offset = (e.getKeyCode() == KeyEvent.VK_UP) ? (-7) : ((e .getKeyCode() == KeyEvent.VK_DOWN) ? (+7) : ((e.getKeyCode() == KeyEvent.VK_LEFT) ? (-1) : ((e .getKeyCode() == KeyEvent.VK_RIGHT) ? (+1) : 0))); int newDay ...
962cf92d-f107-4228-8574-8f5cc99618c9
3
@Override public void run() { try { for (int i = 0; i < 5000; i++) { Object object = new byte[1024 * 10]; //Usar la memoria if ((i % 2) == 0) { System.out.println("Añadiendo objeto permanente:" + i); ...
4e607aa7-164e-4ad5-a498-7ce08f1bf29e
8
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { this.sender = sender; player = (sender instanceof Player) ? (Player) sender : null; if (player == null) { error("/gate cannot be used from the console"); return true; } if (!isPermitted("gate", (args....
52d1ed20-71f9-4ab6-9177-aa0ac7c5caaa
3
public static void searchDirectory(String dir) { try { BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8); prop.load(reader); reader.close(); prop.setProperty("searchDirectory", dir); BufferedWriter writer = Files.newBuffered...
3dea96fe-5e4c-4a47-afd5-eceb990b91da
9
public Room newRandomRoom() { Room newRoom = null; Cell theDoor = (Cell) chooseRandom(mapFreeWalls); int offsetX = 0; int offsetY = 0; int doorX = theDoor.getX(), doorY = theDoor.getY(); // East if (getTile(doorX + 1, doorY) == TILE_EMPTY) { offsetX ...
32b2ebd8-4cd5-48de-984e-8acb418eb350
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double) o).isInfinite() || ((Double) o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); } } else if (o instanceof Float) { if (((Float) o).is...
ff5d3d61-2283-4803-80c6-d4c1d79d9094
6
public static void combineFiles(String dir, String outputTxt) throws IOException { File directory = new File(dir); File file = new File(outputTxt); if (!file.exists()) { file.createNewFile(); } File[] files = directory.listFiles(); BufferedWriter bw = new BufferedWriter(new FileWriter(file)); for (F...
bd90bbb9-5e68-40b1-84d2-d51ac2397617
8
public Set<Map.Entry<Long,Double>> entrySet() { return new AbstractSet<Map.Entry<Long,Double>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TLongDoubleMapDecorator.this.isEmpty(); } p...
dbcaad2e-0ad3-4c35-acc3-0227fdd2713d
2
public void parameterList() { if(have(NonTerminal.PARAMETER)){ //expect(NonTerminal.PARAMETER); parameter(); while(accept(Token.Kind.COMMA)){ have(NonTerminal.PARAMETER); parameter(); } } }
00ff352e-14e2-4c95-9993-ae1065b9f4db
7
@EventHandler public void GhastSlow(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Ghast.Slow.DodgeCh...
ec682565-d99e-4b15-b2d8-c78ae7f5d795
8
public static double findKth(int A[], int B[], int initA, int endA, int initB, int endB, int k){ int m = A.length; int n = B.length; int K = k + 1; if(m == 0){ return B[initB + k]; } if(n == 0){ return A[initA + k]; } if(K == 1){ ...
53d5385e-eadf-4b6a-80a1-6b4f177563c1
1
private void onError(Throwable t, String message) { if (callback != null) { callback.onError(t, command, message); } else { BukkitCLI.getPlugin().getLogger().warning(message); } }
656b3fdb-7fbf-40ce-9076-d10493122def
9
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int t = Integer.parseInt(line); for (int tt = 0; t...
482542d8-3211-46b8-91c2-bc1e4f71c883
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; IndexedBean1 other = (IndexedBean1) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name...
0a980dbe-3570-43df-bc7b-946595224a23
9
private Stack<Symbol> insertSymbolByPrecedence(Symbol symbol, Stack<Symbol> parseTree) { if (!parseTree.empty()) { // If last element was a number, then make that our left Symbol parent = parseTree.peek(); Symbol child = parent.right; if (child != null) { ...
968013a8-ff10-4845-9247-f10fd16cd5b0
8
public AlumnoVO[] consultar(AlumnoVO alumno) { String query = "SELECT * FROM alumnos \n WHERE "; Statement consulta = Conexion.getConexion().hacerConsulta(); AlumnoVO[] a = new AlumnoVO[1]; if(alumno.getMatricula() != null){ query += " CAST(matricula AS char) LIKE '" + alumno.getMatricula() + "%' AND"; ...
146f38ba-8e5b-4231-aabb-b75a28624136
0
public void accept(OperationVisitor visitor){ visitor.visit(this); }
0809639c-67ac-4f6d-8b75-8df40480406d
6
@Override public String toString() { return String.format("%s\t%s\tGET=%s\tPOST=%s\tPUT=%s\tDELETE=%s\n", getName()==null?"":getName(), getSubject().getResourceURL()==null?getSubject():getSubject().getResourceURL(), allowsGET()==null?"":allowsGET(), allowsPOST()==null?"":allowsPOST(), allo...
d2d01b7d-bf99-4fe6-8bb1-31ce944c1b51
5
public static void newStartMenu(Game game, Screen parent) { try { pokemonMenuClass.getConstructors()[0].newInstance(game, parent); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTr...
946eb49b-ae3e-4010-8d77-09c7d5a496cc
9
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Produto other = (Produto) obj; if (codigo != other.codigo) return false; if (descricao == null) { if (other.descricao != null) return false; }...
466bd8d6-350b-46a7-a29b-99419f307c00
2
public Deck() { karten = new ArrayList<Karte>(); for(Farbe farbe : Farbe.values()) { for(Typ typ : Typ.values()) { karten.add(new Karte(farbe,typ)); karten.add(new Karte(farbe,typ)); } } Collections.shuffle(k...
ed50684e-3234-4eb7-b127-b7835ff39927
9
public static void main(String[] args) throws Exception { System.out.println("LOADING GRAMMAR...\n\n"); Grammar gr = new Grammar(); gr.loadFromFile("grammar2.txt"); System.out.println("\nINITIALIZING PARSER...\n\n"); LLOneParser parser = new LLOneParser(gr); System.out.println("\nCREATING FIRST......
3c53677d-5d50-4fe2-80b9-71a1840d9492
5
private boolean skipTo(String toFind) throws IOException { outer: for (; pos + toFind.length() <= limit || fillBuffer(toFind.length()); pos++) { if (buffer[pos] == '\n') { lineNumber++; lineStart = pos + 1; continue; } for (int c = 0; c < toFind.length(); c++) { ...
a3cc66a3-0886-4588-82b1-f2d7caac135f
1
public char getc() { char c = buf[idx]; if (idx < len) { idx++; } return c; }
ccb5c0af-5582-4381-b798-f25e0bbf0950
4
public boolean shoot(Player player, ArrayList<Projectile> projectileList, boolean leftShoot, boolean rightShoot, boolean upShoot, boolean downShoot) { if(leftShoot) { projectileList.add(new Projectile((player.getX()+player.getWidth()/4), (player.getY()+player.getHeight()/4), -15, 0, false, "res/images/40x10greenL...
251a7cc9-3f03-44c2-b59b-94dc9974ff0c
2
@Override public int hashCode() { int result; long temp; result = saleId; result = 31 * result + itemId; result = 31 * result + (name != null ? name.hashCode() : 0); temp = percent != +0.0d ? Double.doubleToLongBits(percent) : 0L; result = 31 * result + (int) ...
425ddd9f-5949-4747-9e9f-81a28e9d8899
2
public static ArrayList ordering(){ ArrayList list = new ArrayList(); boolean running = true; double num; while(running){ System.out.println("Type a number to add it to the list:" + "\nType anything else to display th...
0babe9d8-318f-4bbc-96ff-4b8ac66d0b5a
6
@Override public ArrayList<Integer> findTasksId(int id_user) { ArrayList list = new ArrayList(); try { connection = getConnection(); ptmt = connection.prepareStatement("SELECT id_task FROM Task_executors WHERE id_user=?"); ptmt.setInt(1, id_user); resu...
b733393c-3eef-4040-8259-5e6f83f35793
7
@Override protected void paintComponent(Graphics g) { // Vehicle Size 4 => 4*4px int vehicleSize = 4; // Paint Component super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; // Draw Vehicles (Different Color for Vehicle Speed) for(Vehicle vehicle : vehi...
128814ae-413b-49ce-a79d-c98c9de06dbc
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...
28ba20ad-5c8d-4a98-bf02-c8a8a31bc337
5
public int performShot(){ Debug.game("'" + dealingPlayer.username + "' performing droid shot with " + directions.length + " steps"); int range = 3; int damage = 22; int validStepsTaken = 0; if(level == 2) {damage = 24; range = 4;} if(level == 3) {damage = 26; range = 5;} Tile currentTile = position; for(i...
0575439e-32dd-4b54-8811-8b4accde50e9
3
private boolean verifierSelection(Type[] types, int ID) { boolean ok = false; Type verification = cc.getCircuit().getCompEmp(ID).getType(); for (Type t : types) { if (t == verification) { ok = true; } } if (!ok) { JOptionPane.sh...
63567369-100e-4042-9e4b-a40709b1e554
6
private static int descToTag(String desc, int i, int n, TypeData[] types) throws BadBytecode { int i0 = i; int arrayDim = 0; char c = desc.charAt(i); if (c == ')') return 0; while (c == '[') { ++arrayDim; ...
0d0e89d2-03c8-42ab-932a-1afef5dc8ecd
9
static byte ButtonFix(byte data, String kierunek) { if (kierunek.equals("right")) { if (data == 3) { return 2; } if (data == 2) { return 4; } if (data == 4) { return 1; } if (data == 1) { return 3; } } else...
d3f97672-f92c-477f-b6d3-ebeed2dabc70
9
private boolean traverseInternally(TagNodeVisitor visitor) { if (visitor != null) { boolean hasParent = parent != null; boolean toContinue = visitor.visit(parent, this); if (!toContinue) { return false; // if visitor stops traversal } else if (has...
a12d8898-de0c-40a1-ab89-1582e41d7ef2
1
public String toString() { String x = "(lines"; for (int i = 0; i < lineNumbers.length; i++) { x += "\n (line #" + lineNumbers[i].lineNumber() + " pc=" + lineNumbers[i].startPC() + ")"; } return x + ")"; }
ea838435-7295-4af5-aca3-a81a02b3de17
6
public int getBlockMetadata(int var1, int var2, int var3) { if (var1 >= -32000000 && var3 >= -32000000 && var1 < 32000000 && var3 <= 32000000) { if (var2 < 0) { return 0; } else if (var2 >= 128) { return 0; } else { Chunk var4 =...
50bb5a18-a1a0-481e-9717-eea0f01933dd
2
public boolean prime() { boolean didPrime = false; if (_shots > 0 && _ammo == null) { didPrime = true; _ammo = new Gumball(_ammoImage, getPosX(), getPosY(), 0, 0, GameSettings.GUMBALL_MASS); _shots--; } return didPrime;...
5d00cd70-1225-4cf9-b5c1-ecffcb391e0a
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...
7dcd22cb-6909-4e74-b8ea-f69946ac01e5
0
public void setPriority(int priority) { Priority = priority; }
8888362c-55aa-407a-825a-419fa90acdf0
5
@Override public void clientConnected(Client client) { if (isLocalHost(client)) { boolean notifyHostAdded = (getLocalHost(false) == null); Host host = getLocalHost(true); for (AndroidDeviceClient device : client.getDeviceList().values()) { Device dev = createDevice(device); if (!host.getDevices().co...
977ceefa-494c-4aad-a8f8-4c9091768caa
0
public String getSmartDashboardType() { return "Speed Controller"; }
8618eeb6-9e64-4611-a175-d03e994e3372
8
public static void main(String[] args) { String[] cards = { "2", "3", "4", "5", "6", "7" ,"8", "9", "10", "J","Q", "K", "A",}; char[] suits = { '♣', '♦', '♥', '♠' }; int count = 0; String[] results = new String[5]; for (int i = 0; i < cards.length; i++) { for (int j = 0; j < cards.length; j++) { i...
3b4ed61e-7ae4-47b0-8054-ba631ceb6b46
8
final public static FormattingTuple arrayFormat(final String messagePattern, final Object[] argArray) { Throwable throwableCandidate = getThrowableCandidate(argArray); if (messagePattern == null) { return new FormattingTuple(null, argArray, throwableCandidate); } if (argArray == null) { ...
fabf9dad-ec97-4996-8bdb-c9f1baeb53a7
5
public static String pformat(Collection<?> c) { if(c.size() == 0) return "[]"; StringBuilder result = new StringBuilder("["); for(Object elem : c) { if(c.size() != 1) result.append("\n "); result.append(elem); } if(c.size() != 1) result.append("\n"); result.append("]")...
140df3ab-ec62-4ba7-8713-67c95e566048
7
@Override public boolean tick(Tickable ticking, int tickID) { if(!(affected instanceof MOB)) return super.tick(ticking,tickID); final MOB mob=(MOB)affected; if(((CMLib.flags().isSitting(mob))||(CMLib.flags().isSleeping(mob))) &&(!mob.isInCombat()) &&((mob.fetchAbility(ID())==null)||proficiencyCheck(nul...
0c20f564-2206-418c-ae80-d128195a1718
1
public int peek() throws IOException { if (!cached) { cached = true; value = next(); } return value; }
9d10f389-c26b-460b-b2b4-5588308068ff
4
public void accessAll() { //current linked list ListNode newNode = null; int accessed = 0; //loop over all data in the table for(int i = 0 ; i < hashListSize ; i ++) { //if linked list at given point is not null continue if(hashlist[i]!=null) { //set linked list and iterate over the list size ...
2c1da11d-dacc-4173-be16-54a37f0fe7f5
4
private void btnGuardarProveedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarProveedorActionPerformed LinkedList<Servicio> servicios = obtenerServicioSeleccionados(); String nombre = this.txtNombreProveedor.getText(); String direccion = this.txtDireccionProveedo...
a5f4b662-266c-4b23-97e5-b0758571e8dd
3
@Override public void doAction(Player player, Grid grid) throws InvalidActionException { if (player.getRemainingTurns() <= 0) throw new InvalidActionException("The player has no turns left!"); if (!player.hasMovedDuringTurn()) throw new InvalidActionException("The player has not moved yet during his turn!");...
b7e639c3-bde6-44fa-aae8-be570528f942
2
public boolean isAvailableUnit(int x, int y) { final UnitModel unit = field.getUnit(x, y); if (unit == null) { return false; } if (unit.getTeam() != currentTeamTurn) { return false; } return true; }
65604067-3157-444e-a3a1-c0415968786b
5
public void putField(Reference ref, Object obj, Object value) throws InterpreterException { Field f; try { Class clazz = TypeSignature.getClass(ref.getClazz()); try { f = clazz.getField(ref.getName()); } catch (NoSuchFieldException ex) { f = clazz.getDeclaredField(ref.getName()); } } catch ...
2786b39e-fd5e-4d2b-b12f-f4f58fa11bf4
2
@Override public void setCourseNumber(String courseNumber) { if(courseNumber == null || courseNumber.length() == 0) { JOptionPane.showMessageDialog(null, "Error: courseNumber cannot be null of empty string"); System.exit(0); } this.courseNumber = c...
475ce161-c251-4a5f-8098-efd84a2e975d
7
public void insertReplication(IInsertDeleteReplicationRequest req) throws RemoteException { String key = req.getKey().trim(); String value = (String)req.getValue(); int serverId = getServer(key); // drop the package, if the request is visited all servers if(req.getProbe().contains(this.myId)){ handleMe...
fcf7563a-022e-4122-b45f-69d9982f00ac
3
public Label(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "for": forr = For.parse(this, v); break; case "form": form = Form.parse(this, v); break; } ...
ce327044-5721-4842-b762-867592b83470
4
public void dropSelectedItem() { if (!player.isFrozen() && player.getInventoryItems().size() > selectedIndex && player.getInventoryItems().get(selectedIndex) != null && board.tileAt(player.getLocationInFrontOf()).isClear()) { client.dropItem(selectedIndex); } }
b6ec1d21-e102-4a86-b7aa-ddcf251357d0
7
public String getter(Object obj) throws IllegalArgumentException { Method getMethod = getGetMethod(); Class<?> fieldType = getMethodReturnType(getMethod); if (fieldType == String.class) { try { return (String) getMethod.invoke(obj); } catch (Excep...
2c2867d3-5b19-49b3-8f39-fe7302fa9616
9
private void firstTurn( MultiServerThread m){ Player p = m.getPlayer(); print(m, p.getName() + " - YOUR FIRST TURN\n"); print(m, "VICE ADMIRAL SHELLEY: Hello Commander, it's a fine day for some shelling, don't you agree?"); input(m); print(m, "VA: Well, let's get down to business, sir. "); boolean horizonta...
27013138-6ea3-495e-8475-b4c906fffc63
9
protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption) { init(); this.options = options; // an iterator for the command line tokens Iterator iter = Arrays.asList(arguments).iterator(); // process each command line token while (iter....
ba27af08-e8d4-4af1-82e9-34561652096b
4
public static void main(String[] args) { int num = 7; Set<String> capitals = Countries.capitals(num).keySet(); ArrayList<String> arrayList = new ArrayList<String>(capitals); LinkedList<String> linkedList = new LinkedList<String>(capitals); System.out.println(arrayList); S...
2acd9545-5883-4c72-9d25-c6c9d694fde4
5
private void executePowerup(){ switch (powerup.getPowerupType()){ case LONGER_PADDLE: paddle.makeLong(); if (paddle.getCurrentCoordinate().getX()+paddle.getLength()>windowWidth){ //If the paddle moves out of the window when it extends it gets moved...
be284a47-1885-4304-98ec-638d9413893d
0
@RequestMapping(value = "/hall-event-creator-list/{hallEventId}", method = RequestMethod.GET) @ResponseBody public PartnerListResponse hallEventCreatorList( @PathVariable(value = "hallEventId") final String hallEventIdStr ) { return typedPartnerList(hallEventIdStr, PartnerRole.CREATOR_RO...
dce025b2-8f3f-4ed3-add2-4a2a5960a3a1
4
@Override public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == m_timer) { //on each tick, update all objects m_currentTime = System.currentTimeMillis(); double timeDelta = m_currentTime - m_prevTime; Update(timeDelta); ProcessInput(); m_prevTime = m_current...
d77e34f1-5b09-4b7f-9128-480047ea8866
9
public static int minResult(String e) { ArrayList<Character> signos = new ArrayList<Character>(); ArrayList<Integer> nums = new ArrayList<Integer>(); char cad[] = e.toCharArray(); for (int i = 0; i < cad.length; i++) { if (cad[i] == '-' || cad[i] == '+') { signos.add(cad[i]); } } String r[] = e.sp...
fdc1289c-2155-44a6-8bb8-db2ebd0b29de
4
private int listContains(List<int[]> info, int x, int y, int len) { for (int i = 0; i < info.size(); i++) { int[] row = info.get(i); if (row[0] == x && row[1] == y && row[2] == len) { return i; } } return -1; }
af254f66-8a69-4bc2-af69-602541093343
1
public static void main(String[] args) throws IOException { // Show what command line arguments to use if (args.length == 0) { System.err.println("Usage: java ArithmeticCompress InputFile OutputFile"); System.exit(1); return; } // Otherwise, compress File inputFile = new File(args[0]); File outp...
3294dfe7-34cf-4fd6-819d-959560376f8d
8
public void updateFog(Unit u, int x, int y){ //what fog node was the unit standing on? if(x<0 || y<0 || x>=fogAmount || y>=fogAmount){ return; } FogNode current = fog[u.fogX][u.fogY]; if(u.team==playerTeam){ updateVision(current, -u.sight); } Node oldNode = ...
b29c5421-db1b-447d-808f-547a65655a9c
0
public void setFunHabilitado(String funHabilitado) { this.funHabilitado = funHabilitado; }
56891d28-874a-4a33-bbdd-5d02b3da1dc4
9
protected Instances[] splitData(Instances data) throws Exception { // Allocate array of Instances objects Instances[] subsets = new Instances[m_Prop.length]; for (int i = 0; i < m_Prop.length; i++) { subsets[i] = new Instances(data, data.numInstances()); } // Go through the data for (int...
74707231-2c9e-4fa8-bf39-2c656f08f623
8
public ArrayList getConnectedNeurons(int neuronNumber) { ArrayList connectedNeurons = new ArrayList(); if ((neuronNumber < colNumber * rowNumber) && (neuronNumber > 0)){ if (neuronNumber - colNumber > 0) { connectedNeurons.add(neuronNumber - colNumber); } ...
ef8d3128-e76b-4354-95c3-04bb28554b69
3
@Override public String toString() { switch (this){ case DOES_NOT_MATTER: return "*"; case ONE: return "1"; case ZERO: return "0"; default: return ""; } }
9a8ac832-1c4b-45fc-8241-2b2019013c57
8
public static boolean declarationTreeP(Cons tree) { { Stella_Object operator = tree.value; if (Symbol.declarationOperatorP(((Symbol)(operator)))) { return (true); } if (operator == Stella.SYM_STELLA_PROGN) { { boolean foundP000 = false; { Stella_Object subtree = null; ...
29b2fcd2-dc92-4be4-abfc-677b840dd300
5
public List<Kli> gatherChildren(List<Kli> klis){ for(int i = 0; i < klis.size(); i++) { klis = this.addKlis(i, klis) ; } List<Kli> remove = new ArrayList<Kli>(); for(Kli parent : klis) { for(Kli temp : klis) { if (temp.getParentTermCode()==parent.getTermcode()&&klis.contains(temp)){ remove....
24f9c866-7fd4-4431-8b55-6999c9f831ee
5
public ArrayList<Sales> salesForIndividualItemNum(ArrayList<Sales> als) { int itemChoice = 0; System.out.println("Enter the item number of the inventory item you would like to view."); boolean again = true; while(again) { try{ itemChoice = input.nextInt(); again = false; } catch (InputMismat...
4ca837ca-ac21-4823-8179-431c7fb155cb
4
private float parametrixValue(float linearMapping, float t0, float t1, Vector extended) { if (linearMapping < 0 && ((Boolean) extended.get(0))) { return t0; } else if (linearMapping > 1 && ((Boolean) extended.get(1))) { return t1; } else...
02f83c05-2e41-43f7-ac44-456ce30a8904
5
private static void run() throws InterruptedException { while (!finished) { // Always call Window.update(), all the time Display.update(); if (Display.isCloseRequested()) { // Check for O/S close requests finished = true; } else if ...
e5b24e07-331a-451e-95f7-046814951273
9
public static Point girar(Point a, Point b, int num) { if (num > 1) b = girar(a, b, num - 1); Point res = null; int rX = Math.abs(a.x - b.x); int rY = Math.abs(a.y - b.y); if (a.x >= b.x && a.y >= b.y) { res = new Point(a.x + rY, a.y - rX, 1); } else if (a.x <= b.x && a.y >= b.y) { res = new Poin...
0ffadac9-bc31-4492-961f-838be502fbd2
6
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
5c182862-58ee-40bd-9911-743681297297
4
public double infoSpecific(Integer featureId, String value) { double result = 0D; for (String fValue : Feature.possibleFeatures.get(featureId).getPossibleValues()) { if (fValue.equals(value)) { double positive = 0.0; double negative = 0.0; for (ClassifiableObject co : partitionedObjects.get(fValue)) ...