text
stringlengths
14
410k
label
int32
0
9
private Compiler(URLClassLoader parent) { // If not running on JDK, compiler will be null if (compiler == null) { throw new Error("Compiler not available. This may happen if " + "running on JRE instead of JDK. Please use a full JDK 1.6." + "javax.tools.ToolProvider.getSystemJavaCompi...
4
private void createWalls() { for (int i = 140; i <= 200; i += Object.size) { for (int j = 100; j <= 160; j += Object.size) { gameObjects.put(createCoordinateKey(new Coordination(j, i)), new Brick(j, i)); } } for (int i = 140; i...
8
private static boolean checkTile(Level level, int x, int y) { // get the tile at the location Tile t = level.getTile(x >> 3, y >> 3); // trees can't grow on solids or water if (t instanceof BasicSolidTile || t instanceof AnimatedTile) { return false; } // don't place a tree in a building for (Entity...
5
static void dradf2(int ido,int l1,float[] cc, float[] ch, float[] wa1, int index){ int i,k; float ti2,tr2; int t0,t1,t2,t3,t4,t5,t6; t1=0; t0=(t2=l1*ido); t3=ido<<1; for(k=0;k<l1;k++){ ch[t1<<1]=cc[t1]+cc[t2]; ch[(t1<<1)+t3-1]=cc[t1]-cc[t2]; t1+=ido; t2+=ido; } ...
7
@Override public void Consultar() throws SQLException { try { Conexion.GetInstancia().Conectar(); ResultSet rs = Conexion.GetInstancia().EjecutarConsulta(""); while(rs.next()) { // ObProducto.setProductoBodega(null); // ...
2
public Boolean contains(DrawableItem di, Point p) { return di.getShape().contains(p); }
0
private static boolean b4(int i, int j, BufferedImage image) { Boolean right = ((image.getRGB(i+1, j-1) == BLACK) || (image.getRGB(i+1, j ) == BLACK) || (image.getRGB(i+1, j+1) == BLACK)); Boolean with = ((image.getRGB(i-1, j-1) == WHITE) && ...
6
private void thermallyDeexciteAtoms() { if (thermalDeexcitor == null) thermalDeexcitor = new ThermalDeexcitor(this); double sig; for (int i = 0; i < numberOfAtoms - 1; i++) { rxi = atom[i].rx; ryi = atom[i].ry; for (int j = i + 1; j < numberOfAtoms; j++) { if (atom[i].isExcitable() || atom[j].isEx...
9
private Posicion probarPorFila(int filaTerreno, int[][] terreno, int[][] casa, Orientacion orientacion) { // asumo que entra boolean entra = true; // variables auxiliares int anchoTerreno = terreno[0].length; int altoCasa = casa.length; int anchoCasa = casa[0].length; for (int columnaTerreno = 0; colu...
7
@Override public String List_file_url(String id) { String texto_html = ""; try { this.conn = FactoryConnectionDB.open(FactoryConnectionDB.ORACLE); String sql = "select a.NO_FILE,a.NO_ORIGINAL from RHTV_ARCHIVO_DOCUMENTO a , RHTV_DOCUMENTO_ADJUNTO d where d.ID_DOCUMENTO_ADJU...
9
Message receive() { try { return this.logs.remove(0); } catch (Exception e) { return null; } }
1
private void validateTime(String t) { try{ timeInt = Integer.parseInt(t); }catch(NumberFormatException e){ throw new IllegalArgumentException("Input("+ t + ") Time-String must be a valid time 0000-2359"); } if(Integer.parseInt(t.substring(2,4)) >= 60){ throw new IllegalArgumentException("Input("+ t ...
5
public static ModelClassDesc tableParseToMode(TableDesc tableDesc) { ModelClassDesc modelClassDesc = new ModelClassDesc(); modelClassDesc.setClassName(getClassName(tableDesc.getTableName())); modelClassDesc.setFileds(getModelFiledByTableColumn(tableDesc)); return modelClassDesc; }
0
File[] getRoots() { /* * On JDK 1.22 only... */ // return File.listRoots(); /* * On JDK 1.1.7 and beyond... * -- PORTABILITY ISSUES HERE -- */ if (System.getProperty ("os.name").indexOf ("Windows") != -1) { Vector /* of File */<File> list = new Vector<File>(); list.add(new File(DRIVE_A)); ...
7
public static boolean is_array(Object object) { // OK if (object == null) return false; if (object instanceof Map) return true; if (object instanceof LinkedHashMap) return true; if (object instanceof HashMap) return true; if (object instanceof ArrayList) return true; if (object instanceof List) return tru...
6
public void handleRemoveTapeAlphabetButton() { Object alphabet = startView.getTapeAlphabetList().getSelectedValue(); if(startView.getTapeAlphabetList().getSelectedIndex() > 0){ startView.getTapeAlphabetItems().removeElement(alphabet); if(startView.getInputAlphabetItems().contains(alphabet...
3
public void setMaxBill(double maxBill) { if(maxBill < 0) { throw new IllegalArgumentException( "error: bill max must be greater than or equal to zero"); } this.maxBill = maxBill; }
1
public void draw(Graphics g) { View view = this.getView(); int point[] = view.getTilePosition(tower.getTile()); MagicGem gem = tower.getMagicGem(); if (gem!=null) { if (gem.getType().equals("hobbit")) this.setImage("/textures/constructs/tower/tower_hobbit.png"); else if (gem.getType().equals("human")) t...
7
public synchronized void setWindowPosition(int x, int y) { if (this.visible == false) { throw new MinuetoWindowInvalidStateException("Window is invisible"); } if(this.isClosed()) { throw new MinuetoWindowInvalidStateException("Window is closed!"); } if ( x < 0 ) throw new MinuetoOutOfBoundEx...
4
private boolean versionCheck(String title) { if (this.type != UpdateType.NO_VERSION_CHECK) { final String version = this.plugin.getDescription().getVersion(); if (title.split(" v").length == 2) { final String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get the ...
5
@Test public void testMultipleFilters() throws Exception { final Properties[] configs = new Properties[] { new Properties(), new Properties() }; configs[0].setProperty("type", "Zero"); configs[1].setProperty("type", "Wan"); configs[1].setProperty("median_latency", "250"); fin...
0
public Wave22(){ super(); MobBuilder m = super.mobBuilder; for(int i = 0; i < 550; i++){ if(i % 5 == 0) add(m.buildMob(MobID.ODDISH)); else if(i % 4 == 0) add(m.buildMob(MobID.BELLSPROUT)); else if(i % 3 == 0) add(m.buildMob(MobID.MEOWTH)); else if(i % 2 == 0) add(m.buildMob(MobID.MANK...
5
public static boolean isGameSytstemPath(String path) { path = path.trim().toLowerCase(); return path.endsWith(DataConstants.GAME_SYSTEM_FILE_EXTENSION) || path.endsWith(DataConstants.GAME_SYSTEM_COMPRESSED_FILE_EXTENSION) || path.endsWith(DataConstants.GAME_SYSTEM_COMPRES...
2
public void remove(int index) { RangeCheck(index); int numMoved = size - index - 1; if (numMoved > 0) { System.arraycopy(data, index + 1, data, index, numMoved); } data[--size] = null; }
1
@Override public int attack(double agility, double luck) { System.out.println("I tried to do a special attack but I haven't set it so I failed at this turn..."); return 0; }
0
protected void updateDrillYard() { if (drillYard == null || drillYard.destroyed()) { final DrillYard newYard = new DrillYard(this) ; final Tile o = origin() ; final int S = this.size ; for (int n : TileConstants.N_ADJACENT) { n = (n + 2) % 8 ; newYard.setPosition(o.x +...
4
@Override public Handler createHandler(Class<?> type) { if (type == World.class) { return new WorldHandler(); } else if (type == Country.class) { return new CountryHandler(); } else if (type == Continent.class) { return new ContinentHandler(); } else if (type == Neighbour.class) { return new Neighb...
6
@Override public String toString() { return ToStringBuilder.reflectionToString(this,ToStringStyle.MULTI_LINE_STYLE); }
0
public synchronized int available() throws IOException { int avail = super.available(); int unencoded = precount - prepos + in.available(); if (encoder.getEncoder().getVbr()) { switch (mode) { case 0: // Narrowband // ogg header size = 27 + packetsPerOggPage // count ...
8
@Override public Object getValueAt(int row, int col) { Order o = info.get(row); switch (col) { case 0 : return o.getOrderName(); case 1 : return o.printDate(o.getDueDate()); case 2 : return o.getSleeve().getMaterial().getName(); case 3 : r...
8
public void switchLabels() { // Only to switch Labels if necessary if (tabbedPane.getSelectedIndex() == 0) { if (fieldleft.hasFocus() || comboboxleft.hasFocus()) { label_l.setText("Von:"); label_r.setText("In:"); arrow.setVisible(true); arrow_o.setVisible(false); } else { label_r.setText("...
5
public RSA(BigInteger N, int E, BigInteger D, BigInteger P, BigInteger Q, BigInteger DP, BigInteger DQ, BigInteger C) { this.n = N; this.Exponent = E; this.Private = D; this.p = P; this.q = Q; this.dmp1 = DP; this.dmq1 = DQ; this.coeff = C; // adjust a few flags. Encryptable = (n != null && n != Ze...
4
public void visit(final EditorVisitor visitor) { // First visit ourself visitor.visitClassEditor(this); final EditorContext context = this.context(); // Visit each field final FieldInfo[] fields = this.fields(); for (int i = 0; i < fields.length; i++) { final FieldEditor fieldEditor = context.editField...
4
@Override public void learnFromInstance(Instance inst, HoeffdingOptionTree ht) { this.observedClassDistribution.addToValue((int) inst.classValue(), inst.weight()); if (this.listAttributes == null) { this.numAttributes = (int) Math.floor(Math.sqrt(inst....
8
private void drawGrid(Graphics2D g2) { for (int y = 0; y < grid.height; y++) { for (int x = 0; x < grid.width; x++) { g2.setColor(Color.DARK_GRAY); g2.drawRect(x * BLOCK_SIZE, y * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE); } } }
2
public void createReport(File newFile) { PrintWriter writer; try { writer = new PrintWriter(newFile); writer.write("Eagle Creek SiteMap Analyzer Report for: " + getFileName() + "\n"); writer.write(" ,Summary:, Total, Pages, Documents, Media" ...
4
Space getForkSpace(Piece piece) { Space[] oppSpaceArray = getSpacesWithPiece(piece); Space[][] openSetsLast = getOpenSets(lastSpaceMoved); for (Space oppSpace : oppSpaceArray) { if (oppSpace != lastSpaceMoved) { Space[][] openOppSets = getOpenSets(oppSpace); for (Space[] oppSet : openOppSets) { fo...
6
public String display() { String theMessages = "Welcome to the Message Board\n\n"; for(int i = 0; i < messages.size(); i++) { theMessages = theMessages + this.messages.get(i).getMessage(); } return theMessages; }
1
public void addSettings(String date, String background1, String background2, String background3, String logo, String button) { Element settingsModule = doc.createElement("settings"); gameModule.appendChild(settingsModule); Element startdateElement = doc.createElement("startdate"); ...
5
private int nextStake(int i) { int nextStake = lastStakePlusSmax(i); if (leftOvers > 0.0) return leftoversPlusSmax(i); if (nextStake > endStake) return endStake; return nextStake; }
2
public static String getScore(){ rover = head; String blank = ""; while(rover!=null){ if(rover.status == 1){ blank = blank + rover.name + " - " + rover.score + "\n"; } rover = rover.next; } return blank; }
2
@Override public OreLookup lookup(String player, Integer time, List<Integer> restrict) { OreLookup ore = new OreLookup(player); for (String w : plugin.getConfiguration().getWorlds()) { QueryParameters parameters = new QueryParameters(); parameters.addActionType("block-break",MatchRule.INCLUDE); pa...
6
private boolean localPeak(int i, int j, int hw, int hh, int neighbourhood) { int dt, dr; long peak = houghAccumulator[i][j]; for (int k = -neighbourhood; k <= neighbourhood; k++) { for (int l = -neighbourhood; l <= neighbourhood; l++) { if (k == 0 && l == 0) ...
9
public boolean isNonsquareSymmetrical(Matrix m) { MatrixIterator tr_itr = new MatrixIterator(m, TOPRIGHT); MatrixIterator bl_itr = new MatrixIterator(m, BOTTOMLEFT); while(tr_itr.hasNext() && bl_itr.hasNext()) { if(tr_itr.next() != bl_itr.next()) { return fal...
3
public boolean saveLevel(File levelFile, PXLE_Level levelToSave) { try { // THESE WILL US BUILD A DOC DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); ...
6
public static void makethefile(String infile, String outfile, int rootnote, String temperamentstring, double maxpitchbend, Boolean writemaxpitchbend, int selectProgram, int tuningroot, double tuningfrequency, int transposeamt, Boolean overwrite) throws MidiUnavailableException, InvalidMidiDataException, IOException { ...
7
@Override public boolean[][] generateMaze() { List<Point> list = new ArrayList<Point>(); int last; this.maze[1][1] = false; last = this.addNeighbours(new Point(1,1), list); while(!list.isEmpty()){ int curi = this.rnd.nextInt() % last; ...
4
protected void changeListActiveOrNon() { showList.clear(); if (cmbActiveNonActivePersons.getSelectedItem().equals(ACTIVE_PERSON)) { for (DBPerson dbPerson : DatabaseList.listOfStockHolders) { if (dbPerson.getAllStocks() != 0) { showList.add(dbPerson); } } } if (cmbActiveNonActivePersons.getSe...
6
private void boardSetup() { String[] colour = {"Black","White"}; int[] printRows = {0,1,2}; boolean offset = true; for(int i=0;i<2;i++) // loop for each player { for(int k=0; k<3;k++) // loop for each row (&^) { for(int j = (offset) ? 1 : 0 ; j<=7; j+=2) // loop for each disc, (&^^) { ...
4
public AnimalInfo() { /** * Instantiates an animal object for each animal selection */ final Animal lion = new lion(); final Animal tiger = new tiger(); final Animal bear = new bear(); /** * Sets parameters for the JFrame */ setResizable(false); setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\...
0
@Override public void paint(Graphics g) { // TODO Auto-generated method stub super.paint(g); //System.out.println("repainting"); this.drawFields(g); this.drawDate(g); }
0
public int getX() { return x; }
0
public int compare(Atom a1, Atom a2) { // TODO: something like return Integer.compare(a1.layer,a2.layer) // would be more efficient if (a1.layer < a2.layer) return -1; else if(a1.layer > a2.layer) return 1; else return 0; }
2
public long read7bytes() throws IOException { long b0 = read(); long b1 = read(); long b2 = read(); long b3 = read(); long b4 = read(); long b5 = read(); long b6 = read(); if (le) return b0 | (b1 << 8) | (b2 << 16) | (b3 << 24) | (b4 << 32) | (b5 << 40) | (b6 << 48); else return b6 | (b5 << 8) ...
1
private static int clamp(int p) { return p > 255 ? 255 : (p < 0 ? 0 : p); }
2
public void setButton(String text, int iD, int loc, boolean disabled) { buttonArray[loc].set(text, iD, disabled); }
0
@Override public void e(float sideMot, float forMot) { if (this.passenger == null || !(this.passenger instanceof EntityHuman)) { super.e(sideMot, forMot); this.W = 0.5F; // Make sure the entity can walk over half slabs, // instead of jumping return; } EntityHuman human = (EntityHuman) this.passe...
8
public static void main(String[] args) { final String user; final String pass; if (args.length != 2) { user = ""; pass = ""; } else { user = args[0]; pass = args[1]; } EventQueue.invokeLater(new Runnable() { public void run() { try { Model model = new Model(user, pass); ...
2
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...
6
public static boolean searchinRotatedArrayWithDup(int[] A, int target) { int start = 0; int end=A.length-1; int mid; while(start<=end) { mid=(start+end)/2; if(A[mid]==target) return true; if(A[start]<A[mid]) ...
8
private boolean executeCommand(String cmd, CommandSender sender, Iterator<String> args) { try { return (Boolean)commands.get(cmd).getClass().getMethod(cmd, CommandSender.class, Iterator.class).invoke(commands.get(cmd), sender, args); } catch(SecurityExcept...
7
public boolean enregistrerDepartVehicule(int numeroLocation){ System.out.println("ModeleLocations::enregistrerDepartVehicule()") ; Location location = rechercherLocation(numeroLocation) ; if(location != null){ location.setEtat(Location.EN_COURS) ; location.setDateDepart(new GregorianCalendar()) ; locatio...
1
public void setResponseCode(int responseCode) throws MessageAttributeException { switch (responseCode) { case 400: reason = "Bad Request"; break; case 401: reason = "Unauthorized"; break; case 420: reason = "Unkown Attribute"; break; case 430: reason = "Stale Credentials"; break; case 431: reason = "Integri...
9
protected int validateInput(String input, int numDigits) { if(input.equals("")) { return 0; } boolean negative = false; input = input.trim(); if(input.charAt(0) == '-') { negative = true; } //Goes thr...
8
@Test public void testReceiveMultipleTimeout() { int noOfMessages = 5; try { consumer = new AbstractMessageConsumer(mockTopic) { }; assertNotNull(mockTopic.getTopicSubscriber()); HashSet<Message> messages = new HashSet<Message>(); for (int i = 0; i < noOfMessages; i++) { Message msg = new MockM...
4
public int searchInsert(int[] A, int target) { //边界条件判断 if ( A.length==0 ) return 0; int end = A.length-1; int start = 0 ; if (A[start] >= target) return start; else if (A[end]< target ) return A.length; //二分查找 int mid = (end-start)/2; while ( end>=start) ...
7
private List<MorrisLineAdjacent> getRowLineAdjacent() { List<MorrisLineAdjacent> lines = new ArrayList<MorrisLineAdjacent>(); boolean bl = this.hasLeft(); boolean br = this.hasRight(); MorrisLineAdjacent oneLine = null; if (bl && br) { //this is in the middle oneLine = new MorrisLineAdjacent(this, this.lef...
6
private void findDeviceParser(String type) throws SAXException { if (type != null) { logger.info(String.format( Messages.getString("device_found"), type)); //$NON-NLS-1$ currentParser = parserFactory.getParser(type); if (currentParser != null) { logger.info(String.format(Messages.getString("pars...
2
public BodyPart getBodypart(){ return bodypart; }
0
public GaussianDialog(final Panel panel) { setTitle("Gaussian"); setBounds(0, 0, 350, 200); Dimension size = getToolkit().getScreenSize(); setLocation(size.width / 3 - getWidth() / 3, size.height / 3 - getHeight() / 3); this.setResizable(false); setLayout(null); JPanel paramPanel = new JPanel(); pa...
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 fe...
6
public static String[] traitDesc(String trait) { /* * Traits for civs: * 3 Aggressive > +10% when attacking, 1 free promotion per unit * 3 Imperialistic > 2 health per city, > 1 extra trade route per city * 2 Refined > 2 culture per city, > +10% research speed * 4 Prosperous ...
7
public Action choose(LightsOut.Player actor, Set<Action> options) { if(presses == null) { presses = new HashSet<Location>(); // linear algebra solution boolean[][] state = actor.state(); boolean[] s = stateVector(state); boolean[][] M = stateMatrix(state[0].length, state.length); gauss(M, s); ...
5
public void actionPerformed(ActionEvent ae) { try { if (ae.getSource() == this.tmrReadLine) { try { if ((!this.continueRun) || (this.killThread) || (this.sktMyConnection_ConnectedAgent.isClosed())) { closeThread(); } } catch...
8
public double HCRR(Instances train,Classifier[] cfsArray,List<Integer>[] classifyResult,List<Double> correctRateArray,double initCorrectRate,List<Double> currentResult,List<Integer> ClassifierNo){ double diversity;//差异性(差异性度量是κ度量,κ值越小,差异性越大) double tempDiversity; double correctRate;//正确率 double voteCorrectRate;...
9
private int checkCross(int i, int j, Board b) { int points = 0; //ONLY IF "X" IS FOUND ASSUMING X IS COMPUTER if(b.board[i][j].equals("X")) { if(i==0) { if(j==0) { points+=checkConsecutiveX('r',i,j,b); points+=checkConsecutiveX('d',i,j,b); points+=checkConsecutiveONextToX('r',i,j...
9
public void addDocumentRepositoryListener(DocumentRepositoryListener l) { documentRepositoryListeners.add(l); }
0
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...
6
@Override public void removeStock(Stock stock) { tx.begin(); for (SubProcess sp : stock.getSubProcesses()) { stock.removeSubProcess(sp); } for (StorageUnit su : stock.getStorageUnits()) { stock.removeStorageUnit(su); } em.merge(stock); em.remove(stock); tx.commit(); }
2
public byte[] getEncoded() { return this.encoded; }
0
public double logScore(int nType, int nCardinality) { double fScore = 0.0; switch (nType) { case (Scoreable.BAYES): { for (int iSymbol = 0; iSymbol < m_nSymbols; iSymbol++) { fScore += Statistics.lnGamma(m_Counts[iSymbol]); } fScore -= Statistics.lnGamma(m_SumOfCounts); ...
9
public OdigoiList() { con = new Mysql(); setTitle("Lista Odigwn"); /* vgazei to para8uro sto kedro tis othonis me diastaseis 355x40 */ Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); this.setBounds(dim.width/2-150, dim.height/2-125, 355, 400); /*--------------*/ this.setResizable(false); ge...
2
private void init(final Stage primaryStage) { thisStage = primaryStage; thisStage.setTitle("Sliding Puzzle"); StackPane sPane = new StackPane(); Label label = new Label("Name: "); final TextField nameField = new TextField(); final Button setNameField = new Button("OK")...
3
public void updateUptime(int uptime) { lastUptime = uptime; }
0
public boolean requiresPolygonIDs() { // not needed in this case... return false; }
0
protected boolean validaCampos(){ boolean valida = true; if(txtCpf.getText().isEmpty() || txtDataNascimento.getText().isEmpty() || txtNome.getText().isEmpty()){ valida = false; }else { valida = true; } re...
3
@Override public void valueChanged(TreeSelectionEvent e) { if(component != null) editor.remove(component); DialogNode node = getSelectedNode(); if(node == null) return; DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent(); if(node.type == EnumNodeType.CATEGORY){ DialogC...
5
public void forceKillProt() { tmr.cancel(); if(runningServer != null) runningServer.kThread(); if(runningClient != null) runningClient.kThread(); forceKill = true; if(socket1 != null) { try { socket1.close(); } catch(IOException e){} } if(server != null) { try { server...
8
public Date getNextArena() { Date returnDate = null; InaccurateTime newMax = Time.currentInnacurateTime(); ArrayList<Integer> ints = new ArrayList<>(); for (Date date : arenaMap.keySet()) { ints.add((int) date.getInaccurateTime().toNumberValue()); } int currentTime = getLargest(ints.toArray(new Integ...
7
public Image getImage(){ switch(anim){ case 0: return bang0; case 1: return bang1; case 2: return bang2; default: return bang1; } }
3
public void setLocked(boolean locked) { if (mLocked != locked) { notifyOfLockedStateWillChange(); mLocked = locked; notifyOfLockedStateDidChange(); } }
1
public static void main(String[] args) { //Scanner initialisieren scanner = new Scanner(System.in); hero = new Hero(); System.out.println("Options: attack, arbitraryOption, quit"); //fancy Version einer Dauerschleife while(scanner.hasNext()) { /...
4
public Texture getTexture(String tex) { if(!textures.containsKey(tex)) { try { loadTexture(tex); } catch(Exception e) { System.out.println("Couldn't create texture!"); } } return textures.get(tex); }
2
private static long toMillis(String value, TimeUnit unit) { if(value != null && !value.isEmpty()) { Matcher matcher = Pattern.compile("[0-9]+").matcher(value); if(!matcher.find()) return 0; return unit.toMillis(Integer.parseInt(matcher.group())); } return 0; }
3
public boolean makeLocalBackup(String fileName) { //Copy local file to back-up location try { String backupDirectory = this.downloadLocation + File.separator + "Local_Backup"; if(this.fileSystemManager.getDirectory(backupDirectory) == null) { this.fileSystemManager.createDirectory(backupDirector...
8
private void getFloorPlanGetXY(String line, CellDescription cellDescription) { int startIndex; int endIndex; /*get x*/ startIndex = line.indexOf("xs") + 4; endIndex = line.indexOf('\'', startIndex); try { cellDescription.locX(Integer.parseInt(line.substring(startIndex, endIn...
2
@EventHandler(priority = EventPriority.LOW) public void playerLogout( final PlayerDisconnectEvent e ) { int dcTime = MainConfig.playerDisconnectDelay; final BSPlayer p = PlayerManager.getPlayer( e.getPlayer() ); if ( dcTime > 0 ) { BungeeSuite.proxy.getScheduler().schedule( Bunge...
9
public void next(int width, int height) { rotationAngle = (rotationAngle+10)%360; // scaleVal goes from 0 to 1, then 1 to 0, then starts over scaleArg = (float)((scaleArg == 1) ? scaleArg - 0.1 : scaleArg + 0.1); scale = (float)Math.cos(scaleArg); movClubX += inc_club; movDiamondX += inc_diamond; movHeart += ...
9
private boolean isKingInCheck(Position kingPosition) { boolean inCheck = false; String colorCheck = whitePlayerTurn() ? "Black" : "White"; // System.out.println("\nPieces that can move for " + colorCheck + "'s Team"); for(int y = 0; y < maxWidth; y++) { for(int x = 0; x < maxHeight; x++) { Pie...
8
private void resubstitute(StringBuilder buffer) { for (int c = 0; c < buffer.length(); c++) { if (buffer.charAt(c) == '*') { char x = buffer.charAt(c - 1); buffer.setCharAt(c, x); } else if (buffer.charAt(c) == '$') { buffer.setCharAt(c, 's...
8