text
stringlengths
14
410k
label
int32
0
9
public int timeToCode(Object tableData) { int hours = -1; int minutes = -1; boolean afternoon = false; try { //Convert the given time to an actual time if(tableData.toString().contains("PM") || tableData.toString().contains("pm")) afternoon = true; String temp = tableData.toString().r...
9
*/ BSTNode find(BSTNode tree, K key) { // Special case: Empty tree. Give up if (tree == null) { return null; } // if (tree == null) else { int tmp = order.compare(key, tree.key); if (tmp == 0) { return tree; } else if (tmp < 0) { return find(tree.smaller, key); } else { return fin...
3
@Override public String generateInnerPaging(PageBean pageBean, int showPages) { StringBuilder htmlBuf = new StringBuilder(); PaginationGenUtil genUtil = PaginationGenUtil.getInstance(); htmlBuf.append(genUtil.generateCommonPagingPart(pageBean)); if (pageBean.getCurrentPage() > 1) {...
9
@Override public double[][] solve(double[] T_0, int n, double k, double u, double dt, double dx) { double[][] ans = new double[n][]; int m = T_0.length; ans[0] = T_0; for (int layer = 1; layer < n; layer++) { double[] T = ans[layer - 1]; double[] curLayer = new double[m]; for (int i =...
2
@Override public int hashCode() { int result = prpPosId != null ? prpPosId.hashCode() : 0; result = 31 * result + (prpMoaTipo != null ? prpMoaTipo.hashCode() : 0); result = 31 * result + prpMoaConsec; result = 31 * result + prpIdElemento; return result; }
2
public static void main(String[] args) { System.out.println("Starting failure example 2..."); try { if (args.length < 1) { System.out.println("Usage: java ResFailureEx02 network_ex02.txt"); return; } /////////...
5
public Display findDisplayFor(Class cl) { // Go up through the class hierarchy for obj and see // if there is a display for its class or superclasses. if (cl == Object.class) return defaultDisplay; Display display = map.get(cl); if (display != null) r...
3
public List<ParkClass> resultSet(List<ParkClass> list) { List<ParkClass> result = new ArrayList(); int count = list.size(); int i; for(i=0;i<count;i++) { if(GetDistance(y, x, list.get(i).getLatitude(), list.get(i).getLongitude())<=3) { result.add(list.get(i)); } } return result; }
2
public static void topDiamond(){ final int ITER_NUM = 2; int cnt = ITER_NUM - 1; for (int i = ITER_NUM; i >=0; i--, cnt++) { //overall itration System.out.print("|"); for (int j = 1; j <= i; j++) { //dot generator System.out.print("."); } for (int j = 1; j <=cnt; j++) { ...
7
public void setPWResetFontsize(int fontsize) { if (fontsize <= 0) { this.pwResetFontSize = UIFontInits.PWRESET.getSize(); } else { this.pwResetFontSize = fontsize; } somethingChanged(); }
1
public void transportClosed() { boolean changed=false; lock.lock(); try { for(Map.Entry<Address, Rsp<T>> entry: rsps.entrySet()) { Rsp<T> rsp=entry.getValue(); if(rsp != null && !(rsp.wasReceived() || rsp.wasSuspected() || rsp.wasUnreachable())) { ...
7
public Ticket[] getTickets() { return this._tickets; }
0
private byte offer(SmallPacket d) throws CallbackException { System.out.println("Offering"); Byte ack = sequencer.put(d); if (ack == null) return 0; System.out.println("Getting packets"); LinkedList<DataPacket> readyPackets = sequencer.getPackets(d .getSource()); System.out.println("YAY! " + ready...
5
@Override public HashMap<String,ClassNode> refactor(){ Deob.deobOutput.add("* Starting Method Removal*"+System.getProperty("line.separator")); System.out.println("* Starting Method Removal*"); List<MethodWrapper>remove = getRedundantMethods(); List<MethodNode> toRemove = new Arra...
7
public TermWin(Shell parent) { super (parent); port = null; self.addShellListener(new ShellAdapter() { public void shellClosed(ShellEvent de) { rxRun = false; if (port != null) { port.close(); } self.getParent().setEnabled(true); } }); /* close the termi...
7
public void openResultaten() { for (views.panels.GekozenAntwoord gk : gekozenAntwoorden) gk.geefLijntje(true); middenvlak.removeAll(); for (JButton button : buttons) button.setEnabled(false); middenvlak.revalidate(); middenvlak.repaint(); middenvlak.add(new ResultatenScherm(spel)); }
2
public boolean doesThreaten(Point p){ char c=aiarr[(int)p.getX()][(int)p.getY()].toString().charAt(0); if(c=='B')c='W'; else c='B'; checkThreats(gameBoard,c); for(int i=0;i<numThreatening;i++){ if(locThreatening[i].getX()==p.getX() &&locThreatening[i].getY()==p.getY()){ return true; } } return f...
4
public void getConnection() throws IOException { Socket socket; Client client; byte[] respons; byte[] tmpRespons; while(true) { socket = this.socket.accept(); client = new Client(socket, "", new String(Server.secKey), this); // TODO creats a key exchange client.writes(Server.secKey); ...
8
public void playerAction(int startIndex) { List<Player> playerList = game.getPlayerList(); game.tableView.updateAllPlayer(playerList); game.tableView.appendLog(game.getBoardCards().toString()); for(int i = startIndex; !game.isOnlyOneAlive() && !game.isAllCall(); i = (i+1)%playerList.size()) { Player pl...
4
public void Start(String id, String serverIp) { try { // ฯฟ รปัด. Socket socket = new Socket(serverIp, 7777); System.out.println(" วพฯด."); Thread sender = new Thread(new ClientSender(socket, id)); Thread receiver = new Thread(new ClientReceiver(socket)); // ลฌฬพฦฎ sender.start(); // sender re...
2
@Test public void placeFigures() { HashMap<String, Integer> figureQuantityMap = new HashMap<>(); figureQuantityMap.put(BISHOP.toString(), 4); FiguresChain figuresChain = new Bishop(figureQuantityMap); FiguresChain figuresChain1 = new Queen(figureQuantityMap); figuresChain.set...
7
public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // FIRST_NAME return FIRST_NAME; case 2: // LAST_NAME return LAST_NAME; case 3: // STATUS return STATUS; case 4: // ID return ID; case 5: // EMAIL ...
5
@Override public void run() { try { URL pagina = new URL("http://chapuzas.comocreartuweb.es/documentos/version.txt"); HttpURLConnection con = (HttpURLConnection) pagina.openConnection(); con.connect(); InputStreamReader in = new InputStreamReader((InputStream)...
6
public static double lireDecimal(String message) { double d = 0; boolean ok; do { ok = true; try { System.out.print(message); clavier = new Scanner(System.in); d = clavier.nextDouble(); } catch (Exception e) { System.out.println("Mauvais format"); ok = false; } } while (!ok); r...
2
public void renderPhysics() { Array bodies = new Array(); for (int i = 0; i < deadBodies.size(); ++i) { try { world.getBodies(bodies); if (bodies.contains(deadBodies.get(i), true)) { world.destroyBody(deadBodies.get(i)); ...
4
@Override public void characters (char[] ch, int start, int length) { if(bconverse == true){ String str = new String(ch,start,length); temp =temp + " " +str.trim(); temp = temp.replaceAll("(?i)(<)(.+?)(>)"," "); temp = temp.replaceAll("\\s+", " "); } }
1
public static int indexOf(byte[] s, byte w) { for (int i = 0; i < s.length; i++) if (s[i] == w) return i; return -1; }
2
@Override public MoveResult makeMove(HantoPieceType pieceType, HantoCoordinate from, HantoCoordinate to) throws HantoException { MoveResult moveResult = null; if (from == null && to == null){ switch(gameManager.getPlayerTurn()){ case BLUE: moveResult = MoveResult.RED_WINS; break; case RED: ...
5
public Permission getPermissions() { if (permHook == null) { throw new NullPointerException("Permissions was called but hasn't been setup!"); } return permHook; }
1
private void btnInserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInserActionPerformed if ("0".equals(txtId.getText())||"".equals(txtId.getText())) { JOptionPane.showMessageDialog(this, "Ingrese un Id valida"); } else if ("".equals(txtNombre.getText())) { ...
7
public static Units[] getGenerals() { ArrayList<Units> units = new ArrayList<Units>(); try { Statement s1 = conn.createStatement(); ResultSet rs = s1 .executeQuery("Exec getGeneral"); if (rs != null) { while (rs.next()) { String unitName = rs.getString("unitName"); int ability = rs.g...
3
public FruitManager() { if(fruits.isEmpty()) { try { loadFruits(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } instance = this; }
3
public boolean checkLegal(String prev_pos, String new_pos) { if((prev_pos.substring(0,1).equals(new_pos.substring(0,1)))&&(prev_pos.substring(1).equals(new_pos.substring(1))==false))//up down { return true; } else if((prev_pos.substring(0,1).equals(new_pos.substring(0,1))==false)&&(prev_pos.substring(1)...
4
public static void main(String[] args) { IceCream ic = new IceCream(); Sundae s = ic.getSundae(); }
0
static final void method2255(int i, int i_3_, byte i_4_, int i_5_, int i_6_, int i_7_, int i_8_) { Class117.method1070((byte) 117, i); anInt3812++; if (i_4_ >= -65) method2255(-118, -20, (byte) -121, 100, -62, 77, -119); int i_9_ = 0; int i_10_ = -i_5_ + i; if ((i_10_ ^ 0xffffffff) > -1) i_10_ = 0;...
9
public void setValue(Object aKey, Object aValue) { if(aKey == null) throw new IllegalArgumentException("Client property key cannot be null."); final Object lOldValue = values.get(aKey); // Only take action when the new value is different from the old value. // If nothing changes nob...
9
public ManagePadsController(List groupIds, final MainViewController mainViewController) { final ManagePadsView managePadView = new ManagePadsView(); managePadView.setGroupComboBoxValues(groupIds); managePadView.setGroupComboBoxActionListener(new ActionListener() { @Override public void actionPerformed(Acti...
8
private String userTopic(String userInput) { String userBasedResponse = ""; int randomUserTopic = (int) (Math.random() * 6); switch (randomUserTopic) { case 1: userBasedResponse = myUser.hasTattoos() + " is the response to tattoos :D"; break; case 0: userBasedResponse = myUser.getUserName() + " ...
2
public static void main(String[] args) { try { DistriControl control = new DistriControl(); FileInputStream handlesFile = new FileInputStream( DistriControlTest.class.getResource(HANDLES_FILE).getPath()); BufferedReader handlesReader = new BufferedReader( new InputStreamReader(handlesFile)); S...
9
public void endElement() throws IOException { String name = openElements.pop(); // If start tag still open, end with />, else with </name>. if (bStartTagOpen) { w.write("/>" + newLine); bStartTagOpen = false; } else { writeIndent(); w.writ...
2
public void printResults() { for (int i = 0; i < tondeuses.size(); i++) { System.out.println("Tondeuse Nยฐ" + i + " : " + tondeuses.get(i).toString()); } }
1
public void setEventId(int eventId) { this.eventId = eventId; }
0
public String readMassProperties(BufferedReader massPropertiesReader, String propertiesToFind) throws IOException{ String propertyName = null, propertyData = null, readIn = null; do{ readIn = massPropertiesReader.readLine(); try { if(readIn.equals(null)){ break; } } catch (NullPoi...
8
protected static Ptg calcMRound( Ptg[] operands ) { if( operands.length != 2 ) { return new PtgErr( PtgErr.ERROR_NA ); } double m = 0.0; double n = 0.0; try { n = operands[0].getDoubleVal(); m = operands[1].getDoubleVal(); } catch( NumberFormatException e ) { return PtgCalculator.getVal...
6
public void addLstore(int n) { if (n < 4) addOpcode(63 + n); // lstore_<n> else if (n < 0x100) { addOpcode(LSTORE); // lstore add(n); } else { addOpcode(WIDE); addOpcode(LSTORE); addIndex(n); ...
2
private int calc(int begin, int end, int number) { int min = begin % number == 0 ? begin : (begin / number + 1) * number; int max = end % number == 0 ? end : end / number * number; int count = (max - min) / number + 1; return (min + max) * count / 2; }
2
public boolean pause(Session sess) { if((sess==null)||(sess.isStopped())) return false; sess.rawCharsOut("<pause - enter>".toCharArray()); try { String s=sess.blockingIn(10 * 60 * 1000, true); if(s!=null) { s=s.toLowerCase(); if(s.startsWith("qu")||s.startsWith("ex")||s.equals("x")) re...
7
@Override public String toString() { return nom + " " + prenom; }
0
public int compareTo(Object tmp ) { int result; result = (this.ticks < ((Event)tmp).GetTicks() ? -1 : (this.ticks == ((Event)tmp).GetTicks() ? 0 : 1)); return result; }
2
@Override public String saveQuestion(ua.edu.odeku.pet.database.entry.Test test) { if (test == null || test.getId_test() == null){ return "ะ”ะปั ัะพั…ั€ะฐะฝะตะฝะธั ะฒะพะฟั€ะพัะฐ ะฝะตะพะฑั…ะพะดะธะผะพ ะฟะตั€ะตะดะฐั‚ัŒ ะพะฑัŠะตะบั‚ ั‚ะตัั‚ะฐ"; } question = new Question(); question.setIdTest(test); question.setN...
5
public byte[] getPublicKeyBlob(){ if(publickeyblob!=null) return publickeyblob; if(type==RSA) return getPublicKeyBlob_rsa(); return getPublicKeyBlob_dss(); }
2
public void stopGame() { // Setting isRunning to false will // make the thread stop (see run()) this.isRunning = false; // Make sure we wait until the thread has stopped... if (this.gameThread != null) { while (this.gameThread.isAlive()) { try { Thread.sleep(100); } catch (InterruptedExceptio...
3
@EventHandler public void onPlayerInteractEntity(PlayerInteractEntityEvent event){ Player player = event.getPlayer(); Entity entity = event.getRightClicked(); if(AnimalUtil.isAnimal(entity) && player.getItemInHand() != null && !ExplodeUtil.isAnimalGoingToExplode((LivingEntity) entity)){ ...
6
@Override public void paintComponent(Graphics g) { int x = 0; int y = 0; int jobTime = 0; int count = 0; int fontBorder = 1; int stepwidth = 20; Font font = new Font("Verdana", Font.BOLD, 12); color.add(new Color(185, 211, 238)); c...
7
public static void startMinecraft(String memory,String version) throws FileNotFoundException{ try { String path = getMainPath()+File.separator; String versionDir = new File(path,"versions"+File.separator+version).getAbsolutePath()+File.separator; String assetsDir = ne...
8
public static BufferedImage sharpen(BufferedImage input) { int sharpen[][] = new int[][]{ {0, -1, 0}, {-1, 5, -1}, {0, -1, 0} }; BufferedImage result = new BufferedImage(input.getWidth(), input.getHeight(), input.getType()); for (int i =...
4
public double getYSpeed(int which) { switch(which){ case 1: return leftDriveJoy.getY(); case 2: return rightDriveJoy.getY(); case 3: return leftJoy.getY(); case 4: return rightJoy.getY(); } ...
4
public void setInternalButtonPadding(int widthPadding, int heightPadding) { if ((this.buttonWidthPadding == widthPadding) && (this.buttonHeightPadding == heightPadding)) { return; } this.buttonWidthPadding = widthPadding; this.buttonHeightPadding = heightPadding; inst...
2
public Expression simplify() { Expression expr = simplifyAccess(); if (expr != null) return expr.simplify(); expr = simplifyString(); if (expr != this) return expr.simplify(); return super.simplify(); }
2
public static void main(String[] args) throws IOException { Grid g = new Grid(4, 2048); g.printGrid(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s; while ((s = br.readLine()) != null) { switch (s) { case "w": g.move(Operators2048.UP); break; case "s": ...
5
public int typeLen(){ if(length<=0) return 0; if(tagVal() != 0x1f) return 1; int k=offset+1; int len=2; while((k<length+offset) && (gs(data[k])>127)) {len++; k++;} if (len > length) return 0; return len; }
5
public void setField(Field fieldIn){ if(fieldSize == fieldIn.fieldSize){ //System.arraycopy(fieldIn.field,0,this.field,0,fieldSize); Does not work for (int i = 0; i < fieldSize; i++){ for (int j = 0; j < fieldSize; j++){ this.field[i][j] = fieldIn.fi...
3
public ArrayList<Usuarios> getByDNI(Usuarios u){ PreparedStatement ps; ArrayList<Usuarios> usuarios = new ArrayList<>(); try { ps = mycon.prepareStatement("SELECT * FROM Usuarios WHERE dni=?"); ps.setString(1, u.getDNI()); ResultSet rs = ps.executeQuery(); ...
4
public String toString() { StringBuffer result = new StringBuffer("["); for (int i = 0; i < stackMap.length; i++) { if (i > 0) result.append(", "); result.append(stackMap[i].getName()); } return result.append("]").toString(); }
2
public void connect() { System.out.println("Attempting to connect to server..."); try { conn.connect("1.1.1.1", 9876); } catch (CouldNotConnectException e) { System.out.println("Could not connect: " + e.getMessage()); } }
1
public GeneratorWebClient() { isRunning = false; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 800, 600); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JPanel p...
2
public void randDnaSeqGetBaseTest(int numTests, int numTestsPerSeq, int lenMask, long seed) { Random rand = new Random(seed); for( int t = 0; t < numTests; t++ ) { String seq = ""; int len = (rand.nextInt() & lenMask) + 10; // Randomly select sequence length seq = randSeq(len, rand); // Create a random se...
3
private void formatAll() { try { final Matcher m = FORMATTING_PATTERN.matcher(getDoc().getText(0, getDoc().getLength())); Integer start = 0; while (m.find()) { if (m.group(8) != null) { // comment ...
6
public static void main(String[] args){ //////////////////Checking get alternatives//////////////////////////////// String str = "thisisalongstringthatshouldbeovertwentycharacterslong"; int length = 53; int compare = 53*(length+1) + 25; Word[] w = d.getAlternatives(new Word(str)); if(w.length != co...
7
private void init(){ TextureRegion[] tr = null; boolean direction = false; Texture t; time = 3; // System.out.println("init splash: "+type); switch(type){ case DO_BATTLE: t = Game.res.getTexture("doBattlebase"); tr=TextureRegion.split(Game.res.getTexture("doBattle"), t.getWidth(), t.getHeigh...
9
public NpcDefinition child(IClientContext ctx) { int index = 0; if (scriptId == -1) { index = configId != -1 ? ctx.varpbits.varpbit(configId) : -1; } else { final Script script = ctx.definitions.varp(scriptId); if (script != null) { index = script.execute(ctx); } } if (index >= 0 && index < ch...
6
private static boolean canPushOpponentOutOfSuperRegion(BotState state, SuperRegion superRegion) { boolean out = true; List<Region> subRegions = superRegion.getSubRegions(); for (Region subRegion : subRegions) { if (subRegion.getPlayerName().equals("unknown") && HeuristicMapModel.getGuessedOpponentRegions(...
5
public static boolean isNumeric(Object value) { if (value == null) return false; else { if (value instanceof Byte || value instanceof Integer || value instanceof Long || value instanceof Double || value instanceof Fl...
8
protected void startup() { // Get the native look and feel class name String nativeLF = UIManager.getSystemLookAndFeelClassName(); // Install the look and feel try { UIManager.setLookAndFeel(nativeLF); } catch (InstantiationException e) { } catch (Cla...
5
public static Faixada getInstance(){ if(faixada == null){ faixada = new Faixada(); } return faixada; }
1
private void searchContact() { final JDialog dialog = new JDialog(); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setTitle("Kontakt suchen"); dialog.setResizable(false); dialog.setBounds(this.getLocationOnScreen().x + 350, this.getLocationOnScreen().y - 40, 250, 110); dialog.getContentPane...
2
public static void copyDirectory(String srcDir, String destDir, boolean keepDate) throws UtilException { try { FileUtils.copyDirectory(new File(srcDir), new File(destDir), keepDate); } catch (IOException e) { throw new UtilException("ๆ‹ท่ด็›ฎๅฝ•ๅคฑ่ดฅ", e); } }
1
public boolean existNode(GraphNode<T> pgraphNode) { for (int i = 0; i < graph_nodes.getLength(); i++) { if (pgraphNode.equals(graph_nodes.get(i))) {//if param is equal to node in list. return true; } } return false; }
2
public Integer getStart() { if (start != null) if (start < 0 || start > 100) throw new RuntimeException("startๅ–ๅ€ผ่Œƒๅ›ด0~100๏ผ"); return start; }
3
public boolean degradeCompletly(Item item) { int defaultCharges = ItemConstants.getItemDefaultCharges(item.getId()); if (defaultCharges == -1) return false; while (true) { if (ItemConstants.itemDegradesWhileWearing(item.getId()) || ItemConstants.itemDegradesWhileCombating(item.getId())) { charges.r...
7
public void movepass () { if (!Started || Ended) return; if (B.maincolor()!=Col) return; if (Timer.isAlive()) alarm(); if (Col>0) { if (BlackMoves>0) BlackMoves--; } else { if (WhiteMoves>0) WhiteMoves--; } PF.pass(BlackTime-BlackRun,BlackMoves, WhiteTime-WhiteRun,WhiteMoves); }
7
private static double doubleHighPart(double d) { if (d > -SAFE_MIN && d < SAFE_MIN){ return d; // These are un-normalised - don't try to convert } long xl = Double.doubleToLongBits(d); xl = xl & MASK_30BITS; // Drop low order bits return Double.longBitsToDouble(xl); ...
2
public Users checkRegistered(String login, String password) throws SQLException { Users user = null; //ะŸะพะดะบะปัŽั‡ะฐะตะผัั ะบ ะฑะฐะทะต PreparedStatement statement = getConnection().prepareStatement(isRegisteredQuery); statement.setString(1, login); statement.setString(2, password); R...
1
@Override public void run() { ObjectInputStream in = null; ObjectOutputStream out = null; // System.out.println("Accepted Client Address - " // + clientSocket.getInetAddress().getHostName()); try { in = new ObjectInputStream(clientSoc...
8
public void update(Observable o, Object arg) { // TODO Auto-generated method stub }
0
private void parseFile(String filePath) { currentFile = filePath; File file = new File(filePath); if (file.exists()) { try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Doc...
5
public Iterator getChilds() { final Iterator fieldIter = fieldIdents.iterator(); final Iterator methodIter = methodIdents.iterator(); return new Iterator() { boolean fieldsNext = fieldIter.hasNext(); public boolean hasNext() { return fieldsNext ? true : methodIter.hasNext(); } public Object nex...
2
public static Location getLocationFromName(String thename) { int index = -1; for(int i=0; i<Parasite.location.listOfLocations.length;i++) { String tempplace = Parasite.location.listOfLocations[i].room; if(tempplace.equalsIgnoreCase(thename)) { ...
2
public void loadCheques(){ chequeDataAccessor dataAccessorCheque=new chequeDataAccessor(); List<cheque> chequeList=new ArrayList(); DefaultTableModel orderDataTable=new DefaultTableModel(); Object[ ] columnNames=new Object[4]; Object[ ] fieldValues=new Object[4]; ...
4
private void removeNextAction() { if (actions != null && actions.size() > 0) { actions.remove(0); } }
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 void visitStoreExpr(final StoreExpr node) { nodes.add(node); if (checkValueNumbers) { Assert.isTrue(node.valueNumber() != -1, node + ".valueNumber() = -1"); } Assert.isTrue(node.block() == block, node + ".block() = " + node.block() + " != block = " + block); Assert.isTrue(node.parent() ==...
2
static public void quickSort(int[] array, int left, int right){ int p = (left + right)/2; int pivot = array[p]; int i = left; int j = right; while(i < j){ while(i < p && pivot >= array[i]){ ++i; } if(i < p){ array[p] = array[i]; p = i; } while(j > p && pivot <= array[j]){ --j; ...
9
public void getUserData(String data) { String begin = "<!--udatab "; String end = " udatae-->"; String _tmp = data; StringTokenizer tokenizer; client.userdata.clear(); while (_tmp.indexOf(begin) != -1) { int i = _tmp.indexOf(begin)+11; int k = _tmp.indexOf(end); int m = k+10; String udata = _...
3
void playStep() { tick++; // move the player dogs if (tick % 10 == 0 && tick !=0){ calculateres(); //updatemap(); } for (int d=0; d<4; d++) { try { ArrayList<movePair> nextlist = new ArrayList<movePair>(); nextlist = players[d].mov...
7
public static void dnf (String[] vals, StringClassifier classifier) { /* * Sort the array using some tactics we learned during our binary search * class discussion. * * * As i increases, we can put reds to the front and leave all whites in the * center. Therefore, the "r" invar...
5
public void dataDeque(){ dataQue = new LinkedBlockingQueue<Packet>(); Thread dataHandling = new Thread() { public void run(){ while(true){ Packet packet = (Packet) dataQue.poll(); if(packet != null) { if(packet.channel != null)...
4
public void setStandardButtonBorderthickness(int[] border) { if ((border == null) || (border.length != 4)) { this.buttonStd_Borderthickness = UIBorderthicknessInits.STD_BTN.getBorderthickness(); } else { this.buttonStd_Borderthickness = border; } somethingChanged...
2
@Test public void testIsBrowser() { assertTrue(Browser.SAFARI.isInUserAgentString("Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3")); }
0
public void draw (SpriteBatch batch, float parentAlpha) { BitmapFont font = style.font; Drawable selectedDrawable = style.selection; Color fontColorSelected = style.fontColorSelected; Color fontColorUnselected = style.fontColorUnselected; Color color = getColor(); batch.setColor(color.r, color.g, color.b, ...
7