method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
92f4d116-34d4-427b-850f-5a5aa0e73a86
9
public static int recursive2(int indexIzq, int indexDer, int sum, int sumGreedy, int turn) { if (indexIzq > indexDer) { } else { if (turn == 0) { if (dp2[indexIzq][indexDer] != INF && indexDer != indexIzq) { return dp2[indexIzq][indexDer]; } else { int b = recursive2(indexIzq, indexDer - 1, sum...
7af70f68-fd70-43eb-8f0e-804fbea822ca
2
public void putSelfInGrid(Grid<Actor> gr, Location loc) { if (grid != null) throw new IllegalStateException( "This actor is already contained in a grid."); Actor actor = gr.get(loc); if (actor != null) actor.removeSelfFromGrid(); gr.put(lo...
efc0f3bf-b2ba-452a-bafc-479bb2ac5002
0
public CreativeMaterialType(final String name) { super(name); }
88bb6bb8-beae-406e-8a03-af9b0a1afb4b
5
private void capture(int destx,int desty) { if (!raider) {return;} if (destx==x&&desty==y) { if (bld!=-1) { buildings.Base city = Game.builds.get(bld); if (city.team!=Game.player.get(owner).team) { city.Capture((int) (health/10*Game.player.get(owner).CaptureBonus),owner); } } } }
da9b8a0e-2d85-487e-8587-83ec1dde356c
4
private static String generateKey() { Random r = new Random(); long maxNumber = 4294967295L; long spaces = r.nextInt( 12 ) + 1; int max = new Long( maxNumber / spaces ).intValue(); max = Math.abs( max ); int number = r.nextInt( max ) + 1; long product = number * spaces; String key = Long.toString( produ...
f0f3edaf-68c9-4167-8d67-898567d1b48d
8
protected void nodeID(StreamTokenizer tk) throws Exception{ if(tk.ttype=='"' || tk.ttype==tk.TT_WORD || (tk.ttype>='a' && tk.ttype<='z') || (tk.ttype>='A' && tk.ttype<='Z')) { if(m_nodes!=null && !(m_nodes.contains( new GraphNode(tk.sval, null))) ) { m_nodes.addElement( new GraphNode(tk.sval,...
6da2e3a2-c396-4cf4-84aa-ddafed13a1ca
5
public final boolean close() { synchronized (this.taskPool) { if (this.closed) { return true; } this.closed = true; this.taskPool.notifyAll(); synchronized (this.runningTaskList) { for (final Thread t : this.runningTaskList) { t.interrupt(); } } if (runningTaskList.contains(Threa...
322c2006-9f4e-41f0-ae44-eddc5ed31e27
7
public ResolutionResult doResolve( Dependency dep, Object target ) { Class<?> type = dep.getType(); Map<?, ?> map = BeanFactoryUtils.beansOfTypeIncludingAncestors( applicationContext, type ); if ( map.size() < 1 ) { if ( log.isLoggable(Level.FINE) ) log.fine( "No beans of re...
ea5c85dd-bc0c-495d-99b6-37278b619273
1
public void openJokerscherm() { middenvlak.removeAll(); for (JButton button : buttons) button.setEnabled(false); middenvlak.add(new JokerScherm(this, spel)); middenvlak.revalidate(); middenvlak.repaint(); btnStoppen.setEnabled(false); spel.getTimer().stop(); }
594e22ea-075a-4ce8-930d-d0114657e981
7
protected double[] freqCountsForAggNodesStrategy(double[] instance, Attribute classAtt) throws Exception { double[] counts = new double[classAtt.numValues()]; if (m_childNodes.size() > 0) { // collect the counts for (TreeNode c : m_childNodes) { if (c.getPredica...
6fab6918-b4b8-45b6-98a4-4d566989cccb
5
private void initField() { width = MainWindow.getInstance().getWidth(); height = MainWindow.getInstance().getHeight(); int maxX = 0; int maxY = 0; switch (currentModus) { case MODUS_3x3: maxX = 3; maxY = 3; break; case MODUS_4x3: maxX = 4; maxY = 3; break; case MODUS_5x4: maxX = 5;...
a77471db-377b-409c-9534-8637e1e1ccd0
4
public static String getPath() { java.util.Date date = new java.util.Date(); if (count == 0) { folder = String.valueOf(date.getTime()); new File(Brick.path + "/plays/" + folder).mkdir(); } String out = new Integer(count).toString(); if (count < 10) {out = "0" + out;} if (count < 100) {out = "0" + out...
b81d406e-2ff7-41b8-9dac-6daf6fff5efd
9
public String toString() { String s = ""; if (isEmpty()) { for (int i = 0; i < MAX_SIZE; i++) { s += "."; } return s; } SwapProcess curr = get(0); SwapProcess prev; char procName; int diff; for (int i = 0; i < size(); i++) { //print . for any empty space before the fir...
f5520722-fb34-4077-83fb-e2d8f4ea143a
4
public void move(Point loc) { if (loc == null) { setCurrentTab(defaultTab); return; } if (getTabBackground(curTab).contains(loc)) return; Rectangle[] rects = buildHeaders(); for (int i = 1; i < rects.length; i++) { if (rects[i].contains(loc)) { setCurrentTab(i - 1); return; } } setC...
8f8be253-d185-4a85-b15c-e4f83090f5ea
4
private void initLogger() { File file = new File("loggerFiles"); if (file.exists()) { String[] myFiles; if (file.isDirectory()) { myFiles = file.list(); for (int i = 0; i < myFiles.length; i++) { File myFile = new File(file, myFiles[i]); myFile.delete(); } } } else { file.mkdir()...
c87b7b97-a4da-40a6-8fad-9a1f9b80ca7c
3
public float determineCellFitness() { float validCounter = 0; for (int cellIndexY = 0; cellIndexY < gridPower; cellIndexY++) for (int cellIndexX = 0; cellIndexX < gridPower; cellIndexX++) validCounter += (isCellValid(cellIndexX, cellIndexY)) ? 1 : 0; return validCount...
fa6aff5e-4d41-47f2-bd6a-191ad1970d14
8
private void placeWalls(){ for(int y = 0; y < height; y++){ for(int x = 0; x < width; x++){ if(x == 0 || y == 0 || x == width - 1 || y == height - 1) if(getTile(x, y).equals(Tile.floorTile)) setTile(x, y, 0); if(getTile(x, y).equals(Tile.floorTile)) checkAndPlace(x, y, 0); } } }
011f8778-5a81-41f4-a2d5-59af967a33b4
4
public void playClip(String clipName) { Clip clip; //Don't play the clip if the sound has been muted if(muted) { return; } //Check if the clip exists if(!clips.containsKey(clipName)) { System.err.println("Breakout: No clip called " + clipName + " exists"); return; } try { clip ...
45849acb-b5d9-4ca2-965e-8f9d9dc000ca
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Journal journal = (Journal) o; if (isReview != journal.isReview) return false; if (name != null ? !name.equals(journal.name) : journal.name != ...
47b687d4-09a0-4f5e-adff-62c6dfb0aa0f
0
@Override public void undo() { this.to.removePiece(this.piece); this.from.addPiece(this.piece); this.rookTo.removePiece(this.rook); this.rookFrom.addPiece(this.rook); this.piece.decreaseMoveCount(); this.rook.decreaseMoveCount(); }
4e592787-1b97-4cc1-83aa-4afc3fcbd5ac
3
@Override public Class<?> get( ByteBuffer in ) { Integer length = Compress.getIntUnsignedNullable( in ); if (length == null) { return null; } byte[] bytes = new byte[ length ]; in.get( bytes ); try { ...
9127162b-d901-4f77-9a94-a654cbceda64
3
public void act() { Grid<Actor> gr = getGrid(); for(int r = gr.getNumRows() - 1; r >= 0; r--) for(int c = gr.getNumCols() - 1; c >= 0; c--) { Actor a = (Actor)gr.get(new Location(r, c)); if(a != null) {a.removeSelfFromGrid();} } ...
fb179116-bda5-45b6-8fb3-e32b98f839a9
5
public synchronized void cres(int id, int frame, Indir<Resource> res, Message sdt) { Gob g = getgob(id, frame); if (g == null) return; ResDrawable d = (ResDrawable) g.getattr(Drawable.class); if ((d == null) || (d.res != res) || (d.sdt.blob.length > 0) || (sdt.blob.length > 0...
e1661485-1cdc-4a50-ae37-b614a7f972e0
4
public boolean contains(final RequiredGroup... groups) { if (groups == null) return true; Map<Integer, Integer> used = new HashMap<>(); for (final RequiredGroup group : groups) { if (group != null && !group.inside(items, used)) return false; } return true; }
35ab42e1-4014-4c25-a40a-da665b2d2bbd
0
public String toString() { String affiche = "message de deplacement1"; return affiche; }
45eba924-36b3-4a5b-8fc4-08e3948e9852
1
public boolean equals(Object object) { return object == null || object == this; }
a0ddc82d-81b5-412b-ad88-5c22309b4a32
2
private static void setOMSProperties() { String oms_work = System.getProperty("oms3.work"); if (oms_work != null) { System.setProperty("oms.prj", oms_work); } System.setProperty("oms.version", oms3.Utils.getVersion()); if (System.getProperty("oms.home") == null) { ...
4831b4ac-03fe-489f-ab93-620c8f9df685
1
protected void addContentOfDirToList(Object obj) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) obj; FAT32Directory f32Directory = (FAT32Directory) node.getUserObject(); ListModel listModel = new DefaultListModel(); contentList = new JList(listModel); contentList.addLis...
a2bdd47d-3ba8-4e9d-98fa-c728141736ea
7
@Test public void test() { for ( Position pos : Position.values() ) { String name = null; String abbrev = null; switch ( pos ) { case QB: name = "Quarterback"; abbrev = "QB"; ...
c3826ac9-a8e9-4450-943a-f92f7121638e
9
private int getSumOfLetters(int max) { if (max > 1000) { throw new UnsupportedOperationException(); } int sum = 0; int cardinalLoop = Math.min(max, 19); for (int i = 1; i <= cardinalLoop; i++) { String s = DIC_ONE_TO_NINETEEN[i]; sum += s.length(); } int hundredLoop = Math.min(max, 999); for (i...
6f645f46-5d2c-4645-a0ef-2799cf2c1562
8
private void UEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UEActionPerformed // TODO add your handling code here: switch(etat){ case Debut: //interdit break; case Debut1: this.donner1.frame_UE(this.id_promo); ...
5cfb6e26-8956-4d68-91a8-a31f835ececa
8
public Set<Map.Entry<Integer,Integer>> entrySet() { return new AbstractSet<Map.Entry<Integer,Integer>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TIntIntMapDecorator.this.isEmpty(); } ...
3a84e8ed-c71d-4530-b145-8ce411652c1d
1
@Test public void issue14Fail () throws Exception { new ServerThread() { @Override protected void handleConnection ( final AFUNIXSocket sock ) throws IOException { // terminates connection } }; try ( AFUNIXSocket sock = connectToServer() ...
e24c7c76-f06d-4a25-96e8-09dbbfae7042
2
void solve3() { NHL nhl = new NHL(in); int count = 0; for (int i = 1230*2; i < 1230*3; i++) { Match m = nhl.getMatch(i); if (m.score.total == 7) { count++; } } out.println(count / 1230.0); }
8297f499-6d8d-4d1a-be35-5649621f3293
4
private void countVotes() { /* Re-initialize the votes count */ votesCount = new HashMap<>(); for (Integer candidateId : this.activeCandidates.keySet()) { votesCount.put(candidateId, 0); } int candidateId; for (Ballot b : this.ballots) { ...
f39a39ff-87b5-4b48-b9f2-8a3d843f8277
9
public int dijkstra(int s, int t, int c) { for (int i = 0; i < cost.length; i++) Arrays.fill(d[i], INF); PriorityQueue<Edge> q = new PriorityQueue<Edge>(); q.add(new Edge(s, 0, 0)); d[s][0] = 0; while (!q.isEmpty()) { Edge u = q.poll(); if(u.id == t) return u.w; if (d[u.id][u.g] < u....
d746b9ba-a798-4c3e-b608-9dc803f8c1fd
3
private Statement stmt() { Statement stmt; assert theTokenizer.ttype == StreamTokenizer.TT_WORD; String word = theTokenizer.sval; if(word.equals("output")) { stmt = outputStmt(); } else if(word.equals("if")) { stmt = ifStmt(); } else if(word.equal...
237c323f-26bd-4f11-9eed-3dc4c0d5b075
0
public String getInput() { return myInput; }
2f7e7aca-926a-4d0e-96e8-27a761b776d8
1
public boolean setElement(int index, Object element) { if (indexOK(index)) { return true; } return false; }
156db905-8b7e-4a58-81f2-e357281abaec
3
public int getStartingX(int index) { if(index == 0) { return 0; } if(index == 1) { return 383; } if(index == 2) { return 200; } return 0; }
d077c336-4fec-4b27-966f-e6dee2521043
7
public BufferedImage count(BufferedImage image){ drops.clear(); lines.clear(); int width = image.getWidth(); int height = image.getHeight(); Graphics g = image.getGraphics(); g.setColor(Color.RED); for(int i = 0; i < width; i += SCAN_WIDTH){ for(int j = 0; j < height; j++){ int pixel = image.getRGB...
fbddd0f9-1063-404e-a638-c9a1479e0904
9
public void display(TableElement element, ArrayList<Boolean> selected) { // Retrieves the matches for selected spectrum and finds them in the // model. ArrayList<TableElement> elements = new ArrayList<TableElement>(); _current = element; if(selected == null) _options.setCurrentElement(element); ArrayList...
9363b20a-4864-4bb5-b89a-56791b321fdf
1
@Override public void collided(Sprite sprite1, Sprite sprite2) { //передать в менеджер спрайты int countFaced = 1; for (Object ll : ((HashMap)this.getStorage()).values()) { countFaced = ((Sprite[]) ll).length; } _collisionMan.manageCollision(sprite1, sprite2, coun...
eff36c9f-baa9-4b19-9b5f-d5b7f1bc3b50
1
public static void listNotManagerBestSalary(EntityManager entityManager) { TypedQuery<Employee> query = entityManager.createQuery( "select e from Employee e where e not in (select m from Manager m) and e.phoneNumbers.size != 0 order by e.salary desc", Employee.class); query.setMaxResults(3); List<Empl...
bd5a9a7f-c1bc-421e-95fe-fad13505bad7
0
public Capture(Board field, Position start, int horizontal , int vertical ){ this.field = field; this.start=start; this.horizontal=horizontal*2; this.vertical=vertical*2; }
a53aff1a-bcf7-4437-b97d-8e55378a34e2
6
private int method185(int i, int j) { if(i == -2) return 0xbc614e; if(i == -1) { if(j < 0) j = 0; else if(j > 127) j = 127; j = 127 - j; return j; } j = (j * (i & 0x7f)) / 128; if(j < 2) j = 2; else if(j > 126) j = 126; return (i & 0xff80) + j; }
8a736c34-c8a2-4747-a937-65bddac95828
6
public void changeStyle(JTextComponent section, String style) { Font currentFont = section.getFont(); Font font = currentFont; switch (style) { case "B": if (!B) { font = currentFont.deriveFont(currentFont.getStyle() + Font.BOLD); } else { font = currentFont.deriveFont(currentFont.getStyle(...
653078b3-de9f-4d1b-ba18-177e04bdd468
3
public boolean connect(Plugin plugin) { Logging.info("Connecting to MySQL database."); db = new SQLite( Logging.getLog(), Logging.getNameVersion(), Chunky.getInstance().getDescription().getName(), Chunky.getInstance().getDataFolder().getPat...
7a5a9e99-0871-4960-b9de-7f19d5f332a3
7
public void insereNoNaoCheio(No x, int k) { int i = x.getN() - 1; //verifica se x é um nó folha if (x.isFolha()) { //adquire a posição correta para ser inserido a chave while (i >= 0 && k < x.getChave().get(i)) { x.getChave().set(i + 1, x.getChave().get(i)...
beb660a4-4252-4299-a1f2-e6ecc325073c
1
public int getChannelCount() { int count = (outputChannels==BOTH_CHANNELS) ? 2 : 1; return count; }
49db4661-7e4b-49ce-bb2d-1011be17e492
6
private boolean isNumber(final String characterString) { if (characterString.charAt(0) == '-' && characterString.length() == 1) return false; for (char character : characterString.toCharArray()) { if (!Character.isDigit(character) && character != '-' && character != '.') return false; } return tr...
b4f66e13-28f9-4a92-a526-cf9ac0e04c44
1
public void next() { if (status == STOP) { mp3list.markNextSong(); mp3list = mp3list.nextList(); setLivePanel(); } else { play(); } }
7cb8412c-ab50-4759-9392-65bef3a19cc4
4
private void handshake( BufferedReader in ) throws IOException, NoSuchAlgorithmException { MessageDigest sha1 = MessageDigest.getInstance("SHA1"); // our sha-1, for hashing the input key PrintWriter out = new PrintWriter(client.getOutputStream(), true ); // output to the socket ...
34f482b9-8c52-43a5-add0-9e395297cafb
1
public double[] getStringArrayProperty(String name) { int col = Util.findColumn(model, name); double[] a = new double[model.getRowCount()]; for (int i = 0; i < a.length; i++) { a[i] = Double.parseDouble(model.getValueAt(i, col).toString()); } r...
af9e2ac5-2459-4152-89db-c4dbd053bbdb
9
public Element writePropertyNode(Element parent, Object o, String name) throws Exception { Element node; PropertyNode pnode; Vector children; int i; Element child; // for debugging only if (DEBUG) trace(...
e816ddc2-936c-45a9-abc9-e350d87ac313
4
public boolean communicatorBuffDetector(int turretLoop){ int comLoop; for (comLoop = 0; comLoop < turretBuilder.size(); comLoop++){ if (turretBuilder.get(comLoop).turretType() == "Com" && turretBuilder.get(comLoop).turnedOn && turretBuilder.get(comLoop).inRange(turretBuilder.get(turretLoop).locX-3,turretBuilder....
a50077a2-55fb-416a-91c6-79df7bdef517
5
public boolean execute(CommandSender sender, String[] args) { String groupName = args[0]; GroupManager groupManager = Citadel.getGroupManager(); Faction group = groupManager.getGroup(groupName); if(group == null){ sendMessage(sender, ChatColor.RED, "Group doesn't exist"); return true; ...
96356653-7909-4994-b34c-e258f1f6f6fe
9
private static Character[] rearrange(String str, int k) { PriorityQueue<CharCount> queue = new PriorityQueue<>(); Map<Character, Integer> counts = new HashMap<>(); for (char c : str.toCharArray()) { if (!counts.containsKey(c)) { counts.put(c, 1); } else { ...
71822f4a-242a-4b36-b114-0a0df9edb4aa
0
private int[] getLocation(String variable, String lookahead) { int[] r = new int[2]; r[0] = getRow(variable); r[1] = getColumn(lookahead) - 1; return r; }
c6880584-10dd-45ec-ae05-9f44b82a9367
6
public void run() { try{ while(true){ try{ String message = (String)in.readObject(); if(!message.equals("")) System.out.println("Message from ["+CLIENT_IP+"] ->" + message); //sendData(db.receiveMsg(message)); sendData(controller_db.recieveMsg(message)); } catc...
3df6d9e8-c89d-479a-b566-c5ad4b69f969
5
private void checkDead(){ for (int row = 0; row < ROWS; row++) { for (int col = 0; col < COLS; col++) { if(board[row][col] == null)return; if(checkSurroundingTiles(row, col, board[row][col])){ return; } } } dead = true; if(score >= highScore)highScore = score; setHighScore(); }
5d5d4d16-e20e-4af2-8046-613a86ad0738
3
public void generateAll() { random.setSeed(seed); map = new Tile[mapWidth][mapHeight]; for (int i = 0; i < mapWidth; i++) { for (int k = 0; k < mapHeight; k++) { map[i][k] = Tile.grass; } } // generateMapOutside(); generateMapInside(); generateMapGrassMargin(); generateBuildings(); makeWaterRandom...
b0f5d583-60e9-47e7-9b5a-38f4792f0c17
7
private static void take() { if(currentLocale == 1){ taken[0] = interaction[0]; System.out.println(interaction[0].getDesc()); } else if (currentLocale == 2) { taken[1] = interaction[1]; System.out.println(interaction[1].getDesc()); } ...
30c467d9-292c-4c4f-b985-5c8b506c078d
8
@Override public void addLast(ListNode node) { ListNode beforeNode = root; ListNode currentNode = root; if (isEmpty()) { root = node; } else if (!isEmpty() && size() == 1) { if ((currentNode.isLessThan(node) || currentNode.isEqualTo(node))) { root.next = node; } else { node.next = root; r...
378123e9-c07e-49c7-ae80-6727df25b4c8
9
private boolean jj_3R_14() { if (jj_scan_token(LD)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_19()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(145)) return true; if (jj_la == 0 && jj_scan...
a6aa1882-6b98-4989-b19e-0cb7c6de00ec
3
public void selectAnswer(){ String person; String room; String weapon; ArrayList<Card> people = new ArrayList<Card>(); ArrayList<Card> rooms = new ArrayList<Card>(); ArrayList<Card> weapons = new ArrayList<Card>(); for(Card c : cards) { if(c.getType() == Card.cardType.PERSON) people.add(c); else...
232916ea-7a38-4266-a26a-4f48d951d718
5
private Unit takeMineralsWorker() { Unit toGive = null; for (ResourceInfo resource : minerals) { for (Unit worker : resource.workers) { if (!worker.isCarryingMinerals() && !worker.isConstructing()) { toGive = worker; break; } } if (toGive != null) { resource.workers.remove(toGive); ...
ef4e8ae1-27ff-47fe-91d0-41cfc3c2b6da
5
@Override public void run() { try { for (String line; (line = readLine()) != null; ) { write(String.format("%s\t\t%s> %s%n", DATE_FORMAT.get().format(new Date()), name, line).getBytes()); Object result; try { result = invoke(line); } catch (Throwable throwable) { ByteArrayOutputStream st...
f8b4c4e0-973c-40a6-bebb-abdc086400e7
0
public void onStart(IContext context) throws JFException { this.engine = context.getEngine(); this.console = context.getConsole(); this.history = context.getHistory(); this.context = context; this.indicators = context.getIndicators(); }
b4f6e8db-7412-4529-8e92-1d88d29a6a03
9
@Override public void keyPressed(KeyEvent event) { switch (event.getKeyCode()) { case VK_RIGHT:case VK_D: setApproachingAngle(0); break; case VK_DOWN:case VK_S: setApproachingAngle(90); break; case VK_LEFT:case VK_A: setApproachingAngle(180); break; case VK_UP...
57252e7a-f395-49af-9225-46a7a1088f1e
8
void repairCutValues(Edge edge) { spanningTree.remove(edge); Node n = getTreeTail(edge); int cutvalue = 0; int multiplier = (edge.target == n) ? 1 : -1; EdgeList list; list = n.outgoing; Edge e; for (int i = 0; i < list.size(); i++) { e = list.getEdge(i); if (e.tree && e != edge) cutvalue += ...
f91438ac-5bf1-41c6-b15a-bf6ffcbd7568
0
public PlayerObject(){ Rectangle2D.Double rectangle = new Rectangle2D.Double(getX(), getY(), 20, 20); setObjectShape(rectangle); }
6df8fa6c-ee40-4ceb-a431-0b47b1b20528
6
public boolean getBoolean(String key) throws JSONException { Object object = this.get(key); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String)object).equalsIgnoreCase("false"))) { return false; } else if (object.equals(Boolean.T...
835534a8-ab55-4538-8629-e9f240bc7401
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...
3c0d2fa9-76f7-49c7-be50-b9cf2d0b2124
6
public int getBlockId(int par1, int par2, int par3) { return par1 >= -30000000 && par3 >= -30000000 && par1 < 30000000 && par3 < 30000000 ? (par2 < 0 ? 0 : (par2 >= 256 ? 0 : this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4).getBlockID(par1 & 15, par2, par3 & 15))) : 0; }
4d06da6a-3f0a-48dd-a870-305904fffb3d
5
private void handleNumber() { if (Utils.isNumeric(tfEmployeeNumber.getText())) { int employeeNumber = Integer.parseInt(tfEmployeeNumber.getText()); employee = RoosterProgramma.getInstance().getEmployee(employeeNumber); if (employee != null) { if ("(NULL)".equa...
07283588-d5b8-4045-909b-3c37ba9efe1e
5
@Override public boolean equals(Object o) { if (o == null) return false; if (getClass() != o.getClass()) return false; UsernameModel user = (UsernameModel)o; if (user.getName() != name) return false; if (user.getStyle() != style) return false; ...
8f50432e-ec40-4701-9224-92970b5e90b5
0
public String getAccountStatus() { return this.accountStatus; }
2bfe1456-cb1f-4fd1-b211-a7af7a55e214
3
public ExceptionProcessor() { Map<Class<? extends Exception>, ExceptionHandler<? extends Exception, ? extends AsMap>> tempMap = new HashMap<>(); AuthenticationExceptionHandler authHandler = new AuthenticationExceptionHandler(); tempMap.put(authHandler.applicableTo(), authHandler); Base64...
8b54efbb-4819-47c9-b396-851c644768d7
9
private Object[] minimax(Board board, Jogador jogador, int maxDepth, int currentDepth) { cont++; Object[] resultado = new Object[2]; /* if (board.isGameOver()) { if (board.currentPlayer().cor==jogador.cor) { resultado[0] = PONTO_FIM_JOGO; } else { resultado[0] = -PONTO_FIM_JOGO; } resultado...
ea03cfff-2aee-4e6f-94cc-0c45684c779c
7
@Override public void execute(GameActor character, CharacterAction action) { if (!running) { stoppable = false; running = true; counter = 0; character.updateVelocity(0, 0); } counter++; System.out.println("Counter : " + counter); ...
94de11c3-56ec-4abe-8fc2-809ab5027525
3
public static void main(String[] args) { // Skapar värden int n = (new Random().nextInt(10)+1); int m = (new Random().nextInt(10)+1); int [] NtoY = new int[n]; int [] XtoM = new int[m]; int [][] vagar = new int[m][n]; for(int i = 0; i < m; i++) { XtoM [i] = (new Random().nextInt(10)+1); ...
87b837e4-cd78-4b51-8c1b-1960f6ad0529
8
final public void Source() throws ParseException { /*@bgen(jjtree) Source */ ASTSource jjtn000 = new ASTSource(JJTSOURCE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { jj_consume_token(SOURCE); String(); } catch (Throwab...
e3e18079-1609-4a8e-a95f-a0ccaad903ac
8
@Override public void paintComponent(final Graphics g) { if (images == null) { g.setColor(Color.black); Graphics2D g2 = (Graphics2D) g; g2.fill(g.getClipBounds()); recalc(); return; } boolean bl = false; for (int n = 0; n < images.length; n++) { for (int m = 0; m < images[n].length; m++) {...
dc4f0af2-08a1-417a-be8b-eb8f0cb81b4d
0
@Test(expected = java.lang.RuntimeException.class) public void test_get_long_missing() { Assert.assertEquals(8989l, getLong("bogus_key!")); }
d8222b1b-e1a0-4ca5-841f-d150f0240b25
5
public PlayOfflineDialog(String cause, final String username, final String uuid) { super(LaunchFrame.getInstance(), true); setupGui(); play.addActionListener(new ActionListener() { @Override public void actionPerformed (ActionEvent arg0) { ModPack pack = ...
76b542fc-a04a-4303-a8ad-c367516823f7
1
private synchronized void reward() { length++; try { CharBuffer response = CharBuffer.wrap("{'type': 'kill'}"); outbound.writeTextMessage(response); } catch (IOException ioe) { // Ignore } }
57ab2c39-f247-48d3-9e9b-7cf2fc3a04a6
0
public void setFirst(String first) { this.first = first; setDirty(); }
f3ae1d44-39a6-4e63-9dfe-342979b56732
5
public static ItemDefinition forId(int id) { for (int i = 0; i < 10; i++) { if (ItemDefinition.itemCache[i].id == id) { return ItemDefinition.itemCache[i]; } } ItemDefinition.cacheIndex = (ItemDefinition.cacheIndex + 1) % 10; ItemDefinition itemDefinition = ItemDefinition.itemCache[ItemDefinition.cach...
c0c685a7-91db-4f86-8d7a-0551fb9a8075
1
public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int cases=scanner.nextInt(); scanner.nextLine();//去掉第一行的enter while (cases-->0){ System.out.println(judge(getInput(scanner),getInput(scanner))); } }
c5e29f35-bddb-40e6-9a06-5b154fd832f2
5
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub try { BufferedReader br = new BufferedReader(new InputStreamReader(request.getInputStream(),"utf-8")); String line =...
4e032dde-04c6-4200-a067-937bd24a2142
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...
57f31b82-3e9b-46d7-9ea4-74b3ab627459
6
public void unesiGosta() { if (comboBox.getSelectedItem().toString() == "") { JOptionPane.showMessageDialog(null, "Ne mozete unijeti gosta bez statusa", "Info", JOptionPane.INFORMATION_MESSAGE); return; } if (validiraj() != "") { JOptionPane.showMessageDialog(null, validiraj(), "Info", JOpt...
db12b8e5-4ca3-4e4c-a936-aaa2e26028f4
7
@Override public void keyReleased(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_UP: _player.changeKey(Player.KEY_UP,false); break; case KeyEvent.VK_LEFT: _player._isRunning = false; _player.changeKey(Player.KEY_LEFT,false); break; case KeyEvent.VK_DOWN: _player.changeKey(P...
80a605cd-6e2c-4c1e-8694-f16a9651f051
0
public int getId() { return id; }
4a879403-7e4f-48ea-8557-7833b5b223b8
9
public void loadBackgroundMap(File file) { if (!file.isFile()) { return; } try { ArrayList<Point> backgroundMap = new ArrayList<Point>(); BufferedImage img = ImageIO.read(file); PixelGrabber grabber = new PixelGrabber(img, 0, 0, -1, -1, true); ...
57b92c60-b182-4ffa-8a2b-54b0b15bb4ac
7
public int uniquePaths(int m, int n) { int[][] f = null; f = new int[m][]; for (int i = 0 ; i< m ; i++){ f[i] = new int[n]; } if ( m == 0 || n == 0) return 0; for (int i =0; i<m;i++) for (int j = 0 ; j<n; j++) { if (i == 0 || j == 0) f[i][j] = 1; else { ...
72085dba-bd67-4747-992f-9c38f4677d44
1
double getDecC(int muricanC) { if (muricanC > 0) { return (muricanC + 100) / 100.0; } muricanC = Math.abs(muricanC); return (muricanC + 100.0) / muricanC; }
65822d48-e2eb-4a20-bc1a-1fa4ecfae316
2
public ItemStack[] getInventoryContents() { ItemStack[] stack = new ItemStack[Inventory.length]; for (int i = 0; i < stack.length; i++) { if (Inventory[i] != null) stack[i] = Inventory[i].clone(); } return stack; }
5fc79c9c-0498-4f1f-ba67-fb499f6cc742
9
static protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenB...