text
stringlengths
14
410k
label
int32
0
9
@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: " ...
4
private void availablePackagesListSelectionChanged() { int sel[] = getAvailablePackagesList().getSelectedIndices(); boolean useShortName = false; availableRobots.clear(); if (sel.length == 1) { useShortName = true; getAvailablePackagesList().scrollRectToVisible(getAvailablePackagesList().getCellBounds(s...
9
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); } ...
7
private static void dehoist(OutlinerDocument doc) { try { TextKeyListener.dehoist(doc.tree.getEditingNode()); } catch (Exception e) { System.out.println("Exception: " + e); } }
1
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) { ...
3
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...
6
private RegularExpresionNode Symbol() throws ParserException { if (Character.isLetterOrDigit(currentSymbol)) { SymbolNode sNode = new SymbolNode(); sNode.Value = currentSymbol; RegularExpresionNode symbolNode = sNode; currentSymbol = getNextSymbol(); ...
2
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 + "_" ...
6
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()); ...
4
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); ...
1
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,...
8
public void setjLabelNumeroRapport(JLabel jLabelNumeroRapport) { this.jLabelNumeroRapport = jLabelNumeroRapport; }
0
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 ...
2
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); ...
0
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...
1
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; }
5
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)) ...
2
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...
3
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...
8
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...
4
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); } } }
3
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 ...
9
public static final void visit(String url) { if (Config.getDebug()) Output.printTabLn("besuche: " + url, 2); getString(url); Control.sleep(5); }
1
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 ...
3
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; ...
5
@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...
7
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...
2
public static final int StateUpdateMatch(int index) { return index < 7 ? 7 : 10; }
1
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"); ...
6
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...
3
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...
8
public Chunk(int xPos,int zPos ){ this.xPos = xPos; this.zPos = zPos; this.parent = parent; }
0
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); ...
1
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...
3
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...
8
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); }
5
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); } }
2
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...
1
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...
7
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); } }
3
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...
4
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); //...
3
public int f() { return 1; }
0
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...
8
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...
5
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); ...
2
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...
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...
7
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(); ...
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 ...
6
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...
3
public void playGameAsPlayer(ArrayList<User> gameUsers, SearchGamesTask jgt) throws InvalidSubscriptionException, InvalidKeySpecException, NoSuchAlgorithmException, NoSuchPaddingException, NoSuchProviderException, InterruptedException, IOException { RSAService rsaService = comServ.waitPQ(); gameUser.setDe...
1
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()...
3
@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', ...
1
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....
3
int popInt() { return ((Integer) pop()).intValue(); }
0
@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(...
2
@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...
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; }
4
@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;...
3
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][...
9
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...
2
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...
4
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)...
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...
7
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) { ...
6
public void mousePressed(MouseEvent e){ if (e.isPopupTrigger()) doPop(e); }
1
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...
7
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("...
9
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: ...
7
@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...
8
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); ...
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; } ...
7
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...
3
public void tick() { if (fps == -1) return; timer++; if (timer > 60 / fps) { currentFrame++; timer = 0; } if (currentFrame >= sprites.length) currentFrame = 0; }
3
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...
5
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; ...
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]); } } } }
3
public String callCommandGetField(PreparedStatement _sqlCommand, Connection _con) { //Benchmark time start ThreadMXBean threadmxbean = ManagementFactory.getThreadMXBean(); long startTime; long finishTime; if (_enableSqlMonitor) startTime = threadmxbean.getCurren...
5
public TestInfo updateTestSettings(String userKey, TestInfo testInfo) { EnginesParameters enginesParameters = EnginesParameters.getEnginesParameters(this.users, testInfo.getNumberOfUsers()); Overrides overrides = testInfo.getOverrides(); // int engines = enginesParameters.getConsoles() + enginesP...
3
public static void main(String[] args) { int x = 0; System.out.println((x != 0) && ((10 / x) > 1)); //false }
1
public void update() { if (execute_command) { execute_command = false; movePlayer(Command.commandToDir(currentCommand)); } }
1
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(); }
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...
2
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); ...
1
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("]"); }
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"); ...
2
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())) { ...
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); ...
7
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...
3
private void addActionListeners() { button.addActionListener(e -> { close(); firePropertyChange(DialogWindowController.CANCEL, 0, 1); }); }
0
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...
6
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 ...
5
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...
3
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...
9
@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()...
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 ) ...
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; ...
5
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...
7
@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(); } }
3