method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
de51b594-a6f8-458f-be81-85b28c3897b5
0
protected boolean test1 () { return true; }
0d1e8a7f-27a3-4b0a-b0a6-6b53f200afe5
3
public void writeFile() { StringBuilder newLine = new StringBuilder(); EndCustomerList endCustomer = EndCustomerList.getInstance(); StringBuilder index = new StringBuilder(); index.append("Id"); index.append(Define.comma); index.append("Name"); index.append(Define.comma); index.append("StartTime"); ...
d7b9e772-a2ce-4f6a-bac2-f9a30a978003
3
public HEXRecord(String hexLine) { hexLine = hexLine.replace(":", ""); char[] hexData = hexLine.toCharArray(); contentLength = Integer.parseInt(new String(hexData, 0, 2),16); int addrPtr = 0; for(int i = 2; i < 6; i = i+2) { firstAddress[addrPtr] = Integer.parseInt(new String(hexData, i, 2),16); addrPtr...
f18be51c-5e12-4bdd-a768-3e92859de0b5
1
public boolean mousedown(Coord c, int button) { if (button != 1) return (false); a = !a; changed(a); return (true); }
b3cee7b3-c1eb-4ca0-a057-14ac5cc12ef7
5
public static void main(String[] args) { System.out.print("Bitte geben Sie Ihr Alter ein: "); int alter = Console.readInt(); System.out.print("Bitte geben Sie Ihren Tallienumfang in cm ein: "); int umfang = Console.readInt(); System.out.print("Bitte geben Sie Ihren Koerpergroesse in cm ein: "); int groesse ...
2e086c14-7589-4671-86ff-61d8706a2e76
2
private static double contrastValue(double pixel, int r1, int r2, int s1, int s2) { double m = 0; double b = 0; if (pixel < r1) { m = s1 / r1; b = 0; } else if (pixel > r2) { m = (Image.MAX_VAL - s2) / (Image.MAX_VAL - r2); b = s2 - m * r2; } else { m = (s2 - s1) / (r2 - r1); b = s1 - m *...
bf0fc2bd-e7e4-4cbd-a07a-efb53c8222bc
4
@Override public String getColumnName(int column) { String name = "?"; switch (column) { case 0: name = "Name"; break; case 1: name = "State"; break; case 2: name = "Crawling Progress"...
04a6d0ea-003f-4d88-8ec1-608400d1e8e4
4
@Override public void grad(double[] w, double[] g) { double[] y = prob.y; int l = prob.l; int w_size = get_nr_variable(); sizeI = 0; for (int i = 0; i < l; i++) { double d = z[i] - y[i]; // generate index set I if (d < -p) { ...
8ff8e012-acb6-48ce-be81-9c8e0689285e
1
public int getIndexOfChild(Object parent, Object child) { TreeElement[] childrens = getChildrens((TreeElement) parent); int i = Arrays.binarySearch(childrens, child); if (i >= 0) return i; throw new NoSuchElementException(((TreeElement) parent).getFullName() + "." + child); }
ac14f9a7-82a8-4c60-bd1c-c565b686bc5c
2
public void printSCCs(final PrintWriter pw) { final Collection equivs = this.equivalences(); // A Collection of Sets final Iterator iter = equivs.iterator(); pw.println("Strongly Connected Components of the SSAGraph"); for (int i = 1; iter.hasNext(); i++) { final Set scc = (Set) iter.next(); final Itera...
141966a3-aca2-4fbb-b64d-05733ade870d
9
public void update(int x, int y, int r) { this.visible = new boolean[world.getWidth()][world.getHeight()]; for (int i=-r;i<=r;i++) { for (int j=-r;j<=r;j++) { if (i*i+j*j>=r*r) continue; if (x+i< 0 || x+i>=world.ge...
bd2559a7-3915-4ab2-a082-e575024a83a8
6
public static void main(String[] args) { System.out.println("Implemented practicals: "); final HashMap<Integer, File> practicalMap = new HashMap<>(); for (final File f : practicals) { final String practicalNum = f.getName().substring("practical".length()); //print out the practical num System.out.println...
b5a320d5-1aec-4990-b717-590d9e0f4eed
2
public String toString() { StringBuffer result = new StringBuffer("["); for (int i = 0; i < stackMap.length; i++) { if (i > 0) result.append(", "); result.append(stackMap[i].getName()); } return result.append("]").toString(); }
6d81fb55-66d0-4db9-8eb9-b66ba2a6f9c4
0
@Override public void init(List<String> argumentList) { label = argumentList.get(0); }
494a9623-f163-45a0-80a4-55d7965a0500
4
private void tableHeaders(int type, PrintWriter webPageOutput) { //Title Line 1 Routines.tableDataStart(true,true,true,true,false,3,0,"scoresrow",webPageOutput); Routines.tableDataEnd(true,false,false,webPageOutput); Routines.tableDataStart(true,false,true,fals...
910a9e7a-a706-41d3-9a56-7056d4ddf00a
8
public ArrayList<String> capturaOperacaoMatematica() { criaListaBotoesOperacoes(); if (todasOperacoesSelecionadas()) { return operacoes(); } ArrayList<String> operacoes = new ArrayList<String>(); for (int i = 0; i < 4; i++) { if (selectedOperacoes.get(i)...
000fdfce-3190-4e3e-8ace-ee924ba8d710
6
public void followPlayer(Rachel r){ if(seePlayer(r)){ follow++; } if(follow > 0){ if(r.getY() > getY()){ setDown(true); } else { setDown(false); } if(r.getY() < getY()){ setUp(true); } else { setUp(false); } if(r.getX() < getX()){ setLeft(true); } else { se...
66e53e32-1409-4764-825b-dee1b963bd6d
8
private void loadKinds() throws DataException { for (final Kind parameterKind: parameterKindNamespace.objects()) if (!loadAsNewKind(parameterKind)) mapKnownName(parameterKind, kindMap, kindNamespace); // create aliases for (final Map.Entry<String, ? extends Kind> aliasEntry: parameterKindNamespace.aliases(...
b6ef6967-db7d-4dcb-9833-2935ab4ad5cb
0
public static void main(String[] args) { Pie p = new Pie(); p.f(); }
916a036f-3cb7-43cc-aaf3-b87546c7329e
1
public static void main(String args[]) throws MalformedURLException { // Uncomment this line to skip the 5 second splash screen. SKIP_LAUNCHER_SPLASH = 1; launcher = new Launcher(); mapWindow = new MapFrame(); if(SKIP_LAUNCHER_SPLASH == 0) { // Timer sequence launcher.setVisible(true); launc...
b971dbd4-d80f-4a65-be7a-8ac6e44bc9e9
4
public static String NodeToSPARQLString(Node n){ return (String) (n.isURI() ? ("<" + n + ">"): (n.isLiteral() ? ("\""+ n.getLiteralValue() + "\"" + (n.getLiteralDatatypeURI() != null ? ("^^<"+ n.getLiteralDatatype().getURI() + ">") : "")) : n.isBlank() ? n.getBlankNodeLabel() : n)); }
d9b57f2f-0ab6-4b9a-8515-4309b9f8daf8
4
public void cortarPelo(int cliente){ enter(); System.out.println("Entra Mr. " + cliente + " a la barbería y se pone en espera."); while(n_clientes != 0 || ocupado) pelarse.await(); if(!trabajar.isEmpty()){ System.out.println("Mr. " + cliente + " despierta al b...
277af38f-ee53-41d2-99c6-99945b135149
1
public String[] getSymbolsOnRHS() { ArrayList list = new ArrayList(); for (int i = 0; i < myRHS.length(); i++) { char c = myRHS.charAt(i); list.add(myRHS.substring(i, i + 1)); } return (String[]) list.toArray(new String[0]); }
dc28272b-02a1-4f72-9529-bd34513d8aed
3
public boolean isAnagram(String s1, String s2) { // remove whitespace s1 = filterString(s1); s2 = filterString(s2); if (s1.length() != s2.length()) { return false; } else { Map<Integer> s1Map = new Map<>(); Map<Integer> s2Map = new Map<>(); s1Map.insert(s1); s2Map.insert(s2); boolean match...
349fc545-dd92-4cba-8128-84f089d96af9
7
@Test public void testNotRespondingClient() { System.out.println("notResponsindClient"); try { final Counter counter = new Counter(); c.setAssignmentListener(new AssignmentListener() { @Override public void receiveTask(Assignment task) { ...
c68b5b1d-416a-4028-81c9-7041c37f1339
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...
68215043-9a51-49c0-bd4b-beb73852e392
3
public static PersonnelReasonEnumeration fromString(String v) { if (v != null) { for (PersonnelReasonEnumeration c : PersonnelReasonEnumeration.values()) { if (v.equalsIgnoreCase(c.toString())) { return c; } } } throw new IllegalArgumentException(v); }
14ab19e2-4c23-4f42-915d-4b82a8a2c75a
1
public String print() { String temp = ""; for(int x = 0; x<spells.size(); x++) { temp += spells.get(x).getName() + ";"; } return temp; }
b6f78a8d-3bd9-4144-80fc-6ac88d7e2cc9
4
public boolean disconnect() { if (this.isConnected()) { if (Variables.partOnDC) { for (final IRCChannel c : Variables.channels) { this.part(c); } } try { this.write("QUIT Leaving."); input.clo...
2cb33c72-2241-4c25-9cf6-0610f05ba625
9
public final void writeUTF(String str) throws IOException { int strlen = str.length(); int utflen = 0; for (int i = 0; i < strlen; i++) { int c = str.charAt(i); if ((c >= 0x0001) && (c <= 0x007F)) { utflen++; } else if (c > 0x07FF) { utflen += 3; } else { utf...
9a6b0e45-d142-40c6-bc94-03360f898af3
4
private Element iterativeCreateElement (Element elem, HashMap<String, String> hmap, Document wDoc) { String tagName = elem.getNodeName(); NodeList children = elem.getChildNodes(); Element writeElem = wDoc.createElement(tagName); for (int i = 0; i < children.getLength(); i++) { ...
d94369f7-8c2c-41af-b9e3-1185aefa8021
7
@Override public void publish(long sequence, Sequence lowerCursor) { int counter = RETRIES; while (sequence - lowerCursor.get() > pendingPublication.length()) { if (--counter == 0) { if (yieldAndCheckInterrupt()) return; counter = RETRIES; } } pendingPublication....
c7452eb1-eea6-4abe-880c-9cc7db30c46d
0
public void setNumberOfPoints(int count){ numberOfPoints = count; }
10b6264b-fa81-475e-b24a-8bf575a1dbd0
0
@Override public void openDoor() { System.out.println("B师傅是撬开门的!"); }
7d4742c6-bb85-45f7-a184-8766d06db596
8
public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) { this.plugin = plugin; this.type = type; this.announce = announce; this.file = file; this.id = id; this.updateFolder = plugin.getServer().getUpdateFolder(); final File pluginFile...
8bc0943b-ee9c-466d-8796-0befab326d40
6
private void assignNearbyMineValue(int mineLocX, int mineLocY) { // Assigns value to minLoc X & Y vars depending on location of the // selected cell on the board // Lowers the cells being verified accordingly to avoid out of bound // errors. int minLocX = 1; int minLocY = 1; if (mineLocX - 1 < 0) { mi...
aff64383-2fb6-434e-844f-a201feb891fb
3
@Override public CacheRequest put(URI uri, URLConnection conn) throws IOException { // only cache http(s) GET requests if (!(conn instanceof HttpURLConnection) || !(((HttpURLConnection) conn).getRequestMethod().equals("GET"))) { return null; } File localFile = getLocalFile(uri); if (localFile == nu...
d035df9f-a1fd-4f93-840a-8b74589b333f
3
public void loadAllOwnership() { String query = QueryGen.selectAllOwnership(); ResultSet data = query(query); while (iterateData(data)) { ChunkyObject owner = ChunkyManager.getObject(getString(data, "OwnerType"), getString(data, "OwnerId")); ChunkyObject ownable = ChunkyM...
3a9f8cd4-8200-4d88-90b2-e29f8f1d0544
8
public void openCell(int rowIndex, int colIndex, boolean showError) { System.out.println("Открываем ячейку [" + rowIndex + "][" + colIndex + "]"); if (checkIndex(rowIndex, colIndex)) { if (!field[rowIndex][colIndex].isVisible() && !field[rowIndex][colIndex].isFlag()) { switc...
1dc82f45-c013-4704-b21f-1a480df9e374
7
private void parseCommand(String commandsToParse) { if (commandsToParse.charAt(0) == '/') { String[] commands = commandsToParse.split(";"); if (commands[0].equalsIgnoreCase("/username")) { server.changeUsername(commands[1], client); } else if (commands[0].equa...
28b64e16-7a0f-4266-9a0b-e446b1844b62
2
void saveFormtoState() { state.getState_Properties().setName(textName.getText()); state.setIsFinalState(checkAccept.isSelected()); if(checkStart.isSelected()) dFAMainWin.getDfaSim().getDfa().setStartState(state); else if(state.getIsStartState()) dFAMainWin.get...
2a06d58f-c953-48f5-bc3b-8950c760b9dc
7
@EventHandler public void onPlayerInteract(PlayerInteractEvent e) { if (e.getPlayer().hasPermission("vanishtorch.use")) { if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) { if (e.getItem().getType() == Material.SUGAR) { ...
6a0764e1-7660-4b21-8510-d28db07d3680
4
int score(Varargs args) { int n = args.narg(); int s = n > fixedargs.length ? CoerceLuaToJava.SCORE_WRONG_TYPE * (n - fixedargs.length) : 0; for (int j = 0; j < fixedargs.length; j++) s += fixedargs[j].score(args.arg(j + 1)); if (varargs != null) for (int k = fixedargs.length; k < n; k++) s += varargs...
2f5cc932-4b67-4eee-9269-b34cd684e5e6
4
public static synchronized RegionFile getRegionFile(File basePath, int chunkX, int chunkZ) { File regionDir = new File(basePath, "region"); File file = new File(regionDir, "r." + (chunkX >> 5) + "." + (chunkZ >> 5) + ".mca"); Reference<RegionFile> ref = cache.get(file); if (ref != null...
d5a10f61-a58a-4e88-98fe-ac24e8d5583e
5
public static ArrayList <KeywordData> loadData() { File load = new File("resources/files/KeywordData/"); //Needed for Generic Enum Deserialization EnumDeserializer des = new EnumDeserializer(); DataDeserializer d = new DataDeserializer(); Gson loader = new GsonBuilder().registerTypeAdapter(java.lang.Enum.clas...
71104cfc-16ca-4e5c-b7df-fcd50a038960
5
private void getAlarmFromXml() throws SQLException, ParserConfigurationException, SAXException, IOException { ArrayList<Integer> alarmsFromSql = new ArrayList<Integer>(); Connection con = null; try{ con = getConnection(); Statement stmnt = con.createStatement(); ...
5b33067e-0664-4c9a-9ee6-43a7a1348408
4
public boolean reloadYMLConfig(String file) { if (!FileConfigs.containsKey(file)){ FileConfigs.put(file, new YamlConfiguration()); } try { Files.put(file, new File(plugin.getDataFolder(), file)); if (!Files.get(file).exists()) { InputStream r = plugin.getResource(file); if (r == null) re...
6323d301-114e-47ef-bd57-29a342bc1805
0
public void addPost(PostGeneral post) { posts.add(post); }
a0e46742-4623-4854-a29f-0e27b7324543
1
public static void main(String[] args) throws IOException, InterruptedException { // ServerSocket is a socket that listens ServerSocket serverSocket = new ServerSocket(8080);// ip is myself, use // port 8080 - // standard port for // listening int counter = 0; while...
d5071e10-4b79-4c6d-b648-5bfd2aeff905
5
public void toggleIntersectionColor(int x, int y, boolean b) { Intersection i = findIntersectionAtCanvasLocation(x, y); if (i != null) { if ((i.open && !b) || (!i.open && b)) { i.setOpen(b); i.setOpen(!b); } } }
7d2fb2b1-e459-4372-9329-b368f349dc3f
8
@Override public void update(int tick) { if(isControlled) { if(Settings.moveLeft.isPressed()) { vx = -speed; world.playerNoMoveTime = 0; } else if(Settings.moveRight.isPressed()) { vx = speed; world.playerNoMoveTime = 0; } else { vx = 0; } if(Settings.jump.isPressed() && onGround) ...
53ba7b35-ce31-4daa-8895-50ef09eb3638
7
public void javaOutputLiteral() { { CharacterWrapper character = this; switch (character.wrapperValue) { case '\'': ((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.print("'\\''"); break; case '\\': ((OutputStream)(Stella.$CURRENT_STREAM$.get())).nati...
4f47b7b9-9295-47e5-aad2-f5cc1a64213e
3
@Override public String toString(){ StringBuilder sb = new StringBuilder(); sb.append(getNameMode() + "\n\nRedSpawns:\n"); for(Location l : redSpawn){ sb.append(l + "\n"); } sb.append("BlueSpawns:\n"); for(Location l : blueSpawn){ sb.append(l + "\n"); } sb.append("MapElements:\n"); for(MapElement me : el...
ecd6813e-2555-4eab-ab50-2d4211df4059
6
private Rectangle BoundingRectOfPoints(LinkedList<Vector2> points) { Rectangle r = new Rectangle(); if (points.size() > 0) { Vector2 min = new Vector2(points.get(0).X, points.get(0).Y); Vector2 max = min.Copy(); ListIterator<Vector2> i = points.listIterator(); while(i.hasNext()) { V...
bafd570f-378a-4766-bd21-e19cfdd7ddce
6
@EventHandler public void SnowmanNausea(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.getsnowgolemConfig().getDouble("Snowman.Nau...
02de9b8c-850b-4097-a111-7b488f8a0bd1
4
public static void converge(int row, int col) { // makes row and col into 1 d arrays to check the specific column and row of the tile selected NumberTile[] tempRow = new NumberTile[4]; NumberTile[] tempCol = new NumberTile[4]; int i = 0; int y = 0; // for to create Row for (NumberTile element: tempRow)...
363fecf6-beca-4c11-98d8-2cf4382ee29e
9
Item newInvokeDynamicItem(final String name, final String desc, final Handle bsm, final Object... bsmArgs) { // cache for performance ByteVector bootstrapMethods = this.bootstrapMethods; if (bootstrapMethods == null) { bootstrapMethods = this.bootstrapMethods = new ByteVe...
242bd2cb-eb97-498a-804b-00acb1aa75e3
9
public void run() { String type = getText(); if (type.compareTo(DEBUG_STATES) == 0) { GEF.DebugToolStates = !GEF.DebugToolStates; } if (type.compareTo(DEBUG_FEEDBACK) == 0) { GEF.DebugFeedback = !GEF.DebugFeedback; } if (type.compareTo(DEBUG_PAINTING) == 0) { GEF.DebugPainting = !GEF.DebugPainting;...
b954ed62-79d9-4f7f-bbc2-91609cf431f0
2
@Override public void update(PositionChangedObservable observable) { if(observable != this && observable.getPositions().contains(position)) observable.accept(new CollideWithLightGrenadeVisitor(this)); }
8b3a6b71-fc69-4a11-b1e3-252e14bb52bf
8
@Override public void removeProperty(String path) { if (path.startsWith(".")) path = path.substring(1); // VERY EXPENSIVE MemoryConfiguration temp = new MemoryConfiguration(); setOptions(temp); Map<String, Object> values = config.getValues(true); if (values.containsKey(path)) values.remove(path); else{ ...
e359a400-6cec-4f62-9aa9-d2559bf40ca5
3
@Override public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int height = 10; int count = getComponentCount(); if (count > 0) { count = Math.min(getStep(), count); for (int i = 0; i < count; i++) { int tmp = getComponent(i).getHeight(); if (tmp > height) ...
0c5d7296-2719-4841-9362-6ea2ce5f89e1
1
private JButton getJButton0() { if (jButton0 == null) { jButton0 = new JButton(); jButton0.setText("GOOD"); jButton0.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { jButton0MouseMouseClicked(event); } }); } return jButton0; }
aa92ceb0-69d4-44f7-b1eb-532ee355fd4f
2
@Override public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; double div = 4.0 * vehicules.length; for (int i = 0; i < vehicules.length; i = i + 1) { Voiture voiture = vehicules[i]; if (voiture != null) { g2d.transform(new AffineTransform()); AffineTransform tx = new AffineTransform()...
9344c258-c8d2-4efa-b5c4-7309177a199c
0
public double getWidth() { return width; }
287fc2e4-7b9e-4adf-8b88-86297be0e548
3
public void testCycAssertion() { System.out.println("\n*** testCycAssertion ***"); // stringApiValue() on a random assertion try { CycAssertion assertion = getCyc().getRandomAssertion(); testCycObjectRetrievable(assertion); assertNotNull(assertion); String assertionAsString = assert...
edc1130b-aaf7-4883-98db-748db0c464e2
5
public static void stopAllSounds() { // Get an iterator. Iterator<WeakReference<Sound>> iterator = Sound.allSounds.iterator(); // Loop. while (iterator.hasNext()) { // Get the reference. WeakReference<Sound> soundReference = iterator.next(); // Is it non-null? if (soundReference != null) { // ...
31478de1-3449-48df-a23c-95d172e94eaa
6
public void print(final PrintWriter out, boolean printLeaves) { final Iterator callers = calls.keySet().iterator(); while (callers.hasNext()) { final MemberRef caller = (MemberRef) callers.next(); final Iterator callees = ((Set) calls.get(caller)).iterator(); if (!printLeaves && !callees.hasNext()) { ...
2834a512-3759-4a01-80b3-a353eedc63e3
9
protected GPNode fullNode(final EvolutionState state, final int current, final int max, final GPType type, final int thread, final GPNodeParent parent, final int argposition, final GPFunctionSet set) { // fullNode can mess up if there are no avail...
31de8f06-11a4-4c26-ac1a-d82fee2d78f5
7
@RequestMapping(value= "/getCourseList",method = RequestMethod.GET) public String getCourseList(@RequestParam(value = "theme", required = false, defaultValue = "0") int theme, @RequestParam(value = "category", required = false, defaultValue = "0") int category, @RequestParam(value = "subcategory", required ...
c4f67e38-d6d2-43c9-9d10-e1e60b053ef6
8
public int findNext(int val) {//for positive ints only if (root==null)return -1; marker=null; for (Leaf temp=root;temp!=null;) { if (temp.value==val) { marker=temp; return marker.value;//found exact, return exact } if (temp.valu...
bae7f527-01e8-48ae-8343-a6dad7a2f423
1
public float nextCentral() { // Average 12 uniformly-distributed random values. float sum = 0.0f; for (int j = 0; j < 12; ++j) sum += gen.nextFloat(); // Subtract 6 to center about 0. return stddev*(sum - 6) + mean; }
550b1d0c-320a-427e-ad68-393d9ba96d6d
3
@Override public void refreshAll() { boolean reorder = false; synchronized (LOCK_MODEL) { for (LessFileStatus lfs : sortedLFS) { lfs.getOverviewItem().refreshStatus(); if (lfs.shouldBeShowed() != lfs.isShowed()) reorder = true; } } if (reorder) reorderModelList(); }
cef8aaaa-0848-4fcc-8336-a4c5e5fad0fd
9
public static Message getFriendRequestByXMLElem(XMLElement root) { User toUser = null; User fromUser = null; boolean isConfirmed = false; boolean isRejected = false; if (root.attributeMap.containsKey("isconfirmed") && root.attributeMap.get("isconfirmed").equals("true")) isConfirmed = true; if (root.attr...
6178b2bc-de39-457a-8d51-79d0901f12aa
3
protected int[] byte2int(byte[] source) { int rest = source.length % 4; byte[] fixArray; if (rest != 0) { fixArray = new byte[source.length + (4 - rest)]; byte b1 = " ".getBytes()[0]; int fixLength = fixArray.length; int sourceLength = source.length; for (int i = 0; i < fixLength; i++) { if (i ...
7e9ed913-66ca-4e71-a80d-ce38ac6e4f7b
2
@Override public void action(Action action) { switch (action) { case OPEN_CLOSE: if (open) { open = false; parent.is_opaque = true; parent.is_passable = false; parent.spriteID = EntityType.getSpriteI...
dc69006a-a06f-4667-96ed-e00f71f9e544
0
public double get2CoordLong() { return markerRect.get2CoordLong(); }
c2116fa9-4565-4b03-96e6-4b40ae09cb49
5
public Proveedor buscaMenorPrecio(LinkedList<Proveedor> proveedores, String servicio){ Proveedor masBarato=null; for(Proveedor prov:proveedores){ if(tieneServicio(prov,servicio)){ masBarato=prov; break; } } S...
1d694728-f1ad-43c5-b0b1-6bc21b81f860
6
protected void sendField(ObjectOutputStream out, Tile[][] field) { int[][] output = new int[11][11]; for (int x=0; x<11; x++) { for (int y=0; y<11; y++) { output[x][y] = -1; } } for (int x=0; x<10; x++) { for (int y=0; y<10; y++) { if (field[x][y] != null) output[x+1][y+1] = field[x]...
6a9c434b-b9f0-4852-8e17-104ac2128867
3
public boolean executerRequeteMAJ(String req) { int res = -1; boolean rep = true; System.out.println("\tRequête à executer : " + req); try { Statement ordre = conn.createStatement(); res = ordre.executeUpdate(req); if (res == -1 || res == 0) rep = false; } catch (Exception ex) { System.err...
be2f605c-2129-478e-b2ca-b59214801e3a
9
@Override public void processCas(CAS aCAS) throws ResourceProcessException { // TODO Auto-generated method stub // String modelFileName = null; JCas jcas; try { jcas = aCAS.getJCas(); } catch (CASException e) { throw new ResourceProcessException(e); } FSIterator it = jcas.getA...
e4bc4a67-39ce-4968-850c-810ec57a3a38
5
int alphaBetaMax(int alpha, int beta, int depthleft) { if (depthleft == 0) { return eval(mPieces, oPieces); } for (Piece a : mPieces) { Move[] possible = a.getMoves(board); System.out.println("max, white : " + a.white + ", # nodes " + possible.leng...
dff767e0-28e8-42a2-bbde-7972eb112371
5
public void setPopulation(String gender, String state, String population) { StateType st = _stateTypeList.get(state); if (population.equals("") || population == null) { return; } else { switch (GENDERS.valueOf(gender)) { case MALE: st._male = Integer.parseInt(population); brea...
a43464c1-7493-4d7c-8599-e1d39c1bc32c
3
private Location findFood() { Field field = getField(); List<Location> adjacent = field.adjacentLocations(getLocation()); Iterator<Location> it = adjacent.iterator(); while(it.hasNext()) { Location where = it.next(); Object animal = field.getObjectAt(where); ...
522a7f56-3e15-48d5-b746-5c34672d0d1a
7
public void invert (double[][] Ainv) { // Verify preconditions. if (Ainv.length != N) { throw new IllegalArgumentException ("LinearSolve.invert(): Ainv is not a " + N + "-by-" + N + " matrix"); } for (int i = 0;...
06bf19d0-8627-434e-916a-0f72aef56f68
6
public int evalRPN(String[] tokens) { Stack<Integer> s = new Stack() ; for(int i=0;i<tokens.length;i++){ if(isOperators(tokens[i])){ int va2 = s.pop(); int va1 = s.pop(); if("+".equals(tokens[i])) s.push(va1+va2); ...
46df07da-e424-4028-bd60-58bb17f9a927
1
public void testMinus_int() { Hours test2 = Hours.hours(2); Hours result = test2.minus(3); assertEquals(2, test2.getHours()); assertEquals(-1, result.getHours()); assertEquals(1, Hours.ONE.minus(0).getHours()); try { Hours.MIN_VALUE.minus(1);...
9577a39d-3183-4f3e-97bb-e4f508dde0ee
3
public synchronized void remove(long tagId, int clientId) { int i=0; for(Tag tag:tags){ if(tag.getTagId()==tagId && tag.getClientId()==clientId){ tags.remove(i++); } } }
3ea91a5b-b441-4ae3-882f-1e3db4631372
7
@Override public boolean onCommand( CommandSender sender, Command command, String label, String[] args ) { if(args.length < 1) return false; String sub = args[0]; String[] subArgs = Arrays.copyOfRange(args, 1, args.length); if(sub.equalsIgnoreCase("check")) { if(!sender.hasPermission("entitycap.ch...
11c5d640-500e-4a98-b94f-c41fb625696a
6
@Override public void deserialize(Buffer buf) { short flag1 = buf.readUByte(); enabled = BooleanByteWrapper.getFlag(flag1, 0); abandonnedPaddock = BooleanByteWrapper.getFlag(flag1, 1); level = buf.readUByte(); if (level < 0 || level > 255) throw new RuntimeExcepti...
4e483315-e44d-4f39-b3b3-8701ce2ebe63
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 Questionary)) { return false; } Questionary other = (Questionary) object; if ((this.idQuestionary == null && ot...
679cb980-a439-416c-b93c-0f224f0561c5
0
public String toString() { return String.format("%2d : %s", getBumoncode(), getName()); }
171b9cb7-fa98-449a-8661-ab931028395b
1
@Override public String getResource() { String html = null; if(openResourceConnection()){ html = doc.body().html().replace("&quot;", "\""); html = html.replaceAll("image\\s*:\\s*url\\s*\\(\\s*", "image:url("+domainName ); //System.out.println(html); } /*else{ String[] resourceFolders = t...
fc8f92a7-dd8e-4375-a81f-b916b683080b
3
@Override public boolean addAll(Collection<? extends E> arg0) { boolean changed = false; for(E entity : arg0) { if(add(entity)) { changed = true; } } return changed; }
51743cbd-a776-43db-bdbf-f79eb38ac11d
0
public void setOpenEncoding(String openEncoding) {this.openEncoding = openEncoding;}
51f252e3-4411-4759-abe3-d334a10014ca
2
@Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { FileModel file = historyFileListUtils.getFileAt(rowIndex); if (columnIndex == 3 && (aValue instanceof Float)) { file.setProgress((Float) aValue); } fireTableRowsInserted(rowIndex, columnIndex); }
1f635139-8c0a-463a-94c2-66c1ce425d1e
0
public DotThis outer() { return DotThis.this; // A plain "this" would be Inner's "this" }
9a109abc-a5f9-41d8-8365-2da092b8e9e1
6
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, ParseException, ClassNotFoundException, SQLException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); authenticat...
d2d31b05-64af-4035-b34c-551a8b02ccaf
0
public int getXLocation() { return xLocation; }
576206c5-5085-4bd8-b5c5-95f176512062
1
private void walk(MenuElement element, List<MenuElement> list) { list.add(element); for (MenuElement data : element.getChildren()) { walk(data, list); } }
91400af5-4f8c-48bf-8098-189a5a2d159d
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 Genre)) { return false; } Genre other = (Genre) object; if ((this.genreid == null && other.genreid != null) || ...