method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8ea3f486-462d-4c2e-90d2-b3467cb45563
4
@SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.NORMAL) public void mossify(final PlayerInteractEvent evt) { if (evt.getPlayer() != null) { if (evt.getAction() == Action.RIGHT_CLICK_BLOCK) { if (evt.getClickedBlock().getType().equals(Material.COBBLESTONE)) { log("item in hand: " ...
f0f7c93c-b42e-47bf-b108-bdb8d0e441f4
9
private void availablePackagesListSelectionChanged() { int sel[] = getAvailablePackagesList().getSelectedIndices(); boolean useShortName = false; availableRobots.clear(); if (sel.length == 1) { useShortName = true; getAvailablePackagesList().scrollRectToVisible(getAvailablePackagesList().getCellBounds(s...
880c0bb8-648b-41c3-bb04-2fd86d397e6b
7
public static void hidePlayerWhereAppropriate(Player client, boolean newPlayer) { for (Player user : Bukkit.getOnlinePlayers()) { if (HyperPVP.getSpectators().containsKey(user.getName()) && HyperPVP.getGameSessions().containsKey(client.getName())) { client.hidePlayer(user); user.showPlayer(client); } ...
8d2d5424-e46e-4654-b29c-713f3ab947f0
1
private static void dehoist(OutlinerDocument doc) { try { TextKeyListener.dehoist(doc.tree.getEditingNode()); } catch (Exception e) { System.out.println("Exception: " + e); } }
8b44058c-f17d-47cc-9a32-41070c0a1c8d
3
public void actualizaTabla() { System.out.println("insertando :" + getRowCount()); this.setRowCount(0); for (Ticket tic : tickets) { String fec_sal = ""; try { fec_sal = tic.getSegmentos().get(0).getFechaSalida(); } catch (Exception e) { ...
c74f8331-9f06-4a31-80c8-9ae8a7c64d2c
6
public static List<Message> processMessage(String input) throws QueueNotFoundException{ System.out.println("************************************"); System.out.println("Client received : "+input); Message msg = null; String topic = null; try { msg = new Message(input); topic = msg.topic(); } catch (JSO...
39089530-f41a-4f98-9735-4470e16d05ab
2
private RegularExpresionNode Symbol() throws ParserException { if (Character.isLetterOrDigit(currentSymbol)) { SymbolNode sNode = new SymbolNode(); sNode.Value = currentSymbol; RegularExpresionNode symbolNode = sNode; currentSymbol = getNextSymbol(); ...
d77d0a6b-63a4-4176-a2be-a3874e5d53bb
6
public ArrayList<Col> load(String databaseName, String table) { DTDValidator ob = new DTDValidator(); if (ob.validate(databaseName + "_" + table) == false) { System.out.println("table format not correct"); return null; } else { try { File fXmlFile = new File(path + "/" + databaseName + "_" ...
08b4925a-e529-4d61-b233-88351445afc5
4
public static void main(String[] args){ Scanner in = new Scanner(System.in); String line = in.nextLine(); HashSet<Character> seen = new HashSet<Character>(); for(char c : line.toCharArray()){ if(c>='a' && c<='z' && !seen.contains(c)){ seen.add(c); } } System.out.println(seen.size()); ...
0cfec7db-83d7-4271-b003-48ae0a941223
1
private Map getAllMultiInterfaces(MultiType type) { Map map = new HashMap(); Iterator iter = type.interfaces.values().iterator(); while (iter.hasNext()) { CtClass intf = (CtClass)iter.next(); map.put(intf.getName(), intf); getAllInterfaces(intf, map); ...
b5459167-a250-4807-a927-86c2416b2106
8
public void suddenChange(State newState){ deltaTime = 0; state = newState; switch (state) { case KKMMM: US.setLamps(true, true, false); Barat.setLamps(true, false, false); Timur.setLamps(true, false, false); TU.setLamp(true); stateTime = Main.time[0]; break; case HHMMM: US.setLamps(false,...
3b7506c1-be2f-4e70-bf10-2aa123cbdc15
0
public void setjLabelNumeroRapport(JLabel jLabelNumeroRapport) { this.jLabelNumeroRapport = jLabelNumeroRapport; }
6ca4465f-444c-4db7-8b38-2fb1ebe77860
2
private void addButtonHandlers() { connectButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //todo :Work on if else if (serverNameText.getText().equals("")) { status.setText("Invalid ...
633a2e44-3af9-4a5e-a435-f35fe39f7482
0
public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("[SaleitemsVo:"); buffer.append(" id: "); buffer.append(id); buffer.append(" saleid: "); buffer.append(saleid); buffer.append(" itemcode: "); buffer.append(itemcode); ...
5300732f-c73c-43e7-9a04-e626d2ada06b
1
public void load(String mp3URL) { this.mp3URL=mp3URL; URL url= this.getClass().getResource(mp3URL); try { in= AudioSystem.getAudioInputStream(url); } catch (UnsupportedAudioFileException | IOException e) { e.printStackTrace(); } din = null; AudioFormat baseFormat = in.getFormat(); de...
a90c55e8-c6e0-4493-82e6-94cad240513d
5
public static boolean containsCardPlayableOn(ArrayList<Card> cards, Card dest) { for (Card card : cards) { if (dest == null || card.value == Card.EIGHT || card.value == dest.value || card.suite == dest.suite) { return true; } } return false; }
20ac7ba5-bb98-460b-9e0f-1b072029ef7e
2
private ArrayList<Card> returnThreeSetup() { ArrayList<Card> setup = new ArrayList<>(); if (compareCardFigures(0, 2)) { setup.add(cards.get(0)); setup.add(cards.get(1)); setup.add(cards.get(2)); } else if (compareCardFigures(1, 3)) ...
06d302df-d3f4-4044-b6e4-453638ebc552
3
public ScalarMultiplicationDialog(final Panel panel) { setBounds(1, 1, 270, 190); Toolkit toolkit = getToolkit(); Dimension size = toolkit.getScreenSize(); setLocation(size.width / 3 - getWidth() / 3, size.height / 3 - getHeight() / 3); this.setResizable(false); setLayout(null); JPanel pan = new JPan...
6282dea3-03fb-477c-ad79-3b142424055a
8
public static void main(String[] args) { // TODO Auto-generated method stub cri_dao = DaoFactory.getInstance().getCriteriaDAO(); while (true) { System.out .print("Add Criteria(ac) / Find Criteria(f) / Remove Criteria(rc) / Find All Criteria(fa) / clearDB(clear) : "); String mode = sc.nextLine(); if...
84ba82a3-4117-41e0-b51d-14db3f3d5903
4
public void updateMyImage(){ if(Playtable.myRank == 0){ lbUniqueImage.setIcon(new ImageIcon(getClass().getResource("/dalmuti/image/grDalmuti.jpg"))); lbUniqueImage.setText("<html><div style=\"text-align: center;\">" + Client.mo.users.get(Playtable.myRank).getNickname() + "<br>" + " du bist der " + "<br />" + ra...
d04172d3-f777-4721-a43c-a353c142efba
3
private static void visitFrameTypes(final int n, final Object[] types, final List result) { for (int i = 0; i < n; ++i) { Object type = types[i]; result.add(type); if (type == Opcodes.LONG || type == Opcodes.DOUBLE) { result.add(Opcodes.TOP); } } }
355960ab-b76c-404a-b190-3cae60b6620d
9
public void leesOpdrachtenVanBestand(OpdrachtCatalogus opdrachtCatalogus) { File file = new File("bestanden/opdrachten"); if (file.exists()) { try { Scanner scanner = new Scanner(file); while (scanner.hasNext()) { String lijn = scanner.nextLine(); String[] velden = lijn.split(","); int id ...
371a10b5-6cf3-4365-9f29-d685dee55b58
1
public static final void visit(String url) { if (Config.getDebug()) Output.printTabLn("besuche: " + url, 2); getString(url); Control.sleep(5); }
55dfa154-3099-4777-8ecb-534a3f4f6447
3
private static void viewAFacMember(String lName, String gender) { boolean gend = false; if(gender.equals("m")) gend = true; else if(gender.equals("f")) gend = false; int index = getIndexOfFac(lName, gend); String allInfo = new String(); if(index >= 0) { Teacher t ...
5b0e0bc8-0b49-4d9f-93b7-fb83fc5dbf07
5
public static void main(String[] args) { //TODO: Move command components to separate methods. if (args.length == 1) switch (args[0]) { /***************/ case "start": doLog = false; start(); break; ...
79572bae-b544-44e4-a2a1-c2b1bd66a4b1
7
@Test public void multiThreadedTest() throws InterruptedException { final AtomicBoolean failed = new AtomicBoolean(false); final AvgTimeCounter c = new AvgTimeCounter(); final AtomicLong index = new AtomicLong(0); final long startTime = System.currentTimeMillis(); ArrayList<Thread> threads = new ArrayList<T...
783b9b7f-6f97-4139-94c6-8ba4875081c7
2
private boolean setupEconomy() { if (getServer().getPluginManager().getPlugin("Vault") == null) { return false; } RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class); if (rsp == null) { return false; } econ = rsp.getProvider(); return econ != null...
5de2c85d-b774-4161-a28b-5a3286aba39b
1
public static final int StateUpdateMatch(int index) { return index < 7 ? 7 : 10; }
282035d0-5d02-4389-994b-3fc0059db119
6
private void inviteToParty() { if(mFriends.isEmpty()){ for (Person iPerson : ContactList.sPersonList){ mFriends.add(iPerson); } print("There are "+ContactList.sPersonList.size()+" people in the city"); print("Created "+mFriends.size()+" friends for party host"); } print("First RSVP is sent out"); ...
14878e92-742c-4cb3-96de-fd207bc711b0
3
public void drawTo(PPMEC PPM) { // Must scale x,y to final PPM dimensions // get x-coord int c = (int) (xRatio * PPM.getWidth()); // get y-coord int r = (int) (yRatio * PPM.getHeight()); int radius = (int) (radiusP * PPM.getWidth()); // Radius of R. // Scan through the pixels and try to see if any pixel i...
e8146851-e2f6-4108-9fa3-cd6529959114
8
public void checkReleased(GridUnit gu) { gu.isPressed = false; if (!gu.isFlagged) { if (gu.isMined && !_extralife && !gu.isChecked) { //subtractScore(_scoreBonus); exposeMines(gu); endGame(0); } else { if (_extralife...
5cf8dc74-e9f7-426b-9333-82856ccba57b
0
public Chunk(int xPos,int zPos ){ this.xPos = xPos; this.zPos = zPos; this.parent = parent; }
3a8dfa83-94d5-4bbc-9d63-a184c3fe3162
1
public static void clearDrugPage(DrugInventoryPage drugP){ for(int i=0;i<2;i++){ drugP.getTable().setValueAt("Drug Name",0,0); drugP.getTable().setValueAt("Quantity",0,1); drugP.getTable().setValueAt("Controlled Flag",0,2); drugP.getTable().setValueAt("Price",0,3); drugP.getTable().setValueAt("",1,0); ...
ec2b472a-3317-40e7-b86c-8d0b1afa5964
3
public JSONObject accumulate(String key, Object value) throws JSONException { testValidity(value); Object o = opt(key); if (o == null) { put(key, value instanceof JSONArray ? new JSONArray().put(value) : value); } else if (o...
f181ad89-9ece-40af-ba9d-2d193f1ef614
8
public StringBuffer startTable(StringBuffer org, MutableAttributeSet attrSet) { originalBuffer = org; ret = new StringBuffer(); tblno = tblcnt++; tc = "" + (char) ('a' + (tblno / (26 * 26))) + (char) ((tblno / 26) + 'a') + (char) ((tblno % 26) + 'a'); String val = (String) attrSet.getAttribute(HTML.Attr...
53532848-9671-42ec-94b5-3f83e234b463
5
public void setTile(int x, int y, int id) { if(x >= width || x < 0 || y >= height || y < 0) return; int oldID = this.map[x][y]; this.map[x][y] = id; if(oldID != id) updateNeighbours(x, y, TileUpdateType.tileChange); }
1f6e586f-0f1a-44ed-a58a-f05aa36c9050
2
public Pareto(double k, double lambda) throws ParameterException { if (k <= 0 || lambda <= 0) { throw new ParameterException("Pareto parameters k > 0, lambda > 0."); } else { this.k = k; this.lambda = lambda; exp = new Exponential(lambda); } }
d54b142a-22df-4fac-99c7-79607b6ee23e
1
private void tbProjetosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbProjetosMouseClicked this.btnExcluir.setEnabled(true); this.btnSalvarAlteracao.setEnabled(true); try { preencher(); } catch (Exception ex) { } }//GEN-LAST:event_tbProjetosM...
f4a111bd-2502-4273-b031-9457fec80f2c
7
public void placeBet(Player p) { Scanner in = new Scanner(System.in); System.out.println("\n Please enter amount of bet for this hand!!"); while (!in.hasNextInt()) { System.out .println("\n Invalid $ amount, please bet atleast 1 chip"); in.next(); } Integer playerBet = in.nextInt(); while (((play...
7720203a-3892-43e2-8eab-e21c5eb49a43
3
public void addId(String id) throws Exception { if (null == Id) { Id = new ArrayList<String>(); } else if (999 == notid.size()) { throw new Exception("Too many Ids. 1000 max."); } if (!Id.contains(id)) { Id.add(id); } }
c40f06ac-e463-4564-a435-01a3c78bc1ed
4
public static void save(String filename) { File file = new File(filename); String suffix = filename.substring(filename.lastIndexOf('.') + 1); // png files if (suffix.toLowerCase().equals("png")) { try { ImageIO.write(onscreenImage, suffix, file); } catch (IOExcep...
850d0954-b2e3-4178-b46b-2d8a96f8df81
3
public void setFullScreen(DisplayMode displayMode) { final JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setUndecorated(true); frame.setIgnoreRepaint(true); frame.setResizable(false); device.setFullScreenWindow(frame); //...
5851a932-3fd6-49b1-8a85-3bb4e4d07b57
0
public int f() { return 1; }
8c8449a5-3c5b-4751-a9e4-c7d81c613d20
8
private String removeBracket(String str) throws Exception { if (!(str.startsWith("(") && str.endsWith(")")))//括弧で始まっていなければ、そのまま返す return str; int nest = 1; for (int i = 1; i < str.length() - 1; i++) { if (str.charAt(i) == '(') nest++; else if (str.charAt(i) == ')') nest--; if (nes...
6f24fa49-151e-41e9-884a-9e3dbf468afe
5
public Converter(){ Collection<Warp> warps = ButtonWarp.getWarps(); for (Warp warp : warps){ // Check if warp contains bwr if (warp.commands.size() != 0){ String cmd = warp.commands.getFirst(); if (cmd.startsWith("bwr") && !cmd.contains("-")){ String args[] = cmd.split("\\s+"); // Try to par...
c98f3461-7f0f-4cf8-8d22-af9e2a53a8f7
2
public ArrayList<AlumnoBean> getPage(int intRegsPerPag, int intPage, ArrayList<FilterBean> alFilter, HashMap<String, String> hmOrder) throws Exception { ArrayList<Integer> arrId; ArrayList<AlumnoBean> arrAlumno = new ArrayList<>(); try { oMysql.conexion(enumTipoConexion); ...
43a6a77e-fd97-4380-8a2a-f8db33db5aa1
7
void smbFft(float[] fftBuffer, int fftFrameSize, int sign) /* FFT routine, (C)1996 S.M.Bernsee. Sign = -1 is FFT, 1 is iFFT (inverse) Fills fftBuffer[0...2*fftFrameSize-1] with the Fourier transform of the time domain data in fftBuffer[0...2*fftFrameSize-1]. The FFT array takes and returns the cosine and sine...
2838d1a0-48ff-4c4e-af7b-ecca51e386cd
7
@EventHandler public void onEntityDamageByEntity(EntityDamageByEntityEvent event) { if (event.getEntity() instanceof Player) { Player player = (Player) event.getEntity(); ItemStack[] armorSlots = player.getInventory().getArmorContents(); for (int i = 0; i < armorSlots.length; i++) { ItemStack ar...
ba3e71d6-afd5-44d5-ae45-64c954d63ad3
6
public void connect(TreeLinkNode root) { if (root == null) return; Queue<TreeLinkNode> nq = new LinkedList<TreeLinkNode>(); Queue<Integer> lq = new LinkedList<Integer>(); nq.add(root); lq.add(0); while (nq.size() > 0) { TreeLinkNode node = nq.poll(); ...
a001a0b6-497e-488e-9661-cef0d7f604b9
6
public void decryptEncryptedHands(final RSAService rsaService, final int numRequests) throws InvalidSubscriptionException, IOException { decryptionCount = 0; decryptSub = elvin.subscribe(NOT_TYPE + " == '" + DECRYPT_HAND_REQUEST + "' && " + GAME_ID + " == '" + gameHost.getID() + "' && " + REQ_USER ...
beaf3a7e-8aa1-4fe1-b6d2-7e2e174f4841
3
public static TreeNode getMRCA(TreeNode curn1, TreeNode curn2) { //get path to root for first node ArrayList<TreeNode> path1 = new ArrayList<TreeNode>(); TreeNode parent = curn1; while (parent != null) { path1.add(parent); parent = parent.getParent(); } //find first match between this node and the fir...
a5d2a390-56d6-4939-beda-da9515568b76
1
public void playGameAsPlayer(ArrayList<User> gameUsers, SearchGamesTask jgt) throws InvalidSubscriptionException, InvalidKeySpecException, NoSuchAlgorithmException, NoSuchPaddingException, NoSuchProviderException, InterruptedException, IOException { RSAService rsaService = comServ.waitPQ(); gameUser.setDe...
83ea8967-0d5a-4a83-b111-5b3363fcf2c7
3
private void exportEnderchest(CompoundTag tag) { List<Tag> list = new ArrayList<Tag>(); for (byte i = 0; i < Enderchest.length; i++) { if (Enderchest[i] == null) continue; Tag t = Tag.fromNBTTag(CraftItemStack.asNMSCopy(Enderchest[i]).save(new NBTTagCompound())); ((CompoundTag) t).getValue()...
af1fc6ce-3a65-4e7b-b8a4-c308f2fa1181
1
@Override public void initializeLanguage() { Array<Letter> lettersAvailable = this.getLanguage().getLettersAvailable(); char[] letterDistribution = new char[] { 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'b', 'b', 'c', 'c', 'd', 'd', 'd', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', ...
e3cfc380-1b81-48a9-9e5c-5ed80d492208
3
private void updateStateAskOrigin(List<Keyword> keywords, List<String> terms) { RecipeLearningState nextState; List<Keyword> countries = keywordsFromType(KeywordType.COUNTRY, keywords); if (countries.size() == 0) { if (terms.size() > 0) { ArrayList<DialogState> states = new ArrayList<DialogState>(); states....
adbe70f6-60a3-424f-a589-92f9f9b14727
0
int popInt() { return ((Integer) pop()).intValue(); }
3358549f-ea35-4101-9415-86bca633effc
2
@Test public void test() { if (!MongoHelper.delete(attachment, "attachments")) { TestHelper.failed("delete failed"); } if (MongoHelper.fetch(attachment, "attachments") != null) { TestHelper.failed("attachment was not deleted"); } System.out.println(...
27ffe2d1-730d-44a2-90ad-e64145167a24
4
@Override public String format(LogRecord record) { StringBuilder sb = new StringBuilder(); sb .append(dateFormat.format(record.getMillis())) .append(" [") .append(record.getLevel()) .append("] "); String msg = record.getMessa...
ab9bd893-f127-4fba-8702-59b7af81098d
4
public MethodInfo findMethod(String name, String typeSig) { if ((status & METHODS) == 0) loadInfo(METHODS); for (int i = 0; i < methods.length; i++) if (methods[i].getName().equals(name) && methods[i].getType().equals(typeSig)) return methods[i]; return null; }
d5f42d87-0c34-4734-bfcc-3c710a9f51ce
3
@Override public byte[] getFileContent(String filename) { File file = new File("."+filename); if(!file.exists()){ return new byte[0]; }else{ try { InputStream fis = new FileInputStream(file); byte[] content = new byte[(int) file.length()]; fis.read(content); fis.close(); return content;...
f4ceaafe-fd28-42c0-80dd-b283913ee805
9
public TableControlsModel(Control c){ _data = new String[9][2]; _data[0][0] = "RegDst"; _data[0][1] = c.isRegDst() ? "1" : "0"; _data[1][0] = "Branch"; _data[1][1] = c.isBranch() ? "1" : "0"; _data[2][0] = "MemRead"; _data[2][1] = c.isMemRead() ? "1" : "0"; _data[3][0] = "MemToReg"; _data[3][...
57dbb7af-af48-479c-a028-7f107e786df6
2
public int GetUserID(String email) throws Exception { String s = "-8"; int id = -2; try { // This will load the MySQL driver, each DB has its own driver Class.forName("com.mysql.jdbc.Driver"); // Setup the connection with the DB _connect = DriverManager.getConnection(_url, _user, _password); // Pre...
5c68d979-36e6-4c8c-9e8f-9dd5267f300f
4
public Model getModel() { Model model = (Model) modelCache.get(id); if (model != null) return model; model = Model.getModel(modelId); if (model == null) return null; for (int colour = 0; colour < 6; colour++) if (originalModelColours[0] != 0) model.recolour(originalModelColours[colour], mod...
ca197ef6-1bc8-4e12-aff5-72adbdd2aa08
7
public Command[] getAgentCommands() { ArrayList<Agent> agents = level.agents; int agentsSize = level.agents.size(); // make sure every agent has a command planned for (int i=0; i<agentsSize; i++) { planForAgent(agents.get(i)); } if(agents.size() > 1){ for(TaskDispenser td : taskDispensers)...
79da18fe-4e37-4902-98c3-45530bf71ed4
7
public void resize(int w, int h, boolean f) throws Exception { for (DisplayMode d : Display.getAvailableDisplayModes()) { if (d.getWidth() == w && d.getHeight() == h) { if (f && !d.isFullscreenCapable()) { continue; } Display.setDis...
4f02d180-1535-42ad-9e29-c1dcf656c64d
6
public void printDT() { System.out.println(); System.out.println(" via"); System.out.println(" D2 | 0 1 3"); System.out.println("----+------------"); for (int i = 0; i < NetworkSimulator.NUMENTITIES; i++) { if (i == 2) { ...
0abbfe2a-6c9e-41cd-b699-db93c08e7796
1
public void mousePressed(MouseEvent e){ if (e.isPopupTrigger()) doPop(e); }
49dfa563-86ab-4b46-ac26-6d2235104d82
7
protected int backfillGridlets() { int gridletStarted = 0; // checks the pivot first if(pivot != null && pivot.getStartTime() <= GridSim.clock()) { gridletStarted++; waitingJobs.remove(pivot); // pivots should be at the beginning anyway runningJobs.add(pivot); piv...
6fe110b9-aa2d-4fcd-98b8-3e34a6cb913c
9
private synchronized void fillUpHPOTerms(){ if(HPOTerms.size()==0) { File file = new File(hpoFilePath); Scanner scanner = null; try { scanner = new Scanner(file); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } Pattern p = Pattern.compile("...
22828151-0a60-4534-a379-5436800444e4
7
public Expr AddExpr() throws ParseException { Token tok; Expr e, er; e = MulExpr(); label_11: while (true) { switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) { case 146: case 147: break; default: ...
a77bd287-f1a4-4bdc-ac9f-9a510b97ef9c
8
@SuppressWarnings("deprecation") @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(!(sender instanceof Player)) { sender.sendMessage(plugin.prefix + "You have to be a player to use this command"); return true; } Player player = (Player)sen...
970a50f5-32b8-4a86-bd8e-7c3164f34814
7
private String getPostData(final Map<String, Object> map) throws UnsupportedEncodingException { StringBuffer buff = new StringBuffer(); Iterator<String> it = map.keySet().iterator(); while (it.hasNext()) { String keyName = it.next(); Object obj = map.get(keyName); ...
f300e2f3-a3ff-452d-bcc2-d27b19669b98
7
public void execute() { int i; if (pins[0].value && !lastClock) { for (i = 0; i != bits; i++) { if (pins[i + 2].value) { break; } } if (i < bits) { pins[i++ + 2].value = false; } ...
0d5f5ca5-5c84-43bb-927d-259dea406663
3
public File[] saveAs(Saveable saveable) { if (saveable == null) { return new File[0]; } String path = saveable.getPreferredSavePath(); File result = StdFileDialog.choose(saveable instanceof Component ? (Component) saveable : null, false, (String) getValue(NAME), PathUtils.getParent(path), PathUtils.getLeafNa...
5887a3d1-298d-43e1-8935-44311c004a9f
3
public void tick() { if (fps == -1) return; timer++; if (timer > 60 / fps) { currentFrame++; timer = 0; } if (currentFrame >= sprites.length) currentFrame = 0; }
c88f6f10-2bc0-40df-99e2-d58886d72e6a
5
public static void main(String[] args) { try{ System.out.println("Start time ms:" +System.currentTimeMillis()); if(args.length>=1){ min_support = Integer.parseInt(args[0]); System.out.println("Using Min Support of "+min_support); } Vector<String> candidates = new Vector<String>(); MongoClie...
7323ba2f-e176-4a46-8ccc-cb9b85915966
3
private void rescale(int capacityIndex) { Array<Array<KeyValueHolder<K, V>>> oldBuckets = buckets; // Change the hash capacity buckets = new Array<Array<KeyValueHolder<K, V>>>(primes[capacityIndex]); KeyValueHolder<K, V> holder; // See the old buckets for (int i = 0; ...
86ce9ec3-7c61-429c-a484-54ddd9cf5f25
3
public static void triangle3(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(); for (int j = 0; j < c.length; j++) { if (i < j) { System.out.print(" "); } else { System.out.print(c[j]); } } } }
3cb3453d-34a2-44bc-bf1b-1a4053140911
5
public String callCommandGetField(PreparedStatement _sqlCommand, Connection _con) { //Benchmark time start ThreadMXBean threadmxbean = ManagementFactory.getThreadMXBean(); long startTime; long finishTime; if (_enableSqlMonitor) startTime = threadmxbean.getCurren...
39634173-3c55-4334-8cfc-f5a06846c677
3
public TestInfo updateTestSettings(String userKey, TestInfo testInfo) { EnginesParameters enginesParameters = EnginesParameters.getEnginesParameters(this.users, testInfo.getNumberOfUsers()); Overrides overrides = testInfo.getOverrides(); // int engines = enginesParameters.getConsoles() + enginesP...
73d6c7b4-fc5f-4727-9133-a1dc4e7289cc
1
public static void main(String[] args) { int x = 0; System.out.println((x != 0) && ((10 / x) > 1)); //false }
9e69c53c-2f6f-459c-88ef-ee914f2f1909
1
public void update() { if (execute_command) { execute_command = false; movePlayer(Command.commandToDir(currentCommand)); } }
5d683d11-6a2e-4169-a326-efa3d9a87da8
2
public static void printArray(int array_len,int[] array) { for (int i = 0; i < array_len; i++) { if (i % 100 == 0) System.out.println(); System.out.print(array[i] + " "); } System.out.println(); }
7f972fed-a3c3-491e-afde-519da3c0befc
2
@Override public int hashCode() { int result; long temp; result = saleId; result = 31 * result + itemId; result = 31 * result + quantityPurchased; result = 31 * result + (itemCostPrice != null ? itemCostPrice.hashCode() : 0); temp = itemUnitPrice != +0.0d ? Do...
a70742f7-d5dd-40e4-b23a-360da7218a23
1
private void captureAudio() { try { // Get everything set up for // capture audioFormat = getAudioFormat(); DataLine.Info dataLineInfo = new DataLine.Info( TargetDataLine.class, audioFormat); targetDataLine = (TargetDataLine) AudioSystem.getLine(dataLineInfo); targetDataLine.open(audioFormat); ...
1e38e312-3d9c-44d6-a6ef-c8680daa2c71
2
private void print_array(int[] a) { if ( 0 == a.length ) return ; System.out.print("["); System.out.print(a[0]); for (int i=1; i<a.length; i++) System.out.print(", " + a[i]); System.out.println("]"); }
ae51d85d-0b29-4ea9-b158-0a06ecd58dc6
2
public void serializza() { try{ JoinList file = new JoinList(); File f = new File("plugins/" + name + "/giocatori.dat"); if(!f.exists()) { f.createNewFile(); System.out.println("File creato"); } FileOutputStream fout = new FileOutputStream("plugins/" + name + "/giocatori.dat"); ...
95adc14c-a40c-4ce0-8416-dc7529724518
7
private void gererCollision(ControlleurObjets controlleur) { for (int i = 0; i < controlleur.objets.size(); i++) { ObjetJeu temp = controlleur.objets.get(i); if (temp.getId() == IdObjet.TirNormal) { if (contact().intersects(temp.contact())) { ...
75ca28f4-4d88-4b1e-b2dd-0b9dda46f72c
7
public void paintComponent(Graphics g){ super.paintComponent(g); // paints background // OK, paint it ourselves // we need the font... if(fontModel == null){ return; } if(offImg == null){ offImg = createImage(initialWid, initialHgt); ...
75550680-872c-4d63-be5f-a8381192ed58
3
protected void fireServerStopEvent(ServerStopEvent evt) { if (serverStopListenerList != null) { Object[] listeners = serverStopListenerList.getListenerList(); for (int i=0; i<listeners.length; i+=2) { if (listeners[i]==ServerStopListener.class) { ((ServerStopListener)listeners[i+1]).On...
d4de580b-a1a6-4bc6-a75d-fe5d67eeaed8
0
private void addActionListeners() { button.addActionListener(e -> { close(); firePropertyChange(DialogWindowController.CANCEL, 0, 1); }); }
f8053ac0-9b8f-4f5c-b2e8-01c401e21187
6
private void run(){ isRunning = true; int frames = 0; long frameCounter = 0; final double frameTime = 1.0 / frameCap; long lastTime = Time.getTime(); double unprocessedTime = 0; while(isRunning){ boolean render = false; long startTime = Time.getTime(); long passedTime = startT...
138182cf-a3bd-454b-9db1-da22bf4809fc
5
public String getResultExec(String exec) { beforeExecute(this); String result = ""; boolean cekWindowsOSName = System.getProperty("os.name").contains("Windows"); if(cekWindowsOSName) { Process p; BufferedReader input = null; try ...
17212c4e-de5f-494b-bc2c-a1168e079855
3
private static int getAdjustedThreshold(int previousThreshold, Image img, ChannelType c) { int amountOfHigher = 0; int amountOfLower = 0; double sumOfHigher = 0; double sumOfLower = 0; for (int x = 0; x < img.getWidth(); x++) { for (int y = 0; y < img.getHeight(); y++) { double aPixel = img.getPixe...
1ac82bd3-6ef7-4fc0-b795-21d8fa4561bc
9
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if (args.length == 0) { if (player == null) { sender.sendMessage(ChatColor.RED+"This command can o...
3947a9d7-1f45-4504-b3c5-a16a8b32b6a9
5
@Override public void learn(){ nb_neurons = colNumber*rowNumber; int examples = 0; while (examples < epochs && !Options.getOptions().getStopped()) { //We verify the pause checkPause(); //We print the state printState(new Object[]{examples, epochs, Options.getOptions().getElasticity()...
02c5f53a-0d33-4126-996e-5545ab1487d2
5
@Override public float millisecondsPlayed() { // get number of samples played in current buffer float offset = (float)AL10.alGetSourcei( ALSource.get( 0 ), AL11.AL_BYTE_OFFSET ); float bytesPerFrame = 1f; switch( ALformat ) ...
cf62089c-29c9-4b05-8f2a-930b3839ba15
5
public ListNode mergeTwoLists(ListNode l1, ListNode l2) { ListNode head = new ListNode(-1); ListNode p = head; while (l1 != null && l2 != null) { if (l1.val > l2.val) { p.next = l2; l2 = l2.next; } else { p.next = l1; ...
00cbd634-e465-4dd4-ad92-6a9245f5d6fa
7
public static Cons sysTree(Stella_Object tree, StandardObject typespec, Object [] MV_returnarray) { if (Stella_Object.safePrimaryType(tree) == Stella.SGT_STELLA_CONS) { { Cons tree000 = ((Cons)(tree)); { GeneralizedSymbol testValue000 = ((GeneralizedSymbol)(tree000.value)); if (testValue00...
1c74179e-4d0a-4f52-9f6d-14b97f97ebb9
3
@Override public void mouseClicked(MouseEvent e) { if (!pausa && !perdio) { // si el juego no ha empezado avion.setVelY(10); jump.play(); inicio = true; } if (perdio) { loseSound.stop(); restart(); } }