method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b73cc871-13fd-4a00-84a5-0809c2321798
1
public BigDecimal getValue(int row, int clums, int sheetat) { BigDecimal value = new BigDecimal(0); String s = null; try { hSheet = hWorkbook.getSheetAt(sheetat - 1); hRow = hSheet.getRow(row - 1); hCell = hRow.getCell(clums - 1); hCell.setCellType(Cell.CELL_TYPE_STRING); s = hCell.getStringCellVal...
c2958e55-a392-4ad4-824f-19ba91da27bd
9
private void fixup() { // The trie has changed since we last // found our toKey / fromKey if(modCount != keyModCount) { Iterator<Map.Entry<K, V>> iter = entrySet().iterator(); size = 0; Map.Entry<K, V> entry = null; ...
9382307b-2018-4e9c-b067-b51af2b1bd56
7
public static String convert(String coreNLPTag) { if (coreNLPTag.startsWith("NN")) { return "noun"; } else if (coreNLPTag.startsWith("VB")) { return "verb"; } else if (coreNLPTag.startsWith("JJ")) { return "adjective"; } else if (coreNLPTag.startsWith("RB")) { return "adverb"; } else if (coreNLPTa...
27ff0726-4cb7-4bbc-b87a-5e43e5ba330a
3
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...
498f20d7-4ca4-4059-8e93-b6cedf437e8a
7
private static boolean isDeclarationTarget(AnnotationDesc targetAnno) { // The error recovery steps here are analogous to TypeAnnotations ElementValuePair[] elems = targetAnno.elementValues(); if (elems == null || elems.length != 1 || !"value".equals(elems[0].element().na...
c09a22fc-bbfd-43bc-a4db-f3086525f46b
6
public boolean getBoolean(String key) throws JSONException { Object o = get(key); if (o.equals(Boolean.FALSE) || (o instanceof String && ((String)o).equalsIgnoreCase("false"))) { return false; } else if (o.equals(Boolean.TRUE) || (o ins...
5486e6c0-e844-489b-a943-8ea328f1d2c9
0
@AfterClass public static void tearDownClass() { }
89afb922-f393-4fec-8827-439fa088184c
3
@Override public void die(){ if (sound.Manager.enabled) { sound.Event effect = new sound.Event(getPosition(), getVelocity(),sound.Library.findByName(SOUND_EFFECT)); // make bigger asteroids explode bigger effect.gain = EFFECT_VOLUME * scale.magnitude2(); effec...
fb578f28-074e-444a-94b1-34525b3c2840
6
public void findRepetingElementsMethodOne(int[] a) { /* Keep the aggregate XOR operation */ int xor = 0; for (int i = 0; i < a.length; i++) { xor ^= a[i]; } for (int i = 0; i < a.length - 1; i++) { xor ^= i; } /* Isolate the right-most bit set in xor */ int rightMostBitSet = xor & ~(xor...
15c8d58a-f306-424d-8481-bb99f31010c4
7
public ChatClient () { client = new Client(); client.start(); // For consistency, the classes to be sent over the network are // registered by the same method for both the client and server. Network.register(client); client.addListener(new Listener() { public void connected (Connection connection) { ...
adfee78e-8869-42d2-8123-9a81fa2fde1e
7
public static void main(String[] args) { Random r = new Random(); ArrayList<Integer> lista = new ArrayList<>(); BufferedReader buffer; try { File file = new File("numeroRandom"); buffer = new BufferedReader(new FileReader(file)); String line; while ((line = buffer.readLine()) != null) { lista.ad...
95df641f-3ac1-4811-bd1d-244884f22b87
3
@Override public void deserialize(Buffer buf) { mountUid = buf.readDouble(); if (mountUid < 0) throw new RuntimeException("Forbidden value on mountUid = " + mountUid + ", it doesn't respect the following condition : mountUid < 0"); mountLocation = buf.readByte(); mountFoo...
f6784103-385c-4825-a357-4da6c2fb2322
7
@SuppressWarnings("unchecked") public void loadCache() { if (!this.cacheEnabled) return; final String cacheFile = (this.cachePath == null) ? DEFAULT_CACHE_FILE : this.cachePath; try { // lock the lockfile final FileInputStream fis = new FileInputStream(cacheFile); final ObjectInputStream ois = new ...
69fee4e9-4688-4877-b710-701f2d27a1e3
2
public static void resolve(Tasks[] tasks, int currentTask, boolean[] used, int[] order, int orderPos) { for (int i = 0; i < tasks[currentTask].reqs.size(); ++i) { if (!used[tasks[currentTask].reqs.get(i)]) { resolve(tasks, i, used, order, orderPos); used[i] = true; order[orderPos] = tasks[currentTask]....
a445f933-7f09-492d-be79-22527639c9b7
1
protected static Integer parseID(String string) { try { int num = Integer.parseInt(string); return new Integer(num); } catch (NumberFormatException e) { return new Integer(-1); } }
8fc67426-3086-4689-8479-0e14c42c6b11
1
public static void reset() { log.clear(); if (debug) System.out.println("Clearing all intel"); }
7c7dab5e-50a2-419f-9b40-affea85ab9f2
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...
6f66dbc3-3d00-4310-b9b2-a9b35d090951
0
public boolean hasError() { return error; // Return error status }
1f979eb8-473a-4083-a9a9-c62428f3f15f
4
@Override public void handleInput() { InputUpdate i = new InputUpdate(); i.input =-1; if(Keys.isDown(Keys.W)){i.input = Keys.W;client.sendTCP(i);} else if(Keys.isDown(Keys.S)){i.input = Keys.S;client.sendTCP(i);} else if(Keys.isDown(Keys.A)){i.input = Keys.A;client.sendT...
dc5d3779-9d94-41ed-9dcf-0015243bf7d6
5
public void parseInfoLines() { chromLine = header.indexOf("#CHROM") >= 0; if (vcfInfoById == null) { vcfInfoById = new HashMap<String, VcfInfo>(); // Add standard fields vcfInfoById.put("CHROM", new VcfInfo("CHROM", VcfInfoType.String, "1", "Chromosome name")); vcfInfoById.put("POS", new VcfInfo("POS...
d6083a05-5b96-402b-9833-c22d3cd1c2a1
1
public boolean add(Object li) { if (contains(li)) return false; grow(1); locals[count++] = (LocalInfo) li; return true; }
0ce400aa-376e-4b2a-9d0c-94d0554de23b
3
@Override public void processWalks(final WalkArray walks, final int[] atVertices) throws RemoteException { try { pendingQueue.put(new WalkSubmission(walks, atVertices)); int pending = pendingQueue.size(); if (pending > 50 && pending % 20 == 0) { logger.inf...
0dd995b5-869c-438c-9924-c7954b1200e1
6
public boolean movesremaining() { for (int i = 0; i < bricks.length; i++) { for (int j = 0; j < bricks[0].length; j++) { if (bricks[i][j].state == true) { boolean playing = remaining(i, j, 1); if (bricks[i][j].color >= 6 && bricks[i][j].color <= 8) playing = true; if (playing) return...
04d357f3-8ef9-47cf-92d3-bbe1aa98914f
4
public String salvar() { try { if (tarefa.getId() == null) { tarefa.setStatus("1"); tarefaDao.salvar(tarefa); mensagem = "Tarefa Salva com Sucesso!"; tarefa = new Tarefa(); } else { // setando esses atributos,...
d1c6daf2-8077-4e3e-8abb-efff4758e09e
9
private void setupFrame() { _defaultFont = new FontUIResource("Dialog", Font.PLAIN, 12); _boldFont = new FontUIResource("Dialog", Font.BOLD, 12); _fixedFont = new FontUIResource("Monospaced", Font.PLAIN, 12); _persistitAccentColor = new Color(119, 17, 34); String lnfClassName =...
90f72830-a658-4d8d-b541-6c0e224ae5e2
5
private void btnAjouterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAjouterActionPerformed // TODO add your handling code here: if(!taAdresse.getText().equals("") && !tbfax.getText().equals("") && !tbtel.getText().equals("")) { PharmacieDAO pdao= new Pha...
8d968556-82a6-45f3-8fbb-783b422726a6
5
public boolean userName_IsValid(String user) { Connection con = null; Statement stmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = DriverManager.getConnection(dbCon.getDATABASE_URL(), ...
0e0eee7b-e13a-408d-b3af-6d2b68a2f6cf
8
protected void txtFilterKeyPressEvent(KeyEvent arg0) { Vector<Account> res = null; if( txtFilter.getText().length() == 0 ) { res=FkManager.getInstance().getList(); txtFilter.setBackground( defaultBgColor ); } else { res = FkManager.getInstance().getList(txtFilter.getText()); if( res.size() < 1 ) ...
73bd0b74-c6f9-4648-9cb0-3f5cdae40c1c
8
final void method3049(ByteBuffer class348_sub49, int i, int i_72_) { while_146_: do { try { anInt9146++; if (i_72_ == 31015) { int i_73_ = i; do { if (i_73_ != 0) { if ((i_73_ ^ 0xffffffff) != -2) { if (i_73_ == 2) break; break while_146_; } } else { ...
d61fad1d-aaeb-466a-9952-45d5782c800c
8
public String getValue(String varName) throws VariableException { String result = null; if (gate == null) throw new VariableException("cannot get var's value since no gate is currently loaded", varName); if (varName.equals(VAR_TIME)) result = String.valueOf(time) + (clo...
c7a95866-a462-4b45-b692-af30b6bdd9d0
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...
c3a7dbfc-317e-4ceb-9972-a3f9a06fba42
3
public boolean authenticate() throws SessionException, IOException, GatewayValidationException { if (!session_mode) { throw new SessionException("This function can only be called when Session Mode is enabled."); } URL obj = new URL(URL + "auth?api_id=" + api_id + "&user=" + user + "...
a2409674-8f18-4335-b646-7c626e602abf
2
@Override public void update(final int delta) { PlayerEntity player = game.getPlayer(); if (collisionBox.intersects(player.getCollisionBox()) && Math.abs(player.pos.y - pos.y - SIZE) < 3) { collideWithPlayer(player, delta); } }
9a10cc04-73dd-45b5-9773-e2c84f8dec51
3
private boolean _jspx_meth_c_import_0(PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // c:import org.apache.taglibs.standard.tag.rt.core.ImportTag _jspx_th_c_import_0 = (org.apache.taglibs.standard....
49313eec-ec3c-42f0-8c3e-b9b54489263b
3
private String getWest(char a) { if ('0' == a) return "1, W"; if ('1' == a) return "0, halt"; if ('2' == a) return "3, W"; return "2, halt"; }
acf76799-4641-409c-a419-f4666581e593
1
private void readLines(final MyObjects myObjects, final BufferedReader reader) throws IOException { String line; try { while ((line = reader.readLine()) != null) { myObjects.addLine(line); } } finally { reader.close(); } }
25a02e8f-1e97-4a32-8e44-311e989cba3c
3
public void Clear(){ num=0; if(Composer instanceof FreeMMC) Composer.setNotes(null); else if(Composer instanceof AtonalMMC) Composer =new AtonalMMC(compName,composer); else if((Composer instanceof AlgorithmicMMC)) ((AlgorithmicMMC) Composer).setNum(num); }
3d67efdd-e286-4f63-84df-0f9baa5ff07e
2
@Override public boolean equals(Object o){ if(o instanceof Peer){ return ip.equals(((Peer) o).ip)?true:false; //Love the Trinary Operations } return false; }
52eab402-4d43-4182-9400-99a2ad618bd2
5
public void run() { a = new Vector3D[bodies.size()]; for (int i = 0; i < bodies.size(); i++) { // Necessary to preload // accelerations for // leapfrog integration. a[i] = getAcceleration(bodies.get(i)); } aCraft = new Vector3D[ships.size()]; for (int p = 0; p < ships.size(); p++)...
e5b14579-f902-4e93-b54c-4ffd7845b215
6
public static byte[] decodeBase64(String source) { // Clean string source = source.replaceAll("[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/_-]+", ""); int decodedLength = ((source.length() / 4) * 3) + (source.length() % 4 > 0 ? ((source.length() % 4) - 1) : 0); byte...
facd3673-9ba3-457a-93f5-d042fd12ec04
6
public void SRC(){ pcIncrease(); int number = Integer.parseInt(getCOUNT().get(), 2); getALU().OP1.set(SelectRegister().get()); if (getI().get().equals("0")&&getT().get().equals("0")){ getALU().arithShiftRight(number); SelectRegister().set(getALU().RES.get(...
2bcc87ea-8361-4016-9b7b-944303a6798f
5
public int getFacingNPC() { TiledMap map = World.getWorld().getMap(); int layerIndex = map.getLayerIndex("npc"); Vector2 diff = getGridPosition().copy(); switch(getDirection()) { case Direction.NORTH: diff.addY(-1); break; case Direction.EAST: diff.addX(2); break; case Direction.SOUTH: diff...
a6c2495f-8360-4daa-a5df-067195ba945a
2
protected void setRootPane(RootPane rootPane) throws SlickException { if (!guiInitialized) { guiInitialized = true; initGUI(); } if (gui != null) { gui.setRootPane(rootPane); } }
83d93e8c-77de-4563-b858-5e59c9e6740b
7
private boolean fillBuffer(int minimum) throws IOException { char[] buffer = this.buffer; lineStart -= pos; if (limit != pos) { limit -= pos; System.arraycopy(buffer, pos, buffer, 0, limit); } else { limit = 0; } pos = 0; int total; while ((total = in.read(buffer, limi...
e31989a6-74b0-4581-b13a-a5cc10eeba88
3
public void addChilds(final HTML...childsToAdd) { if ( childsToAdd == null ) return; for (final HTML child : childsToAdd) if ( !this.hasChild(child) ) { child.setParent(this); this.childs.add(child); } }
fccb49c4-2102-4c18-992c-60c04f73b401
2
private static int createOldStyleMask(StdImage image, List<byte[]> imageData, List<Integer> imageType, int type) { int size = image.getWidth(); byte[] bytes = new byte[size * size]; int i = 0; for (int y = 0; y < size; y++) { for (int x = 0; x < size; x++) { bytes[i++] = (byte) (image.getRGB(x, y) >>> 24...
bcc621d9-961d-4b98-ba58-838944103328
8
public void update(Level level, int x, int y, int z, Random rand) { boolean var7 = false; z = z; y = y; x = x; level = level; boolean var8 = false; boolean var6; do { --y; if(level.getTile(x, y, z) != 0 || !this.canFlow(level, x, y, z)) { br...
db6df4c7-99bd-415b-a205-b5476bd12f36
8
private void constructJson(JSONObject json) throws WeiboException { try { createdAt = parseDate(json.getString("created_at"), "EEE MMM dd HH:mm:ss z yyyy"); id = json.getString("id"); mid=json.getString("mid"); idstr = json.getLong("idstr"); text = json.getString("text"); if(!json.getString("source"...
17523e39-1e02-40d3-aec0-a4a9ae842c35
3
@Override public double distribute(TVC newCon) { TVC con = null; // We cloned connections to environment before, so we have to find our environment specific connection in our list. :( for (TVC c: environment.getConnectionsSortedUp()) { if (c.equals(newCon)) { con = c; } } ...
48abdafd-09e2-4820-ac7a-72bace30cac9
5
@Override public void actionPerformed(ActionEvent e) { switch(e.getActionCommand()){ case "search": LibrarianActionsControl.searchForBooks(this, new String[]{isbnField.getText(), (String) comboBox.getSelectedItem(), authorField.getText(), titleField.getText()}); break; case "edit": CardLayout layout = (...
c9f70cf0-ab71-4c29-b1b2-3a3120bbeb86
4
public static void loadHats() { ConfigManager.reload(plugin, "hats.yml"); FileConfiguration config = ConfigManager.get("hats.yml"); ConfigurationSection configurationSection = config.getConfigurationSection("hats"); loadedHats.clear(); for (String name : configurationSection.getKeys(false)) { if (loadedHat...
5b5c8205-7757-4c8d-88bf-d84ec7abe884
9
public static char[] getResult(char[] state, Action action) { for (int i=0; i<state.length; i++) { if (state[i] == Puzzle.BLANK) { char[] result = new char[state.length]; int boardSize = (int) Math.sqrt(state.length); int iNew = i; if ...
d890b990-52e4-4e1d-8bf9-346dcac0dbe5
0
@Override public ArrayList<Excel> getColoredExes() { // TODO Auto-generated method stub return coloredEx; }
3497ae5c-7c48-4151-9129-0b1e83c88565
6
public static void generation() { addToTable(constructers); int start = 0; while (true) { if (Config.verbose >= 1) { System.out.print("Generation : " + start + " ->"); } ArrayList<Node> newList = new ArrayList<Node>(); ArrayList<Node> list = mainList.get(start); int taille = list.size(); in...
923d3603-816f-4404-8cca-46cddb4bbb83
2
private int getMinChildHeuristic(TrieNode node) { int min = 0; for (TrieNode child : node.getChildren().values()) { if (child.getHeuristic() > min) { min = child.getHeuristic(); } } return min; }
2fe01fcf-4c97-4633-b5ec-1746aff74b2f
1
public boolean dispatch(CommandSender sender, Command command, String label, String[] args) { if (!this.commands.containsKey(label)) { return false; } boolean handled = true; CommandExecutor ce = (CommandExecutor) this.commands.get(label); handled = ce.onCommand(sende...
4861fc00-bd04-4a3c-b707-c2192b10c448
7
@Override public void update() { logger.trace("update: " + stateMachine.getState()); switch (stateMachine.getState()) { case INGAME: start.dispose(); game = new Game(penController, stateMachine); break; case MENU: start = new StartMenu(stateMachine); if (options != null) { options.dispose();...
0d461712-e7f2-49a3-b381-d720b7d0e3af
8
public String toString() { int totalOutdegree = 0; int totalIndegree = 0; int totalNodes = 0; int maxIndegree = 0; int maxOutdegree = 0; StringBuilder sb = new StringBuilder(); HashSet<Node> printed = new HashSet<Node>(); try { SimpleQueue<Node> queue = new SimpleQueue<Node>(); queue.add( start...
3aa91705-5b9b-4b66-b6ff-d70110c7d0c2
1
public void sortSccsBySize() { Iterator<Integer> it = sccsOfLeader.keySet().iterator(); int i = 0; while (it.hasNext()) { int leaderVertex = it.next(); int sizeOfSccs = sccsOfLeader.get(leaderVertex).size(); sortedSCCsSize[i] = sizeOfSccs; i++; } // sorting the array int length = i; System.ou...
c4a37904-e3c9-4f19-9e0c-30623db0f5e6
9
public static String decrypt(String strToDecrypt, int ikey){ byte[] key = null; if(ikey == 0){ key = thekey; if(thekey == null){ return "ERROR: NO KEY"; } }else if(ikey == 1){ key = the2ndkey; if(the2ndkey == null){ return "ERROR: NO KEY2"; } }else if(ikey == 2){ key = the3rdkey; ...
dbe5a1de-3138-4cef-b3f0-b2ed18777402
9
private void removeSongButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeSongButtonActionPerformed List<Song> selected = ownedList.getSelectedValuesList(); for (Song s : selected) { if(currUser.getLibrary().hasWaitingList(s)) { Queue<User> users = currUser.getLibrary().getWaitingLi...
164c77b4-62be-4cfc-9609-2ac96f79401a
0
public int getY(){ return y; }
f4d00658-4822-41f6-b217-bb01847c1156
5
void setSpeed(int speed) { switch (speed) { case -2: factor = 0; break; case -1: factor = 0.5; break; case 0: factor = 1.2; break; case 1: factor = 2.5; break; case 2: ...
e7d0c901-621e-4319-9e20-b0af35c2d9f4
2
private void initCostsByCoordinates() { for(int i = 0;i<coordinates.length;i++){ for(int j = 0;j<coordinates.length;j++){ costs[i][j] = calculateTravelCostsBetweenCities(i,j); } } }
35a066ee-5f64-47c8-8ed7-8f03febce0e8
6
public void breadthFirstTraversal(){ LinkedQueueClass<Integer> queue = new LinkedQueueClass<Integer>(); boolean[] visited; visited = new boolean[gSize]; for (int ind = 0; ind < gSize; ind++) visited[ind] = false; //initialize the array ...
0e9bc5e9-ad99-4309-97ee-7c064fa28073
7
protected void inCloseTag(final char c) { switch(c) { case ' ': case '\t': case '\r': case '\n': changedTagState(State.AFTERCLOSETAG); return; case '<': changeTagState(State.BEFORETAG); return; case '>': changeTagState(State.START); closePiece(bufDex-1); return; case '/': changedTagState(Sta...
14d33aea-da2a-4d9f-ac4a-469a93d2300d
0
public PanelOptions getPanelSettings() { return pnlSettings; }
7148ad9f-6140-4559-92f6-2a57e5db5a41
4
public static void shiftSubArray(int[] arr, int from, int to, int offset){ int iters=0; if(from>to){ iters=((arr.length-from)+to); } else { iters=(to-from)+1; } if(offset>0){ for(int i=0;i<iters;i++){ arr[Help.mod2(to+offset, arr.length)]=arr[to]; to = circleDecrement(to, arr.length); } ...
2a6d4606-4e22-47a1-babf-4c9f572638dd
2
public static void main(String[] args) { PriorityQueue<Integer> priorityQueue = new PriorityQueue<Integer>(); Random rand = new Random(47); for (int i = 0; i < 10; i++) priorityQueue.offer(rand.nextInt(i + 10)); QueueDemo.printQ(priorityQueue); List<Integer> ints = Arrays.asList(25, 22, 20, 18, 14, 9, 3, ...
0c47ebbd-3fb5-43df-a80e-57c149190811
8
public static void initialiser_phase2(Vector<Vector<String>> data) { data.set(data.size()-1, z_initial); z_type_courant = z_type; System.out.println("Probleme de base : "+z_type_courant); for(int i=1;i<data.size()-1;i++) { for(int j=1;j<data.lastElement().size(...
edc68665-6b66-4f9e-8ed8-92798ad6ce16
9
public final void incremental(double value,int type){ double y=0.,yl=0.,yr=0.; switch(type){ case 1: nl += 1; nr -= 1; sl += value; sr -= value; s2l += value*value; s2r -= value*value; break; case -1: nl -= 1; nr += 1; sl -= value; sr +...
6cd20814-c47f-4c0d-a505-cb84e037fbca
4
public long skip(long n) throws IOException { long totalSkipped = 0; long skipped; // loop until bytes are really skipped. while (totalSkipped < n) { skipped = in.skip(n-totalSkipped); if (totalSkipped ==-1) throw new IOException("skip not supported"); else if(skipped =...
6a2ab81d-eae5-4c8e-ae9d-38ea78c701b9
0
public double normalAttack() { return weaponSlot.increaseDamage((double)hero.fight()); }
23707061-7b10-4f35-a1db-1801a8ddac93
6
public void bingoClientGui() { JFrame f = new JFrame("Bingo Law"); f.getContentPane().add(this); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setVisible(true); Dimension tela = Toolkit.getDefaultToolkit().getScreenSize(); setSize(tela.width, tela.height); botoes = new ArrayLi...
c024e252-c67d-4cec-91c6-891dc5fecf0f
2
public boolean Exist(String Stu_ID, String PassCode) { try { StringBuffer sql = new StringBuffer(); sql.append(" select * from student where"); sql.append(" stu_ID='"); sql.append(Stu_ID); sql.append("' && stu_Passcode='"); sql.append(PassC...
47023992-da7f-4d59-887c-39ea8d6281d0
7
private void ParseTable() throws IOException{ List<String> symbols = new ArrayList<String>(); List<Integer> synchronizationSymbols = new ArrayList<Integer>(); // Symbols BufferedReader br = new BufferedReader(new FileReader("src/hr/unizg/fer/labComplete/symbols.txt")); String line; while ((li...
4c45b70c-9dba-4559-8c25-d57a3991aece
8
protected Map<String,String> getProperties(final Object obj) { HashMap<String,String> map = new HashMap<String,String>(); map.putAll(getMapProperties(obj)); try { BeanInfo info = Introspector.getBeanInfo(obj.getClass()); PropertyDescriptor[] pds = info.getPropertyDescriptors(); if(pds!=null) { ...
af3c14fa-877c-44d3-a664-0f3f732a7220
4
public ShortcutableComponent(Component comp){ comp.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { if(shortcutRepeated){ return; ...
bdb28612-9c7f-44b4-a860-8e2dab0d01ec
5
protected IToken doEvaluate(ICharacterScanner scanner, boolean resume) { System.out.println("[doEvaluate]"); //System.out.println("[scanner]"+(char)scanner.read()); //System.out.println("[Column]"+scanner.getColumn()); if (resume) { if (endSequenceDetected(scanner)) return fToken; } else { int c=...
ef90090b-0640-4c1d-908b-ca314614fd37
1
private void start() { thePlayer.currentLocation = location.MainMenu; //The main menu is actually a special location while(running == false) { System.out.println("--- P A R A S I T E ---\n- New Game\n- Help\n- Quit Game"); input.waitForCommand(); //wait for command r...
cef642f3-bc7f-482e-a129-6fb7a52d4af1
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
f1fb4065-ab8b-4a85-80fb-3efff29b524d
1
public static void main(String[] args) { int larger, smaller; /*InputStreamReader isr = null; BufferedReader br = null; isr = new InputStreamReader(System.in); br = new BufferedReader(isr); */ String str ="1,2,3"; String[] s = str.split(","); List<Integer> list = new Ar...
6e11398c-6f6b-42e7-ae57-74bff2b6ea0b
2
@Override public void onCombatTick(int x, int y, Game game) { SinglePlayerGame spg = (SinglePlayerGame) game; List<Entity> zombies = filterByID(spg .getSquareNeighbors(x, y, 1), zombie.id); for (Entity entity : zombies) { if (((MortalEntity) entity).damage(3)) { ...
b66e909f-4efa-49c0-9cf9-be9f1eb4952a
5
public DoublyLinkedListNode<T> deleteNode(int index) { // Check for out of bounds insertion. if (index > size) { return null; } DoublyLinkedListNode<T> deleteNode = null; DoublyLinkedListNode<T> newNextNode = null; // Find the node before the node we want to delete. DoublyLinkedL...
dd85724c-4f52-46aa-8998-0ba7f4be4eaf
4
public boolean isInsideBoard(Position pos){ boolean inside = false; if (pos.getX()<this.getSize().getWidth() && pos.getX()>=0 && pos.getY()<this.getSize().getHeight() && pos.getY()>=0) inside=true; return inside; }
23ed61a1-e3f4-453b-913d-1b3228e01c4f
2
public MNSASpi(Object param) { try { Connection c = USBConnectionFactory.getConnection(); if(c == null){ throw new IOException("No CardReader found."); } this.terminals = new MNSACardTerminals(c); } catch (PortInUseException | UnsupportedCommOperationException | IOException e) { throw new Runtime...
a2dab896-88bc-4ac5-9b9f-a2a478d5e90e
2
public void dumpExpression(TabbedPrintWriter writer) throws java.io.IOException { if (!subExpressions[0].getType().isOfType(Type.tString) && !subExpressions[1].getType().isOfType(Type.tString)) { writer.print("\"\""); writer.breakOp(); writer.print(getOperatorString()); } subExpressions[0].dumpE...
e332ac14-d064-4d89-b8d9-472550699f37
9
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int cases = parseInt(in.readLine()); for (int casos = 0; casos < cases; casos++) { int n = parseInt(in.readLine().split(" ")[2]); mat...
f3c81581-97da-40e7-86df-dabda9ca5c22
5
private void parseBaseLevel(Node node) throws TemplateException { if (node.getNodeName().equals("dc:title")) { template.setTitle(node.getTextContent()); template.getDcAttributes().add(new DCAttribute("dcterms.title", node.getTextContent())); } else if (node.getNodeName().substring(0, 3).equals("dc:")) { St...
b96ca263-d3a0-4dab-8518-ee704598e93b
3
public void visitForceChildren(final TreeVisitor visitor) { if (visitor.reverse()) { target.visit(visitor); } final Iterator e = operands().iterator(); while (e.hasNext()) { final Expr operand = (Expr) e.next(); operand.visit(visitor); } if (!visitor.reverse()) { target.visit(visitor); } }
907b5951-e6a8-4113-9d6d-9aecda77dc5a
5
public int calculateState(int n) { if (dp[n] != 0) return dp[n]; for (int i = 2; i < n; i++) { if (n % i == 0) { if (calculateState(n - i) == -1) { dp[n] = 1; break; } } } if (dp[n] == 0) dp[n] = -1; return dp[n]; }
ab4e3d90-fe63-4acf-9222-a1c3e79cd2cd
1
public void sendObjectToServer (String outType, Object outObj) { try { createSocketAndSend(outType, outObj); } catch (Exception e) { System.out.println("Something went wrong trying to send the object..."); } }
cd0c5c07-1355-4f92-aaf8-7ec0f0c91c75
3
public double coutAttaque(Peuple attaquant) { double cout = this.nbUnite; Iterator<Element> it = this.elements.iterator(); while (it.hasNext()) { cout += it.next().bonusDefense(attaquant); } if (this.occupant != null) { cout += this.occupant.bonusDefense(this, attaquant); } return cout <...
ba8a4fb4-543e-46c5-93b1-fab889ce6177
8
public static String[] buildRicListFromFile(String ricFileName, int maxCount) { RandomAccessFile dataFile = null; try { int i = 0; dataFile = new RandomAccessFile(ricFileName, "r"); String line = dataFile.readLine(); ArrayList<String> itemList ...
d3620a27-33c9-414e-b41a-7c7793ceaf2c
7
public T remove(long seqno) { lock.lock(); try { if(seqno < low || seqno > high) return null; int index=index(seqno); T retval=buffer[index]; if(retval != null && removes_till_compaction > 0) num_removes++; buffe...
cc9e1feb-1284-46a4-a256-8c2da21c8669
0
public EventObject getEvent() { return event; }
4269fedb-43b9-4733-a9f6-7aa4b3107518
7
@Override public int castingQuality(MOB mob, Physical target) { if(mob!=null) { final Room R=mob.location(); if((R!=null)&&(!R.getArea().getClimateObj().canSeeTheMoon(R,null))) { if((R.getArea().getTimeObj().getTODCode()!=TimeClock.TimeOfDay.DAWN) &&(R.getArea().getTimeObj().getTODCode()!=TimeClo...
ddc10998-7fdb-4477-b560-ce8ec9c90a39
2
public Person GetPerson() { //first person in line Person tmp = null; if(Count() != 0) { //pickup priority person tmp = busStop.poll(); if(Count() == 0) { //reset priority priority = 0; ...
f52dcf79-b100-45c2-8273-9c3f20c1b94c
6
public void run() { if (DEBUG) log("Attempting to run TaskRemoval"); ArrayList<Task> tasks = TaskCommander.getTasks(); if (DEBUG) log("Remove the task contained in this command from the existing tasks list"); tasks.remove(task); if (taskViewsToUpdate != null) { if (DEBUG) log("Remove tas...
fa8525ce-96b9-4a28-9eb9-bcbbdba81835
0
private void anothing() { System.out.println("功能C"); }