method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
77805bd8-d9bd-4760-8de7-ab94df22e006
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final DateTime other = (DateTime) obj; if (date == null) { if (other.date...
7626d65c-1507-483e-b3e4-46de6c9fdb8e
0
private void submitContactForm() { driver.findElement(By.name("submit")).click(); }
5c9a2de0-5a63-4231-bbcb-a6f7d511ecee
8
public Shape createStrokedShape(Shape shape) { GeneralPath result = new GeneralPath(); PathIterator it = new FlatteningPathIterator(shape.getPathIterator(null), FLATNESS); float points[] = new float[6]; float moveX = 0, moveY = 0; float lastX = 0, lastY = 0; ...
3db065ab-5406-4814-ac11-05be788946e7
0
public VectorProxy(Object obj) { this.Proxyobject = obj; }
5b46408c-524b-4b40-8313-4e182f9cf2b0
6
private static void resetLocalPRNG() { if (DEBUG && debuglevel > 8) debug(">>> resetLocalPRNG()"); HashMap attributes = new HashMap(); attributes.put(ICMGenerator.CIPHER, Registry.AES_CIPHER); byte[] key = new byte[128 / 8]; // AES default key size Random rand = new Random(System.currentTi...
b6f44b0f-a003-451e-894a-41d94fe16aa4
4
@Override public void execute(Object parent) { mxGraphView view = graph.getView(); mxIGraphModel model = graph.getModel(); // Gets all vertices and edges inside the parent List<Object> edges = new ArrayList<Object>(); List<Object> vertices = new ArrayList<Object>(); int childCount = model.getChildCount(p...
4cc270f6-a2fe-45f0-b5de-e844d7afe290
4
@EventHandler(priority = EventPriority.MONITOR) public void onClick(InventoryClickEvent event) { if(event.getWhoClicked() instanceof Player == false) return; int slot = event.getView().convertSlot(event.getRawSlot()); if(slot == 8 && event.getInventory().getType() != InventoryType.PLAYER...
e61d5039-dd87-4ee3-a818-773471c08f7c
0
@ManyToOne @JsonIgnore private Event getEvent1() { return event; }
62f48010-3ee3-4baf-a3da-004c83e0a717
9
public void connectToDatabase() throws Exception { if (m_Debug) { System.err.println("Connecting to " + m_DatabaseURL); } if (m_Connection == null) { if (m_userName.equals("")) { try { m_Connection = DriverManager.getConnection(m_DatabaseURL); } catch (java.sql.SQLException e) { // T...
b9d98279-8b2b-4171-bc79-e0d926be8bee
7
public void initReader(Class<? extends SyntaxGraphReader> syntaxGraphReader, String inputFile, String inputCharSet, String readerOptions, int iterations) throws MaltChainedException { try { final URLFinder f = new URLFinder(); reader = syntaxGraphReader.newInstance(); if (inputFile == null || inputFile.lengt...
20d91838-f726-4513-bb23-de54b1ce6142
6
public void backToMenu() { int reply = JOptionPane.showConfirmDialog(null, "Would you like to return to the Main Menu?"); if(reply == JOptionPane.YES_OPTION) { timer.stop(); reply = JOptionPane.showConfirmDialog(null, "Would you like to save your progress before quiting?"); if(reply == JOptionPane.YES_...
62662a31-fe9f-4d58-9b6f-8c9a99faab26
9
static final void method3534(boolean bool, int i, int i_5_, boolean bool_6_, int i_7_, Widget[] class46s) { anInt7279++; if (bool == false) { for (int i_8_ = 0; (class46s.length ^ 0xffffffff) < (i_8_ ^ 0xffffffff); i_8_++) { Widget class46 = class46s[i_8_]; if (class46 != null && i == ((Widge...
88ed8923-bca9-46df-b9e4-ca041b90a259
2
private static short mag2gray(long mag) { short intensity = (short) (30.0 * Math.log(1.0 + (double) mag) - 256.0); // Make sure the returned intensity is in the range 0...255, regardless // of // the input value. if (intensity < 0) { intensity = 0; } else if (intensity > 255) { intensity = 255; } ...
58c959df-ac93-439b-9df1-ba50f3916df4
7
public boolean renderBlockRepeater(Block par1Block, int par2, int par3, int par4) { int var5 = this.blockAccess.getBlockMetadata(par2, par3, par4); int var6 = var5 & 3; int var7 = (var5 & 12) >> 2; this.renderStandardBlock(par1Block, par2, par3, par4); Tessellator var8 = Tess...
9b533ae3-fa6e-4c5f-b228-89b58b8c472a
2
private void playRound() throws BadInput, AntiAircraftGun.BadCoordinate, GameEnd { for (int d=0; d<3; d++) { System.out.format("Enter a coordinate %s: ", "XYZ".charAt(d)); target_coords[d] = IOGeneric.getInteger(); } Result r = gun.fire(target_coords[0], target_c...
2acdb79f-4f09-474e-89b3-319b7aeeff95
7
public void setPhrases() { List<TermPos> temp = new ArrayList<TermPos>(); int i = 0; int size = this.terms.size(); while (i < size) { PhraseType p; while (i < size && ((p = getType(i)) != PhraseType.OTHER)) { if (p == PhraseType.NOUN) { temp.add(new TermPos(terms.get(i), posTags.get(i), "BNP")); ...
66639a1b-5555-43d0-bc71-75abcfd8ced3
2
public int get(int symbol) { if (symbol < 0 || symbol >= numSymbols) throw new IllegalArgumentException("Symbol out of range"); return 1; }
43f5efd5-45e8-4954-a608-a6b2e3c6df11
4
public static void updateEvents (EventsBean event){ PreparedStatement pst = null; Connection conn=null; boolean result = false; try { conn=ConnectionPool.getConnectionFromPool(); pst = conn .prepareStatement("UPDATE EVENTS SET NAME=?, DESCRIPTION=?, EVENT_DATE=?, VENUE=?, TOTAL_SEATS=?, BOOKED_...
83b8bf6b-9308-4c5e-b1c4-16a7a0570ae2
2
public void InsertaFinal(int ElemInser) { if ( VaciaLista()) { PrimerNodo = new NodosProcesos (ElemInser); PrimerNodo.siguiente = PrimerNodo; } else { NodosProcesos Aux = PrimerNodo; while (Aux.siguiente != PrimerNodo) Aux = Aux.siguiente; NodosProcesos Nuevo=new NodosProces...
c5dff1e3-d671-4629-a26c-e9da7ce98c18
3
public static List<String> anagrams(String[] strs) { List<String> res = new ArrayList<String>(); Map<String, Integer> anamap = new HashMap<String, Integer>(); for (int i = 0; i < strs.length; i++) { char[] c = strs[i].toCharArray(); Arrays.sort(c); String str = String....
407b72ab-eb1a-4d4a-b369-aa70cc92e965
9
public Map<Player, Player> Commands_tp(Map<Player, Player> Map) { tpMap = Map; if (args.length == 1) { Player p1 = plugin.getServer().getPlayer(args[0]); if (p1 == null) { player.sendMessage(ChatColor.RED + args[0] + " n'est pas en ligne actuellement."); ...
0fe7608f-2ad9-410d-aba6-99f79a03aea8
7
public Map<Integer,Integer> sssp(Node source, Graph g){ int sID=source.id; Map<Integer,Integer> nextNodeInPath = new HashMap<Integer,Integer>(); double[] dist = new double[g.numNodes]; List<NodeIDDistPair> pairs = new ArrayList<NodeIDDistPair>(1); PriorityQueue<NodeIDDistPair> distances= new PriorityQueue<...
5a7723a6-7e71-498a-9c5a-7737f8a6accb
4
private void compareVersions(){ // update GUI and modsArray based on new information from user update.setIcon(mcmods); int temp = webReader.readFileFromServer(onlineLocation.getText()); if(temp == -1){ //error getting file details.setText("ERROR CONNECTING TO SERVER"); notice.showNotice("ERROR", "COULD N...
c1eb560b-53c7-4506-ae7a-13b63643ab1b
1
public static void copyTo(Object source, File output) throws IllegalArgumentException, IOException { InputStream in = getInputStream(source); FileOutputStream fos = new FileOutputStream(output); byte [] buf = new byte[1024]; int len; while((len = in.read(buf)) > 0) { ...
a469c679-4cc3-49b8-9aee-c3d02348c4f8
7
@Test public void testIsHoliday() { System.out.println("isHoliday"); GregorianCalendar date = new GregorianCalendar(2000, 0, 1); for (int i = 0; i < 10000; i++) { Holiday<GregorianCalendar> instance = this._mayNinth2k; boolean expResult = date.get(GregorianCalendar.YE...
1b8cb7a5-a3cc-4a9a-b0d6-aae8c9be6719
9
protected void doPadding(byte[] output, int outputOffset) { int ptr = flush(); int bitLen = ptr << 3; long th = t1; long tl = t0 + bitLen; tmpBuf[ptr] = (byte)0x80; if (ptr == 0) { t0 = 0xFFFFFFFFFFFFFC00L; t1 = 0xFFFFFFFFFFFFFFFFL; } else if (t0 == 0) { t0 = (int)0xFFFFFFFFFFFFFC00L + bitLen; ...
7bbb688c-4bb7-47c5-8eda-0758a21ef3a7
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...
bbebd086-c835-4427-a4da-0ed9dbd5e994
9
public void update(Observable arg0, Object arg1) { // TODO Auto-generated method stub // state determines who (tweetzAnalysis.TweetsProvider or tweetzAnalysis.Timer-Thread) invoked that // method int state; MySqlAccess.connectToDatabase(); state = (Integer) arg1; ...
eb10104c-e795-422f-8383-aef5a13e65a2
8
boolean subtractResourcesForWeaponUpgrade(String weapon, int currentLevel){ int resourcesToSubtract = 4; if(currentLevel == 2) resourcesToSubtract = 5; if(currentLevel == 3){ Debug.warn(username + " tried to upgrade his " + weapon + ", but it is already level 3."); return false; } if(weapon.equ...
49b2d139-0f41-4d4b-abb7-7e822c84ab0a
8
public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, ...
112bc7fa-c0a0-4839-92b6-fc49a7dacb5b
7
public static int translate(int unicode) { if ((unicode >= 0x20 && unicode <= 0x7e) || (unicode >= 0xa0 && unicode <= 0xff)) return unicode; int min = 0; int max = table.length - 1; int mid; while (max >= min) { mid = (min + max) / 2; if (table[mid][1] < unicode) ...
24fc8cc3-03a2-400f-b09a-e0e6ef2656d2
2
public long sumPrimesBelow(int num) { long sum = 2l; // Make sum a long - integer limit is ~2 billion, not enough for (int i = 3; i < num; i++) { if (isPrime(i)) { sum += (long) i; } } return sum; }
b3a96e01-0f65-4c51-9e9d-2d37de9b4985
6
public 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://download.or...
ae3c8e45-f5a9-4b3a-ae4b-b0e8750a7824
6
public static void setRace(String race) { race = race.trim(); if (race.compareToIgnoreCase("Meck.-Vorp.") == 0) { setRaceSecondary("Mecklenburg-Vorpommern"); } else if (race.compareToIgnoreCase("Bad.Württ.") == 0) { setRaceSecondary("Baden-Württemberg"); } else if (race.compareToIgnoreCase("Rheinl-Pfalz...
5c399cfe-51af-4fb2-8af5-1aacc36106b9
7
public void renderParticles(int xPos, int yPos, Sprite p) { xPos -= cameraXCoord; yPos -= cameraYCoord; for(int y = 0; y < p.getSizeY(); y++) { int yAbs = y + yPos; for(int x = 0; x < p.getSizeX(); x++) { int xAbs = x + xPos; if(xAbs < 0 || xAbs > width - 1 || yAbs < 0 || yAbs > height - 1) break; ...
fe0fc056-0a63-475e-a837-13af9831db3a
4
final void renumber(final Map<Integer, Integer> indexMap, final Map<Integer, String> numberMap, final Map<Integer, Boolean> mapOpt) { if ((indexMap == null) || (numberMap == null)) { this.idxMap = null; this.numMap = null; return; } this.idxMap = indexMap; this.numMap = numberMap; this.total.cl...
a47321ec-df2c-4363-9ef0-967f0d43403b
7
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession mensaje = request.getSession(true); PrintWriter out = response.getWriter(); //Declaro variables boolean esVillano...
f7bd2086-1807-4ba5-827e-ae491b2f0675
4
private boolean hasVisitedNeighbours(Point p){ int c = 0; if (this.maze[p.x - 1][p.y] == false) {c++;} if (this.maze[p.x + 1][p.y] == false) {c++;} if (this.maze[p.x][p.y - 1] == false) {c++;} if (this.maze[p.x][p.y + 1] == false) {c++;} return c > 1; }
b1018888-38b4-4cd3-b724-b47a4b7ac39d
0
public static void main(String[] args) { System.out.println("Mettbällchen!"); System.out.println("CWD: " + System.getProperty("user.dir")); System.out.println(); BlueprintList BPL = new BlueprintList(); BPL.LoadData(); System.out.println("Loading completed"); Syst...
0837acd1-e681-4a8f-8a88-482623ec8aa3
4
@Override public Cell<V> cell(int row, int column) { if (exists(row, column)) { for (Cell<V> cell : cells()) { if (cell.getRow() == row && cell.getColumn() == column) { return cell; } } } return null; }
7428627f-708f-4007-a8b0-d14429965dc2
3
public synchronized void ValidarChoque() { int y = jFlappy.getLocation().y; if (y == 448) { if (Sonido.terminochoque) { Sonido.choque(); } GamerOver gamerover = new GamerOver(this, true); try { Thread hilo = new Thread() { ...
5377123b-9afb-49fd-beb0-ad063780b288
2
public String toString() { String result = ""; /* for (int y= ySize-1; y>=0; y--) { for(int x = 0; x<xSize; x++) {*/ for (int y= ySize; y>0; y--) { for(int x = 0; x<=xSize; x++) { result += squareContentSprite(x,y); } result+="\n"; ...
678aae4e-8254-47dd-8e22-5b20caba1a24
9
private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_...
437474de-5328-4dc2-b06f-0e0062491568
6
public ArrayList<Booking> getBooking(int cabin_id) { ArrayList<Booking> ab = new ArrayList<Booking>(); ResultSet rs = null; try{ statement = connection.createStatement(); String sql = "select * from bookings where cabin_id = " + cabin_id + " order by date_from asc"; rs = statement.executeQuery(sql); w...
2bcd9812-2b66-4143-a6e9-7a92949e67f9
7
public void lookAt(String object, ArrayList<String> inv) { if (object.equalsIgnoreCase("floor")) { System.out.println("It is a cold and hard stone floor.\n"); } else if (object.equalsIgnoreCase("wall") || object.equalsIgnoreCase("walls")) { System.out.println("The walls are made ...
2eb9abf4-ead4-4040-affa-760006f22837
2
private void readLoop() throws IOException { String s; do { System.out.print("[DCnet] $ "); s = br.readLine(); if(s == null) return; controller.handle(new ArgSet(s)); } while(!stopped); }
1fbfa191-506d-4181-aa5f-5515b9110a22
1
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((components == null) ? 0 : components.hashCode()); return result; }
68358ad9-3570-40c2-af5a-b8e90f000bba
1
public List findByExample(Problem instance) { log.debug("finding Problem instance by example"); try { List results = getSession().createCriteria( "com.oj.hibernate.daoNdo.Problem").add( Example.create(instance)).list(); log.debug("find by example successful, result size: " + results.size()); ...
c7b99ea2-da70-4201-a444-83f5672841df
4
public void leeArchivo() throws IOException{ BufferedReader fileIn; System.out.println("Entra leerArchivo"); try{ fileIn = new BufferedReader(new FileReader(nombreArchivo)); } catch (FileNotFoundException e){ File puntos = new File(nombreArchivo); PrintWriter fileOut = new Print...
357c9a60-eeeb-4b8a-8001-298d62db0b11
3
public void fitToBounds(int padding) { Rectangle viewBounds = getVisibleRect(); Rectangle automatonBounds; if(drawer != null && drawer.getBounds() != null) automatonBounds = new Rectangle(drawer.getBounds()); else automatonBounds = new Rectangle(0, 0); automatonBounds.grow(padding, padding);...
0962c2a8-a6c9-4745-a2b3-2fed98cbc3e4
1
public void visit( int version, int access, String name, String signature, String superName, String[] interfaces) { this.className = name; super.visit(version, access, remapper.mapType(name), remapper.map...
2f8f4e3d-4c3e-44ed-a675-36a4de46d7f2
4
@Override public ValueType returnedType(ValueType... types) throws Exception { // Check the number of argument if (types.length == 1) { // if array if (types[0] == ValueType.NONE) { return ValueType.NONE; } // If numerical if (types[0].isNumeric()) { return ValueType.DOUBLE; } // if ...
f9b06cea-2289-4644-9c0d-629150736b4a
0
public int getAlstromeria() { return alstromeria; }
0cf846c7-9168-4482-a67c-d7fbc2914528
1
public Form getConfirmationPage() { submit = new PCommand("Submit", PCommand.SCREEN, PCommand.TRAFFIC_MENU_SUBMIT_DETAILS, 2); Form confirmationPage = new Form("Confirm details"); if (capturedImage != null) { confirmationPage.append(createThumbnail(capturedImage)); } ...
ef583d4b-fde4-4849-a8da-1a2ac12c88bc
7
public int compareTo(Datum other) { if(this.godina == other.godina) { if(this.mjesec == other.mjesec) { if(this.dan == other.dan) { return 0; } else if(this.dan > other.dan) return 1; else return -1; } if(this.mjesec == other.mjesec) { return 0; } else if(this....
e204e8ca-4f53-49bb-aeb1-2f39eeb04909
1
static void printTreeRecursive(Tree tree, String indent) { TreeNode root = tree.getRoot(); Object rootDatum = root.getDatum(); System.out.println(indent + rootDatum); List children = root.getChildren(); for (Iterator iter = children.iterator(); iter.hasNext(); ) { Tree nextTree = ...
3c0a20b8-320e-4df0-95aa-f5f08cedc566
5
@Override public long[] run(String query) { FUNCTION_NAME = "SGM"; query = query.toUpperCase(); boolean state = true; SQLParser parser = new SQLParser(); state &= parser.parse(query + ".txt"); // file name wrieteGlobalInfoToHDFS(parser); long[] time = new long[4]; Long startTime = new Date().getTime();...
b1d0cadf-226d-4182-81c9-27598b489e48
8
public void eliminarMaterialImproprioCompartilhado(Artigo art) { String palavra = " RR "; List<Artigo> artigosRemover = new LinkedList<Artigo>(); for (int i = 0; i < artigo.size(); i++) { if ((artigo.get(i).getResumo().contains(palavra) || artigo.get(i) .getResumo().equals("RR")) || (artigo.get(i).g...
a0890296-0c80-44f6-8899-e7b9752cd7b3
6
private long handleRequestNotifications(String authType, String controller, String id, String passcode) { long timestamp = System.currentTimeMillis(); String accessPoint = findAssociation(controller).accessPoint.id; NotificationToken token; if (id != null && passcode != null) { token = new NotificationToken(...
297e1377-9a06-4c98-ab55-390deea296b9
0
public boolean isInLambdaSet(String variable, Set lambdaSet) { return lambdaSet.contains(variable); }
08ff1883-66c7-4b79-80db-762ec4df55dd
7
private void discover(){ if(currentState == STATE_DISCOVER || currentState == STATE_DEFEND || currentState == STATE_FOLLOW || currentState == STATE_GATHER || currentState == STATE_SEARCH){ //We are not doing anything else to superscede a normal discover operation. normalDiscover(); }else if(c...
7b46dcaa-4e5b-4e2b-a06e-11af0769c57f
2
private static String replaceMultipleCharactersInString(String original_str, int index, char replace_value) { StringBuilder myString = new StringBuilder(); for(int i = 0; i < original_str.length(); i++) { myString = (i % index == 0) ? myString.append(replace_value) : m...
0db7e457-7075-4141-8ada-210710d8d79b
8
public int print(Graphics _g, PageFormat pf, int pageIndex) throws PrinterException { if (pageIndex != 0) return Printable.NO_SUCH_PAGE; MapDraw mapDraw = new MapDraw(); mapDraw.setMain(main); mapDraw.setShowRover(main.showRover); mapDraw.setShowRoverPath(t...
c39d0225-7e00-4773-befc-bf030176739a
3
@Override public void mousePressed(MouseEvent e) { JButton pressedButton = (JButton) e.getSource(); System.out.println("Click"); if(pressedButton == newGame) gameStart = true; else if(pressedButton == editor) editorStart = true; else if(pressedButton == quit) close = true; ...
948e03c2-3bb2-47c1-838b-db1c243aa757
1
@Override public void cleanUp() { // Call the clean up of all our items, so that GC can come visit. Then // clear our list of items for (IHudItem item : hudItemQueue) { item.cleanUp(); } hudItemQueue.clear(); }
aa82a3e1-2705-43c7-ab25-253bec45d163
3
public void redrawAction(){ Graphics g = getGraphics(); ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); for(int i = 0; i < pktList.size(); i++){ PointPacket pkt = pktList.get(i); if(pkt.get_drawType() != DrawType.ERASE) { g.setColor(pkt.get_colour(...
541902c7-4cc5-480d-b65e-8fbedcc49b26
5
public boolean verifyDeadEnd() { int deadCount = 0; if(this.checkerObject.getUp()==0) { deadCount++; } if(this.checkerObject.getLeft()==0) { deadCount++; } if(this.checkerObject.getDown()==0) { deadCount++; } if(this.che...
e5eb2846-8849-4f01-a4c7-8292f31bf8e7
1
@Override public TicketPoolQueryArgs toTicketPoolQueryArgs(TicketQueryArgs args) throws Exception { TicketPoolQueryArgs rs = new TicketPoolQueryArgs(); rs.setDepartureStop(this.getStationSequence(args.getDepartureStation())); rs.setDestinationStop(this.getStationSequence(args.getDestinationStation())); i...
6a3b9b2b-3d5b-4555-b150-ad9f7d542829
5
private static synchronized Map<Class<? extends Object>, List<String>> initConfig(String path) throws NoConfigException { Map<Class<? extends Object>, List<String>> ret = configs.get(path); if (null != ret) return ret; ret = new HashMap<>(); Properties props = new Properties(); try { ...
2e4e3f59-b658-4942-86b1-bd073065083d
4
public Matrix add(Matrix m) { if(numRows != m.numRows || numColumns != m.numColumns) throw new IllegalArgumentException("Incompatible dimensions"); Matrix sum = new Matrix(numRows, numColumns); for(int i = 0; i < numRows; i++) for(int j = 0; j < numColumns; j++) sum.elements[i][j] = elements[i][j] + ...
e470f68c-4964-4289-9019-67651bb65e53
4
public void processResourceUpdate(UpdateResource ur) { if (ur != null) { if (resources.containsKey(ur.id)) { Resource resource = resources.get(ur.id); if (resource != null) { EIError.debugMsg(ur.id + " (" + ur.action + ")"); if ...
68b2cc69-0a02-4176-8f88-caad87f9e77f
3
public int[][] getGrayLevels() { if (image == null) return new int[0][0]; int[][] grayLevels = new int[getHeight()][getWidth()]; for (int i = 0; i < grayLevels.length; i++) for (int j = 0; j < grayLevels[i].length; j++) { int rgb = image.getRGB(...
1748f0f9-605c-432a-9bca-1cb1fe41b82a
1
@Override public String toString() { String output = "Edge [Nodes="; for (Node n : adjacentNodes) { output = output + n.getCoordinates(); } output = output + ", " + edgeState + "]"; return output; ...
fae39920-0ee9-4add-90fc-0c91e11d8b82
1
public void visit_astore(final Instruction inst) { stackHeight -= 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } }
8dd51a8e-58f1-4dbc-a358-31c3851a08ba
5
protected Object resolveContainerStore(String key) { Object value = getProperty(key); if (value != null) { if (value instanceof Collection) { Collection collection = (Collection)value; value = collection.isEmpty() ? null : collection.it...
6795eeb3-5950-4a45-a0e3-f47fa570a868
7
public void updateFeedback(){ ImageIcon icon; String tekst; //tekst en icon bepalen if((spel.isVijandGeraakt() || spel.isZelfGeraakt()) && !spel.isSpelBezig()){ icon = new ImageIcon(Constanten.ICOON_SKULL.getImage()); String naamWinnaar = ""; try{ ...
606526df-f335-4e01-a529-b6483fa6c17c
3
Parser(String uri) { try { SAXParserFactory parserFactory = SAXParserFactory.newInstance(); SAXParser parser = parserFactory.newSAXParser(); ConfigHandler handler = new ConfigHandler(); parser.getXMLReader().setFeature( "http://xml.org/sax/features/validation", true); ...
de0223cd-7ccc-4393-9929-6c676cbeecf9
9
void findPossibleMoves(Vector<Move> lMoves) { lMoves.clear(); if (mLastMove.isEOG()) { return; } // End if if (mMovesUntilDraw <= 0) { lMoves.add(new Move(Move.MoveType.MOVE_DRAW)); return; } // End if // Normal moves are forbidden if any jump is found ...
6a2da82c-4ae6-49e6-a4ed-38975cfc1397
6
@EventHandler public void EndermanMiningFatigue(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.getEndermanConfig().getDouble("Ende...
d524dd7c-bfc6-40f6-aef8-16f02cc0a6e2
6
public void setDay(int d) { if (d < 1) { d = 1; } Calendar tmpCalendar = (Calendar) calendar.clone(); tmpCalendar.set(Calendar.DAY_OF_MONTH, 1); tmpCalendar.add(Calendar.MONTH, 1); tmpCalendar.add(Calendar.DATE, -1); int maxDaysInMonth = tmpCalendar.g...
d1d4eba3-45d1-43f3-a6cd-0f498c06aadb
4
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); Edmons_karp f; int nNet = 1; while ((line = in.readLine()) != null) { int nNodes = Integer.parseInt(line.trim())...
7b0f6592-84c8-4c69-9e65-5cc687009a84
4
public void play(Sequence sequence, boolean loop) { if (sequencer != null && sequence != null && sequencer.isOpen()) { try { sequencer.setSequence(sequence); sequencer.start(); this.loop = loop; } catch (InvalidMidiDataException...
1e7c7373-6f5d-496f-8329-863a7abb6f3f
2
@Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String[] words = value.toString().split("\\,"); if (key.get() != 0) { for (int i = 2; i < 11; i++) { context.write(new Text(headers[i]), new Text(words[i])); } } }
0ae65f30-21a4-4d74-b6ce-cccb126e9402
6
public boolean insert(Integer data){ if(root == null) root = new Node(data); Node n = root; while(true){ if(data == n.data) return false;//already there else if(data > n.data){ if(n.right != null) n = n.right; else { n.right = new Node(data); return true; } } else { if(n.left...
3fbe6698-2d1b-468c-ae27-4c394ae2f2e8
8
int checkBlockLine(int[] par1ArrayOfInteger, int[] par2ArrayOfInteger) { int[] var3 = new int[] {0, 0, 0}; byte var4 = 0; byte var5; for (var5 = 0; var4 < 3; ++var4) { var3[var4] = par2ArrayOfInteger[var4] - par1ArrayOfInteger[var4]; if (Math.abs(var...
bcdfd6c8-1ac9-4e7f-a45f-30d32327771e
3
void createVarTypes(int ins, int outs) { assert ins > 0 && outs > 0; inVarTypes = new Class[ins]; outVarTypes = new Class[outs]; for (int i = 0; i < ins; i++) { inVarTypes[i] = parameterTypes[INPUT_FIX_PARAMETERS + i]; } int offset = INPUT_FIX_PARAMETERS + ins + op...
ce561156-ddbc-48ed-ba28-a2f923cd3c2d
8
private void updateStats(Message msg, short direction) { int length; HashMap map; boolean mcast; Address dest, src; if(msg == null) return; length=msg.getLength(); dest=msg.getDest(); src=msg.getSrc(); mcast=dest == null; if(direction...
ab0b3b74-93ba-43ad-9d15-b66db1103ab8
7
public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Please, input arithmetic expression: "); String equation = in.nextLine(); int counter = 0; int place = 0; for (int i = 0; i < equation.length(); i++) { if (equation.charAt(i) == '(') { counter++; } el...
0e13a723-cdb9-40c3-9925-78ede2a360ce
9
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } Image other = (Image) obj; if (source == n...
68ca9a1d-3e34-4c3b-9fa5-3f9eb9bd4930
2
public Rules() { String[] pictures = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "jack", "queen", "king", "ace"}; String[] types = {"clubs", "spades", "hearts", "diamonds"}; for (String picture : pictures) { validPictures.add(picture); } for (String pi...
e6f9a666-5d7f-4578-a41c-42373696e1e8
7
@Override public boolean equals(Object _pair) { if(_pair instanceof Pair){ Pair<?> pair = (Pair<?>) _pair; if(this.first().equals(pair.first()) == false) return false; if(this.second() == null & pair.second() == null){ return true; } if(this.second() == null ^ pair.second() == null){ re...
6b0fe4ba-c60f-4501-afdf-363cd62d8a72
5
public PortfolioTotalStatus[] getPortfolioTotalStatus() { Portfolio portfolio = getPortfolio(); Map<Date, Float> map = new HashMap<>(); // get stock status from db. Stock[] stocks = portfolio.getStocks(); for (int i = 0; i < stocks.length; i++) { Stock stock = stocks[i]; if (stock != null) { List...
f076fc4f-8bea-471c-8ef3-c275aa37a059
7
public static int findPreviousPrimeNumber(int number) { int previous = 0; int next = 0; for (int i = 0; i < 10; i++) { previous = i; next = i + 1; if (PRIME_NUMBERS[0] == number) break; if (PRIME_NUMBERS[previous] == number) previous--; if (PRIME_NUMBERS[next] == number) next++; ...
8a5f194d-0ff2-4392-a115-ce946cd85182
1
public VistaVentanaCliente(ControladorCliente c) { controlador = c; this.setTitle("Modo Cliente"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); ...
a5c49449-7096-41c0-9a8f-d92ec89e37ec
9
public void run(){ this.partida.reset(); String opcion = ""; while(!opcion.equalsIgnoreCase("SALIR") && !this.partida.terminada()){ System.out.println(this.partida.toString()); System.out.println("Que quieres hacer? "); opcion = this.in.next(); if(opcion.equalsIgnoreCase("PONER")){ System.out.prin...
70fd3926-17f8-467b-b1e5-53a36d308139
1
@Override public void paint(Graphics2D graphics) { if (objectTron != null) { renderEmptyGrid(graphics); renderBeginPositions(graphics); renderGrid(graphics); renderCurrentPlayerInfo(graphics); } }
d7ea98a6-c587-4418-a9b7-f965390c999f
6
public Object getValueAt(int rowIndex, int columnIndex) { PaidVo paidVo = paidVoList.get(rowIndex); switch (columnIndex) { case 0: return paidVo.getName(); case 1: return paidVo.getFruitName(); case 2: return paidVo.getC...
6d6921a3-8d10-4919-93d9-bc4d4d5ddc4e
9
private void deleteObject(Tile temp) { if (temp.getObject() != null) { boolean road = false; if (temp.getObject() instanceof Road) { road = true; } mapObjects.remove(temp.getObject()); Point start = new Point (temp.getObject().getStartPos().x, temp.getObject().getStartPos().y); Point end =...
f9dfdb0a-a16e-49f6-84d6-ae6814ef9954
2
public Player getPlayer(int index){ if (index!=PLAYER_ID_P1 && index!=PLAYER_ID_P2) return null; return players[index]; }
b2b11d02-ddb7-4747-b33e-7e8971488da1
3
public void clearSocket(Object index){ Client client = this.localClients.remove(index);// 从本地连接中清除 if(client != null){ return; } client = this.clustersClients.remove(index);// 从集群连接中清除 if(client != null){ return; } client = this.clients.remove(index);// 从客户端连接中清除 if(client != null){ ret...