method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b92245b4-1f0f-4324-8345-c2f775a6b6bb
8
public boolean checkWaterHeight (World world, int x, int y) { Tile tile; tile = world.getTile(x, y+1); if (tile.id == Tile.water.id || tile.id == Tile.flowingWater.id) return false; int myheight = getHeight(world, x, y); tile = world.getTile(x+1, y); if (tile...
b4257635-b716-4016-b346-f1ec1acee528
3
public String getNeuronName(Neuron neuron) { for (int i = 0; i < this.neurons.size(); i++) { for (int s = 0; s < this.neurons.get(i).size(); s++) { if (this.neurons.get(i).get(s) == neuron) { return "Neuron" + i + s; } } } throw new IllegalArgumentException( "The given Neuron is not Part of...
9332b4e2-1372-4706-a052-b7048e5d2edd
1
private static UserNotificationBuffer getMonitorFor(long uid) { UserNotificationBuffer rtn = null; if(monitors.containsKey(uid)) { return monitors.get(uid); } else { rtn = new UserNotificationBuffer(uid); monitors.put(uid, rtn); return rtn; } }
c930fddd-a3fe-4cbc-9319-8386e6f61b15
0
public void resetStepThrough() { stepThrough = ""; }
5ec5aa99-bc57-466e-a25a-e0b46d8a4fa1
4
public static void logError(Exception e) { File dir = new File(System.getProperty("user.dir") + "/Errors"); if(!dir.exists()) { dir.mkdir(); } DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd HH_mm_ss"); Date date = new Date(); File file = new File(dir + "/Error " + dateFormat.format(date) ...
6ec3389d-2aa7-424e-83a0-71d09e099161
5
public List<Triangle> parse(String path) { List<Triangle> result = null; BufferedReader reader = null; try { if (path.startsWith("classpath:")) { path = path.substring("classpath:".length()); reader = new BufferedReader(new Inp...
cf9726bf-63ea-4c62-a9e7-90cf44c2bc8a
7
private java.awt.image.BufferedImage create_EFFECT_Image(final int WIDTH, final int HEIGHT, final boolean CLICKED) { if (WIDTH <= 0 || HEIGHT <= 0) { return null; } final java.awt.GraphicsConfiguration GFX_CONF = java.awt.GraphicsEnvironment .getLocalGraphicsEnvironment().getDefaultScreenDevice() ....
0e7779d8-5d32-4940-8dec-e61c5c6d9c09
8
public void openXML(ObjectManager manager, double scale) { manager.clear(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { //Using factory get an instance of document builder DocumentBuilder db = dbf.newDocumentBuilder(); //parse...
78c7f5bc-c4df-49ca-8ef7-9f0d8eb3927a
2
protected void previous() { ParseNode previous=myParser.getPreviousAnswer(); addAnswerToList(previous.getDerivation()); treePanel.setAnswer(previous); treePanel.repaint(); if (previous.getProductions().length>0) statusDisplay.setText("Derived current Strings using "+previous.getProductions()[0]+" producti...
b615bccd-b5b8-4c6b-bae1-8e8982e98568
5
public static final Position getByValue(int v) { switch (v) { case 0: return NORTH; case 1: return SOUTH; case 2: return EAST; case 3: return WEST; case 4: return CENTER; default: throw new Il...
348e2c90-ea31-4c46-94b7-7bca904ee8af
1
public static ClientApp getClientApp() { if(instance == null) instance = new ClientApp(); return instance; }
a43615fa-8763-443d-9b6a-f622f17b4e0e
2
private String readFromStream(InputStream stream) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(stream)); String line = null; boolean first = true; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null) { if (first) { first = false; } else...
959e43ec-a8ce-4131-80ea-3384abfd986e
0
public void setScheduler( Scheduler scheduler ) { this.scheduler = scheduler; }
831d75fa-8ff5-4ed9-bd37-e16e319beb95
7
public List<Position> getDestinations(Position start, Player.Orientation orientation, Board board) { List<Position> destinations = new ArrayList<Position>(); int xDest, yDest; if (orientation == Player.Orientation.UP) { xDest = start.getX() + destination.getX(); yDest =...
2b5d8c93-ff70-46d5-bba5-27dbfafe029d
9
public CadastroRevisoes(String entrada, Revista revista) throws FileNotFoundException { this.entrada = entrada; this.revista = revista; File arquivo = new File(entrada); Scanner scanner = new Scanner(arquivo); String cabecalho = scanner.nextLine(); while (scanner.hasNextLine(...
f50b63ba-6ff3-460c-a105-91d29ff24c69
6
public int getTotalMovies(){ int movieCount = 0; //Count all movies for(Actor a : actors.values()){ for(Movie m : a.getMovieAppearances()){ if (!m.isVisited()){ movieCount++; m.setVisited(true); } } } //Reset all of the movie flags for(Actor a : actors.values()){ for(Movie m...
7209eb28-648f-4b4c-8255-d63dcb930151
1
@SuppressWarnings("deprecation") void playExecution() { for(ThreadsInformation threadInfo : ThreadsAgent) threadInfo.threadInfo.resume(); }
218df1c6-07a5-470b-b87d-1152b69aa144
2
public DirectedCycle(Digraph G) { marked = new boolean[G.V()]; onStack = new boolean[G.V()]; edgeTo = new int[G.V()]; for (int v = 0; v < G.V(); v++) if (!marked[v]) dfs(G, v); }
e534ebd7-053b-41ee-9d8a-af947d949551
9
private void processAllParticipants() { user_messages = new HashMap<String,String>(); //reset checks room_bot.current_standup_user = null; room_bot.did_user_speak = false; room_bot.did_user_say_anything = false; HipchatUser next_user = null; StringBuilder sb = new StringBuilder(); while ( (next_user = ...
067e57a4-497c-4df9-8ab5-075cc025488e
1
public final static int parseInt(String value) { if (isInt(value)) return Integer.parseInt(value); return 0; }
b8bffd3b-e9eb-4ca2-b4f6-e24cf7151483
7
@Test public void reTest6() { userInput.add("hi"); userInput.add("my name is meng meng"); userInput.add("can you bring me something"); userInput.add("knife"); userInput.add("errorhandling"); userInput.add("errorhandling"); userInput.add("errorhandling"); userInput.add("errorhandling"); userInput.add(...
fc814a2a-adca-4477-9687-d363e30a6038
6
public void BudujTabele(){ current=0; //wysokosc jedenj ramki 22piks HLevel=22; for(int i=0 ; i<ILOSC_POL ; i++) pola[i].setVisible(false); for (int i=0 ; i<Posilek.ILOSC_SKLADNIKOW ; i++){ DeleteAction[i].setValue(0); } for (int i =0 ; i<pos.current ; i++){ skl = BazaObject.IteratorSkladni...
3a5edf74-0515-422f-aefa-1023252732a2
4
static public OutputChannels fromInt(int code) { switch (code) { case LEFT_CHANNEL: return LEFT; case RIGHT_CHANNEL: return RIGHT; case BOTH_CHANNELS: return BOTH; case DOWNMIX_CHANNELS: return DOWNMIX; default: throw new IllegalArgumentException("Invalid channel code: "+code); } }
8cda3fcf-c3bf-4771-a653-308256498b06
9
@PostConstruct public void init() { httpHandler = new HttpHandler(); try { URL requestUrl = new URL("http://services.brics.dk/java4/cloud" + "/listItems?shopID=" + "195"); Element responseRoot = httpHandler.HttpRequest("GET", requestUrl) .getRootElement(); if (responseRoot == null) { ...
a0f40e2b-d254-444f-a1ab-7819159aa786
2
private void jComboBoxPaysItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxPaysItemStateChanged if (evt.getStateChange() == ItemEvent.SELECTED){ String test = ((Pays)this.jComboBoxPays.getSelectedItem()).getPays(); this.jTextFie...
cc0259fc-180b-4d51-82eb-c6aeef5ea7d4
4
@Override public Term parseTerm() throws IOException { Term term = new Term(); term.getFactorList().add(parseFactor()); while (curToken.type == DIVIDE || curToken.type == MULTIPLY) { switch (curToken.type) { case DIVIDE: curTok...
521251a3-cf6c-4b42-92e4-b31b5d8f4def
2
public List<Region> getRegions(RegionType type) { List<Region> regions = new ArrayList<Region>(); for (Region region : this.mapRegions) { if (region.getType() == type) { regions.add(region); } } return regions; }
cc3c0260-4cd3-4d6e-bb7d-5258bc0848ef
5
@Test public void t_gd2gc() /** ** ** Test jauGd2gc function. ** ** Returned: ** status int TRUE = success, FALSE = fail ** ** Called: jauGd2gc, viv, vvd ** ** This revision: 2009 November 6 */ { double e = 3.1, p = -0.5, h = 2500.0; ...
2f36e0e2-8b9f-4575-aa95-8daf5b176871
3
public boolean reserve(int theaterID) throws RemoteException{ if(this.lastRequest == -1) this.lastRequest = System.currentTimeMillis(); if(connectionTimout()) return false; ReservationReplyMessage reply; reply = rmiServer.reservationRequest(this.ID, theaterID, reservation); if(reply != null)...
6623fcbd-2da8-4708-a0c8-e198cd472162
0
public String getSkillName() { return skillName; }
6867d0c1-461b-4cef-9087-f73121855d13
1
private void Traversal(TreeNode root,ArrayList<Integer> list) { if(root != null){ list.add(root.val); Traversal(root.left,list); Traversal(root.right,list); } }
e4aed2b1-bc70-42d3-be42-14305ca82d56
9
private JButton generiereNeuenHandKartenKnopf(Karte neueKarte) { JButton handkarte = new JButton(neueKarte.getStadt().toString()); handkarte.setBackground(neueKarte.getStadt().getLand().getFarbe()); handkarte.setForeground(new Color(255, 255, 255)); handkarte.addActionListener(new Action...
1165c47d-64cf-420e-8489-04ea8bdc9e5c
1
public final JSONArray optJSONArray(String key) { Object o = opt(key); return o instanceof JSONArray ? (JSONArray)o : null; }
79cb414e-0edc-4532-930f-4cbed4d26088
3
public boolean equalsExpr(final Expr other) { return (other != null) && (other instanceof FieldExpr) && ((FieldExpr) other).field.equals(field) && ((FieldExpr) other).object.equalsExpr(object); }
33bd5a9b-143e-4924-be44-0b47b240409c
7
public void affiche () { int i = 0; int j = 0; while ( i < tableauDesCaisses.length ) { tableauDesCaisses[i].affiche(); i = i + 1; } System.out.print("Tous les ronchons: "); i = 0; int nbTotalRonchons = 0; int nbTotalRonchonnement = 0; if ( listeDesRonchons.size() == 0 ) { System.out.print("<...
3f8fd142-c125-4e05-922f-865b75aaac0f
4
@Override public Object getValueAt(int row, int col) { FSE theFSE = (FSE) theData.get(row); switch(col) { case 0: return theFSE.getCode(); case 1: return theFSE.getName(); case 2: return theFSE.getAddress().g...
1cbccd4f-0641-42a7-ad15-1c85d1dd1b86
5
public ConfigurationDialog(ClientMain parent) { super(parent, I18n.getInstance().getString("cfdTitle"), true); this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout(10,10)); panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); panel.setPr...
f167f3cb-85af-487b-8b92-e9433baf5b68
9
@Override public boolean isHygienicMessage(final CMMsg msg, final int minHygiene, final long adjHygiene) { if(CMSecurity.isDisabled(CMSecurity.DisFlag.HYGIENE)) return false; if((msg.sourceMajor(CMMsg.MASK_MOVE) &&((msg.tool()==null) ||(!(msg.tool() instanceof Ability)) ||((((Ability)msg.tool()).classi...
57b753dd-8a3d-435b-adcc-615a29447ade
7
static void printSystem ( Fraction[][] matrix ) { int spaces; out.printf( "\n" ); for ( int i = 1; i <= rows; i++ ){ for ( int j =1; j <= columns; j++ ) { if ( j != columns ){ if ( matrix[i][j].getNumerator() != 0 ){ spaces = maxLength - matrix[i][...
05f2b86f-a69e-4527-9ce9-a93df2254853
7
public static boolean checking(String person){ String[] dataArray = null; String target; double numOfone = 0; boolean notOne = false; try { BufferedReader csvFile = new BufferedReader(new FileReader("parserResult/coauthor_degree.csv")); while((target = csvFile.readLine())!= null){ dataArray = targe...
35d8894e-4b5e-407d-ab8d-f253d78d71d4
2
private Point2D scalePoint(Point2D point, Dimension2D size) { Point2D scale = null; try { scale = (Point2D) point.getClass().newInstance(); if (inverted) scale.setLocation(point.getX() * size.getWidth(), (1.0 - point .getY()) * size.getHeight()); else scale.setLocation(point.getX() * si...
b5a1c06a-91c4-4f92-b077-53a06f337d2d
0
public boolean[] getThreadStates() { return threadStates; }
0671a49a-180d-4aa7-88fc-39ef6a5aff2a
5
@Override public boolean insert(DataRow row) { Boolean flaga = false; try { con = DriverManager.getConnection(url, login, password); String stm; String tabelName = row.getTableName(); ...
7a9004fa-9037-4cfa-989a-b14846e0ffc6
8
private static SelectorMutableTreeNode generateTreeNode(Object obj){ SelectorMutableTreeNode node = new SelectorMutableTreeNode(obj); for(Method method : obj.getClass().getDeclaredMethods()){ if(method.isAnnotationPresent(CRRCSimEditorNode.class)){ try { ...
7ad6ee45-f9a4-4b5f-8727-e8973484f2b1
1
public boolean canStop() { return !(preStop || !isStarted); }
2d7b7259-8afc-4ad5-968a-fb7a8389bfa3
4
public static String edgeTypeToString(EdgeType type){ switch (type) { case NORMAL: return "N"; case ANTI_NORMAL: return "A"; case INNIE: return "I"; case OUTIE: return "O"; } return null; }
681503fc-cf43-4ef2-b161-b3d6552526d7
8
private BitSet selectABonds(String str) { int n = model.aBonds.size(); if (n == 0) return null; BitSet bs = new BitSet(n); if ("selected".equalsIgnoreCase(str)) { synchronized (model.aBonds) { for (int i = 0; i < n; i++) { if (model.getABond(i).isSelected()) bs.set(i); } } return ...
737f23bd-431e-4b7a-818e-128d40fb5d52
4
@Override public void processCas(CAS aCAS) throws ResourceProcessException { JCas jcas = null; try { jcas = aCAS.getJCas(); } catch (CASException e) { throw new ResourceProcessException(e); } String sentenceId = ""; FSIterator<TOP> sentenceIterator = jcas.getJFSIndexRepository...
a8e40357-6b99-4844-a0af-b2190140351a
6
@EventHandler public void SilverfishPoison(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.getSilverfishConfig().getDouble("Silverf...
a4bb1c82-a680-49c6-b4a6-c29f67f918b1
3
public void run() { System.out.println("启动消费者线程!"); Random r = new Random(); boolean isRunning = true; try { while (isRunning) { System.out.println("正从队列获取数据..."); String data = queue.poll(2, TimeUnit.SECONDS); if (null != data)...
9a42ce4f-9426-4878-97c7-ddf7be66edf9
0
public Iterator<Integer> getIDIterator() { return laenderMap.keySet().iterator(); }
d1e688b1-f81e-4b90-a4b2-f404bd90daf6
8
public void moveLeft() { setDirection(-90); for (TetrisBug tb : blocks){ tb.setDirection(-90); } if (rotationPos==0){ if (blocks.get(0).canMove() && blocks.get(2).canMove()) { blocks.get(2).move(); move(); blocks.get(0).move(); blocks.get(1).move(); } } if (rotationPos == 1)...
c3f90f79-eb1a-4f70-9553-41c69126c45f
7
private static String decodeRawWord(String rawWord) { if (rawWord == null || "".equals(rawWord)) { return rawWord; } char[] cs = rawWord.toCharArray(); boolean quoted = cs[0] == CHAR_QUOTE && cs[cs.length - 1] == CHAR_QUOTE; if (!quoted) { return rawWord; } boolean quoteOn = f...
590a0a0f-111a-4e21-b913-3b32fa098894
6
@RequestMapping("/lishi") public String lishi(String cardno,String name,String pages,HttpServletRequest request) throws Exception{ Map<Object, Object> map = new HashMap<Object, Object>(); int curPage = 0; List<Logging> loggings= loggingService.findLoggingByNo(cardno); if(loggings != null && loggings.size()>0){...
2945a246-2e15-4fca-bb5b-7239837a459c
1
public void testStreamTokenizer() { System.out.println("\n*** testStreamTokenizer ***"); try { String string = "()"; MyStreamTokenizer st = CycListParser.makeStreamTokenizer(string); assertEquals(40, st.nextToken()); assertEquals(41, st.nextToken()); assertEquals(st.TT_EOF, st.next...
146255dc-a220-4b92-abd2-0ab41e65e936
2
public void testGet() { YearMonthDay test = new YearMonthDay(); assertEquals(1970, test.get(DateTimeFieldType.year())); assertEquals(6, test.get(DateTimeFieldType.monthOfYear())); assertEquals(9, test.get(DateTimeFieldType.dayOfMonth())); try { test.get(null); ...
cfe97786-2968-4c99-8f06-96e0bfdd105e
6
public void method346(int i, int j) { i += anInt1442; j += anInt1443; int l = i + j * DrawingArea.width; int i1 = 0; int j1 = myHeight; int k1 = myWidth; int l1 = DrawingArea.width - k1; int i2 = 0; if(j < DrawingArea.topY) { int j2 = DrawingArea.topY - j; j1 -= j2; j = DrawingArea.topY; ...
e51d1ca3-c2f1-4a2a-8a97-1f1e159d30af
7
private void findMinMaxX(int y) { xMin = Integer.MAX_VALUE; xMax = Integer.MIN_VALUE; for (int i = rasterCount; --i >= 0;) { if (yRaster[i] == y) { int x = xRaster[i]; if (x < xMin) { xMin = x; zXMin = zRaster[i]; } if (x > xMax) { xMax = x; zXMax = zRaster[i]; } // ...
0490174f-7a0c-4502-8daf-367cc31bf5c9
2
@Override public boolean hasNext() { boolean hasNext = mIterator != null && mIterator.hasNext(); if (!hasNext) { mIterator = null; hasNext = mIndex < mRows.size(); } return hasNext; }
707985f5-d495-4036-b105-1c21b7dc7f81
6
public static void main(String[] args) { int n = 200000; int result = 0; int iterations = 0; int counter = 0; boolean[] isPrime = new boolean[n]; Arrays.fill(isPrime, true); for (int i = 2; i * i < n; i++) { if (isPrime[i]) { for (int ...
3992ddc8-43ee-4a38-8f6c-715a9cf26e08
9
private void debugAddNewUnitToTile(final Game serverGame, Tile tile) { Specification spec = serverGame.getSpecification(); List<ChoiceItem<UnitType>> uts = new ArrayList<ChoiceItem<UnitType>>(); for (UnitType t : spec.getUnitTypeList()) { uts.add(new ChoiceItem<UnitType>(Messages.mes...
61e9eb65-e2da-4641-ac3b-a88c99469668
1
public void keyTyped(KeyEvent e) { if (stage != null) { stage.keyTyped(e); } }
736e936c-ff8c-436c-85c7-d723b4d331bb
6
public void setTransient(Registry rg) { registry = rg; inventory = null; if(itemType != null) { itemType = rg.getItemManager().getItemType(itemType.getName()); if(itemType.getName().equals("ScrapHammer")) { int x = 9; } if(item == n...
85dba348-c19c-4f3f-806b-701702014db1
6
private static <T extends Comparable<? super T>> void siftDown(T[] array, int start, int end) { int root = start; //While root has at least one child not past the end of the heap while (left_child(root) <= end) { //Find biggest child and swap up: //Start with left child ...
c5eabd94-46dd-49af-92e2-dffbf11ef02a
7
public JMenuBar createMenuBar() { menuBar = new JMenuBar(); JMenu file = new JMenu("File"); menuBar.add(file); JMenuItem newMenuItem = new JMenuItem( new AbstractAction("New") { @Override public void actionPerformed(ActionEvent actionEvent) ...
ef76a579-0ab2-4b89-a873-e57c58e61eba
6
public static void nodesToString(Node[][] nodes,BufferedWriter out) throws IOException{ String s=""+NEWLINE; Node node=findConnectedNode(nodes); Node node2=node; s+=node.symbol.value+","+node.constraint.value+NEWLINE; out.write(s); s=""; do{ node2=node2.right; if (node2.connected) s+="\t"+node2....
8e085628-55ec-481c-8c87-ce0e05e7fc3b
0
@Override public int getHeight() { return height; }
9f4f2e9e-0f95-49e2-bd90-ffc0faaec44d
3
public void setupGUI() { if(count > 2 && count <=4) frogx=6; if(count>4) frogx=7; // // run[1]=new ImageIcon("NERDY_BIKER.PNG").getImage(); run[2]=new ImageIcon("NERDY_BIKER.PNG").getImage(); run[3]=new ImageIcon("NERDY_BIKER.PNG").getImage(); run[4]=new ImageIcon("NERDY_BIKER.PNG").getImage();...
49f67233-6057-41a3-8f63-d27434dcc266
6
private boolean _jspx_meth_c_forEach_1(PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // c:forEach org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_forEach_1 = (org.apache.taglibs.stand...
42c3f24a-38a3-4808-9de6-dec0869d939b
9
public void tick(){ if(blocksForeground != null){ for(int x = 0; x < blocksForeground.length; x++){ for(int y = 0; y < blocksForeground[x].length; y++){ if(blocksForeground[x][y] != null){ blocksForeground[x][y].tick(); } } } } if(blocksBackground != null){ for(int x = 0; x < bloc...
b001576d-ee74-43fd-aadf-18eca8a44d1f
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 && ...
a0ae08ec-5a19-4e45-af45-8ee69c4c3f1e
6
@Override public void add(E e){ int h = Math.abs(e.hashCode()) % table.length; Node<E> n = table[h]; while(n != null && !n.equals(e)){ n = n.next; } if(n == null){ // S'il n'existe pas, on l'ajoute table[h] = new Node<E>(table[h], e); size++; } // sinon, on ne fait rien puisque chaque élémen...
0f6fc423-5068-46f4-a0cd-49580286429e
4
public static HashMap<String, Double> sortByValue(HashMap<String, Double> map) { List<Map.Entry<String, Double>> list = new LinkedList<Map.Entry<String, Double>>(map.entrySet()); Collections.sort(list, new Comparator<Map.Entry<String, Double>>() { public int compare(Map.Entry<Strin...
8c4241c8-31f6-4613-ad52-1edec73f50bc
0
public ErrorSymbol(String message) { super(message); }
6f67bf3a-b7c8-435a-beeb-bf2e125c492c
9
@Override public boolean branch() { Player player = ctx.players.local(); if (ctx.game.clientState() != Constants.GAME_MAP_LOADED) { return false; } if (player == null || !script.options.getAreaSmall().contains(player)) { return false; } if (!ctx.backpack.isFull()) { return false; } if (ctx...
e95598f7-c87d-4ed5-b55c-bb5dc8c63ddf
4
public String getType () { switch (getAttributes () & 0x03) { case 0: return "control"; case 1: return "iso"; case 2: return "bulk"; case 3: return "interrupt"; } // "can't happen" return null; }
12156cd7-95a2-4d1e-8f4d-91fc14446a4b
3
public boolean equals(Board b) { boolean val = true; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if (this.board[i][j] != b.get(i, j)) return false; } } return val; }
0f497a9d-13ff-4823-b2f1-0f5ac900727a
7
private void processPolyLine(RdpPacket_Localised data, PolyLineOrder polyline, int present, boolean delta) { if ((present & 0x01) != 0) polyline.setX(setCoordinate(data, polyline.getX(), delta)); if ((present & 0x02) != 0) polyline.setY(setCoordinate(data, polyline.getY(), delta)); if ((present & 0x04) !...
3198045d-1b2d-4de9-b9c6-abb17448a1db
7
public FSList getAnnotations() { // try reading it from disk String readpath = "/springfield/lisa/data/linkedtv/"+mediaResourceId+"/annotations.xml"; System.out.println("READPATH="+readpath); String body = readFile(readpath); if (body==null) { Response response = HttpHelper.sendRequest("GET", MAGGIE+"&id...
6815eda5-c81c-4188-b698-ffcb931d86ba
6
public void move(long time) { if (state == DeliverState.delivered) return; // upravime podla rychlosti modelu double speed = player.getSpeedBalance() * player.getSendSpeed() * time * 0.001 * force; position += speed; // paksametle okolo odosielania a nevyskocenia z ...
2ff3e583-6de6-4294-a95b-42161ad49b6f
3
private long getOffset(Protocol.Section info, long until) { long sizeOfFirst = info.length; long timeDeltaFirst = info.endTime - info.startTime; long timeToSkipFirst = until - info.startTime; System.out.println(timeToSkipFirst + " " + timeDeltaFirst); // long exactStartingPlace ...
5146ac53-a4cf-4157-9f0d-c7ee776662b1
8
private static Map<Integer, Double> getRankedTagList(BookmarkReader reader, Map<Integer, Double> userMap, double userDenomVal, Map<Integer, Double> resMap, double resDenomVal, boolean sorting, boolean smoothing, boolean topicCreation) { Map<Integer, Double> resultMap = new LinkedHashMap<Integer, Double>(); i...
90749081-331d-4b71-9183-f969a7fa1951
8
public int characterAt(int at) throws JSONException { int c = get(at); if ((c & 0x80) == 0) { return c; } int character; int c1 = get(at + 1); if ((c1 & 0x80) == 0) { character = ((c & 0x7F) << 7) | c1; if (character > 0x7F) { ...
ba3007c1-85b1-44ea-921e-4ffe59b9db0d
1
public void joinTeam(String userName, String teamName, String matchName){ try { cs = con.prepareCall("{call joinTeam(?,?,?)}"); cs.setString(1, userName); cs.setString(2, teamName); cs.setString(3, matchName); cs.execute(); } catch (SQLException e) { e.printStackTrace(); } }
c50feeb0-e4e6-4218-ba80-1c75ce61d19f
9
public void onEnable() { // Create any required directories getDataFolder().mkdirs(); // Create/load configuration and customizable messages loadConfiguration(); // Disable plugin if auto-disable is set to true and server is running in online-mode if (getConfig().getBoolean("main.auto-disable") && getServ...
3f364e94-50ed-4327-a67e-6042ea44d3d8
7
public void merge(int[] array, int p, int q, int r) { int n1 = q - p + 1; int n2 = r - q; int[] leftA = new int[n1]; int[] rightA = new int[n2]; for (int i = 0; i < n1; i++) { leftA[i] = array[p + i]; } for (int j = 0; j < n2; j++) { rightA[j] = array[q + j + 1]; } int i = 0; int j = 0; ...
0bec556d-a126-40ec-803e-fe979db35cf1
2
public Grille (EnvironnementAbs env){ super(env); Border blackline = BorderFactory.createLineBorder(Color.black,1); for(int i= 0 ; i < env.taille_envi;i++){ for(int j= 0 ; j < env.taille_envi;j++){ agent[i][j].setBorder(blackline); } } pan.setBorder(blackline); }
5005b99c-c1e0-4647-a961-36004a8f73f8
9
public static void main(String args[]) { // Command line arguments if(args.length !=5) { System.out.println("Usage: <inputDataFileName> <NN> <searchFileName> <MM> <DEBUG_VALUE> "); System.exit(0); } try{ String readfile = args[0]; int NNread = Integer.parseInt(args[1]); String searchfile =...
b69cee79-4abe-4f0a-85b8-16c93f3171b2
5
@Override public boolean equals(Object other) { if (other == null || !(other instanceof MACByteArrayWrapper) || ((MACByteArrayWrapper)other).mac.length != this.mac.length) return false; for (int i = 0; i < this.mac.length; i++) if (((MACByteArrayWrapper)other).mac[i] != this.mac[i]) return fal...
80568c6a-a9da-45d7-951b-96f5dfd72040
1
public List<Long> sortNodes(){ List<Long> result = new ArrayList<Long>(); for (Long l : nodos) result.add(l); Collections.sort(result); return result; }
206dcc6d-744b-4399-bcbf-415882910ede
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 fe...
c2b0bfa4-d050-4645-8ccf-fd79a23b6aa1
1
public String greetServer(String input) throws IllegalArgumentException { // Verify that the input is valid. if (!FieldVerifier.isValidName(input)) { // If the input is not valid, throw an IllegalArgumentException back to // the client. throw new IllegalArgumentException( "Name must be at least 4 cha...
39eb9e50-db16-406a-9d84-931839093362
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (!(obj instanceof DieselLocomotive)) return false; DieselLocomotive other = (DieselLocomotive) obj; if (tankVolume != other.tankVolume) return false; return true; }
65ded175-0f63-479c-ba7d-f87ee2fe7f0e
5
public void update() { move(); if(walking) animSprite.update(); else animSprite.setFrame(0); if (ya < 0){ animSprite = up; dir = Direction.UP; } else if (ya > 0){ animSprite = down; dir = Direction.DOWN; } if (xa < 0){ animSprite = left; dir = Direction.LEFT; } else if (xa > 0){ an...
c06230fa-0fba-41d5-9d35-362d49ca733a
6
public boolean hitTank(Tank t){ if(this.isLive&& t.isLive() && this.getRect().intersects(t.getRect())&& (this.isMyMissile != t.isMytank())){ if(t.isMytank()){ t.setBlood(t.getBlood() - 20); if(t.getBlood() <= 0){ t.setLive(false); } }else t.setLive(false); this.setLive(false); tc.exp...
d024ce65-9279-4349-b155-2820ef731ee4
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); ...
3f282ddb-56d8-442b-bb42-c302d5927883
6
public static boolean isInputPressed(String command) { int[] checked = inputs.get(command); if (checked == null) { return false; } for (int i = 0; i < checked.length; i++) { if (container.getInput().isKeyPre...
ac5f1044-216b-4d2f-9882-b17e3cf9cfea
8
@Override public int posicionFichaY(int nivel) { return nivel == 1 ? 260 : nivel == 2 ? 233 : nivel == 3 ? 206 : nivel == 4 ? 179 : nivel == 5 ? 152 : nivel == 6 ? 125 : nivel == 7 ? 98 : nivel =...
e5cfdf87-c242-47c5-86a3-e6fe0d884fb8
2
private void insertTeam() { TeamBO teamBO = ServiceLocator.getBean(TeamBO.class); CountryBO countryBO = ServiceLocator.getBean(CountryBO.class); BufferedImage imBuff = null; InputStream is = InsertImageTest.class.getResourceAsStream("/flags/mexico_fmf.png"); try { imBuff = ImageIO.read(is); ...
cf8a2f92-8fd3-4ea5-8124-122cef6c863e
6
public static ListNode reverseKGroup(ListNode head, int k) { ListNode H = new ListNode(-1); H.next = head; if(head == null) { return head; } if(head.next == null) { return head; } if(k < 2) { return head; } int count = 0; ListNode startNode = H; L...