text
stringlengths
14
410k
label
int32
0
9
public void addPiece(Piece piece) { if (this.placedPiece == null) { this.add(piece); this.placedPiece = piece; this.validate(); this.repaint(); } else { throw new FieldAlreadyOccupiedException(this); } }
1
public static AdjListNode[] genRandomUndirectedWeightedGraph(int vertexCount) { if(vertexCount <= 0) { return null; } AdjListNode[] graphList = new AdjListNode[vertexCount]; Random random = new Random(); for(int i=0;i<vertexCount;i++) { if(graphList[i] == null) { graphList[i] = new AdjListNode(St...
6
public void book_update() throws Exception{ int field = 0, updatecomplete =1; Book findbook = bookcollect.book_search_lib(); // Ȥ ISBN ˻ å findbook̶ Bookü Ϲ޴´. if (findbook == null){ librarian_menu(); //˻ å̾ٸ 缭Ǹ޴εư. }else{ //Ʈϰ Ʈ ׸ Է¹޴´. do{ System.out.println("Ʈ ׸ ȣ ּ.\n1. \n2. \n3. ǻ \n4. IS...
4
private synchronized void countParameters(Users users, int numberOfUsers) { Plan plan = users.getPlan(); int thrPerEngine = plan.getThreadsPerEngine(); this.servers = count_servers(this.numberOfUsers, thrPerEngine); this.engineSize.setLength(0); this.engineSize.append(Constants...
2
public String getCourseID() { String class_abbrv = ""; String class_num = ""; String class_ID = ""; String tempStr = ""; tempStr = getSectionID(); int firstSub = 0; int secondSub = 0; i...
4
@Override public void run() { while (true) { try { byte code = fluxEntree.readByte(); if (code == NOUVELLE_CONNEXION) { nouveauConnecte(); } else if (code == DESACTIVE_BOUTON_PARAMETRE) { ModelePanneauListeJoueurs.getInstance().setConfigurationSetted(true); ModelePanne...
8
private int trMedian5 (final int ISA, final int ISAd, final int ISAn, int v1, int v2, int v3, int v4, int v5) { final int[] SA = this.SA; int SA_v1 = trGetC (ISA, ISAd, ISAn, SA[v1]); int SA_v2 = trGetC (ISA, ISAd, ISAn, SA[v2]); int SA_v3 = trGetC (ISA, ISAd, ISAn, SA[v3]); int SA_v4 = trGetC (ISA, ISAd, I...
6
public Manager(String n, double s, int year, int month, int day) { super(n, s, year, month, day); bonus = 0; }
0
private Celda buscarCelda(Integer aBuscar){ //Se obtiene el balde y se busca si el elemento se encuentra dentro de él. int baldeABuscar = tecnica.h(aBuscar); int posicionABuscar = posicionElementoEnBalde(baldeABuscar,aBuscar); //Referencia al elemento que se va a devolver. Celda celdaSalida = null; if ...
8
private void generateAssymetricKeyPair(APDU apdu) { byte[] buffer = apdu.getBuffer(); short lc = (short)(buffer[ISO7816.OFFSET_LC] & 0x00FF); byte p1 = buffer[ISO7816.OFFSET_P1]; short len; short crt; if (buffer[ISO7816.OFFSET_P2] != (byte)0) { ISOException.t...
9
public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); HashMap<Integer, Balance> balanceMap = new HashMap<Integer, Balance>(); // map to cache balance int numBalance = Integer.parseInt(br.readLi...
8
public LinkedList getCentersFromPublicAdvisories() throws MalformedURLException, IOException, ParseException { if(log.isDebugEnabled()) log.debug("Get list of forecast advisories from " + stormFileName); String advisoryArchiveContent = null; advisoryArchiveContent = new WebPage(urlPrefix + stormFileName).ge...
9
public void setName(String name) { this.name = name; }
0
public void testRipping() { try { Collection<Record> recs = RecordUtils.getRecordToRip(Integer.MAX_VALUE); for (Record rec : recs) assert (rec.getOwner() == 1 || rec.getFormat().getName().contains("x")); } catch (SQLException e) { e.printStackTrace...
3
public void remover(Local local) throws Exception { String sql = "DELETE FROM local WHERE id = ?"; try { PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql); stmt.setLong(1, local.getId()); stmt.executeUpdate(); } catch (SQLException e) { throw e; } }
1
public int MaxArea(String[] board){ int n = board.length; int m = board[0].length(); int[][] longest = new int[n][m]; for(int j=0; j<m; j++){ for(int i=n-1; i>=0; i--){ if(i<n-1 && board[i].charAt(j)!=board[i+1].charAt(j)) longest[i][j]=longest[i+1][j]+1; else...
9
private void processCommand(String command) { if (listener!=null) { command = command.trim(); if (command.length()>0) history.add(command); if (history.size()>MAX_HISTORY) history.remove(0); historyIndex = history.size(); listener.commandReceived(command); lastCommandOffset = ...
3
public static boolean isStoppedResult(Option[] options){ for(int i=0,count=options.length ; i<count ; ++i){ if((options[i].getName().equals(ActionResult.RESULT)) && options[i].getValue().equals(ActionResult.STOPPED)) return true; } return false; }
3
private void optimizeFLangOrNatSc(boolean natSc){ // ForeignLanguages: 4 hjs mandatory // NaturalSciences: 4 hjs mandatory // Process is identical Subject[] subjectArray; if(natSc){subjectArray = natScSubjects; } else{subjectArray = fLangSubjects;} int hjsToAdd ...
6
public void addInstance(Instance instance) { this.instances.add(instance); }
0
private String secondsToString(int time) { int min = time / 60; int sec = time % 60; if(min<10) { if(sec<10) return "0"+min+":0"+sec; return "0"+min+":"+sec; } if(sec==0) return ""+min+":00"; if(sec<10) return ""+min+":0"+sec; return ""+min+":"+sec; }
4
private static <T> boolean checkIntersection(RuleConstraint<T> ruleA, RuleConstraint<T> ruleB) { if (ruleA == ruleB) { return false; } List<FieldGroup<T>> fieldsA = ruleA.fieldGroups(); List<FieldGroup<T>> fieldsB = ruleB.fieldGroups(); List<FieldGroup<T>> fieldsCopy = new ArrayList<FieldGroup<T>>(ruleA...
7
public static <C> Map<String, Object> pojoToDocument(Object o, Class<C> clazz) { Map<String, Object> map = new HashMap<String, Object>(); Class<? extends Object> rtCls = o.getClass(); Field[] fields = rtCls.getDeclaredFields(); try { for (int i = 0; i < fields.length; i++) { Field f = fields[i]; St...
8
public static boolean WalkToAndClick(String action, final int... id) { SceneObject o = SceneEntities.getNearest(portals); if(o == null) return false; if(o.isOnScreen()) { return o.interact(action); } else Walking.walk(o); return false; }
2
private void appendData(String type) { switch(type) { case "województwo": provinces.add(currentRow); break; case "powiat": case "miasto na prawach powiatu": case "miasto stołeczne, na prawach powiatu": d...
4
public void reduce(IntWritable key, Iterable<EntityData> values, Context context) throws IOException, InterruptedException { IntWritable outputKey = new IntWritable(); EntityPairData outputValue = new EntityPairData(); // FloatWritable outputValue = new FloatWritable(); Map<Integer, String> m = new HashMap<...
8
@SuppressWarnings("deprecation") @EventHandler public void handleItemPurchase(InventoryClickEvent event) { if (event.getClick() == ClickType.LEFT) { Player player = (Player) event.getWhoClicked(); Inventory inventory = event.getInventory(); Cuboid cuboid = Cuboid.getCuboid(player.getLocation()); ...
6
private void printQuadranten(int eersteQuadrant, int derdeQuadrant) { //Print regel 1 for (int quadrantNummer = eersteQuadrant; quadrantNummer <= derdeQuadrant; quadrantNummer++) { quadranten[quadrantNummer].printVakken(0, 2); if ((quadrantNummer + 1) % 3 != 0) System.out.print("...
6
@Override public void caseAFormalrest(AFormalrest node) { for(int i=0;i<indent;i++) System.out.print(" "); indent++; System.out.println("(FormalRest"); inAFormalrest(node); if(node.getComma() != null) { node.getComma().apply(this); } if(no...
5
public LinkedList<Token> analyse(String whole) { /* Each key in both the operand and operator hashmaps will be used as a delimiter to split the remaining strings in the LinkedList. Then the delimeter itself is inserted as a Token between each pair of strings, preserving the original order. */ LinkedL...
9
@Override public double timeToReach(Node startNode, Node endNode, Message msg) { double dist = startNode.getPosition().distanceTo(endNode.getPosition()); /* Link rate | time arrive mSec | dist * ---------------------------------------------------- * 11 | 2542 | 399 * 5.5 | 3673 | 531 * 2 |...
7
public void createBrowseTree() { try { String[][] genres = new Shoutcast2().getGenres(); //add an option to search for free values in Shoutcast root.add(new DefaultMutableTreeNode(trans.getObject("GetGenres.search")) ); //create for every node with their leaves for(int i=0; i < genre...
4
public void check(MOB mob, Armor A) { if(!layered){ checked=true; disabled=false;} if(A.amWearingAt(Wearable.IN_INVENTORY)) { checked=false; return; } if(checked) return; Item I=null; disabled=false; for(int i=0;i<mob.numItems();i++) { I=mob.getItem(i); if((I instanceof Armor) &&(!I...
9
private String useImageVariables(String s) { int n = view.getNumberOfInstances(ImageComponent.class); if (n <= 0) return s; int lb = s.indexOf("%image["); int rb = s.indexOf("].", lb); int lb0 = -1; String v; int i; ImageComponent ic; while (lb != -1 && rb != -1) { v = s.substring(lb + 7, rb); ...
7
private static String trim(String s) { return s == null ? null : s.trim(); }
1
public Direction opposite() { switch(this) { case NORTH: return SOUTH; case NORTHWEST: return SOUTHEAST; case WEST: return EAST; case SOUTHWEST: return NORTHEAST; case SOUTH: return NORTH; case SOUTHEAST: return NORTHWEST; case EAST: return WEST; case NORTHEAST: return SOUTHWES...
8
public boolean verifyAccount(String userName, String password) { try { Connection conn = openConnection(); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("select * from " + DB_ACCOUNT_TABLE + " where username = \"" + userName + "\" and password = \"" + password + "\";"); ...
2
public static int wordCount(String s) { s = StringDemo.allTrim(s); if (s.length() == 0) { return 0; } int count = 0; for (int i = 0; i < s.length(); i++) { if (i == (s.length() - 1)) { count++; } else if (s.charAt(i) == ' ') { if (s.charAt(i + 1) == ' ') { continue; } count++...
5
public void collideHorizontal() { setVelocityX(0); }
0
public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int iInputNum=0; int iMapFlag=0; String sInputStr; String sOutputStr=""; while((iInputNum=sc.nextInt())!=0){ TreeMap<String,Integer> map=new TreeMap<String,Integer>(); int iMax=1; for...
4
public void setListener(PackageListener listener) { this.listener = listener; // This does not work well: the two separate // lists do not preserve the order in which // messages arrive. while(!statusBuffer.isEmpty()) { listener.addInput(statusBuffer.pop()); } while(!messageBuffer.isEmpty()) { list...
2
private double[][] getLay(double lay[][], int numberLay) { for (int i = 0; i < HEIGHT; i++) { for (int j = 0; j < HEIGHT; j++) { lay[i][j] = yCbCr[i][j][numberLay]; } } return lay; }
2
private Halfedge getHash(int b) { Halfedge halfEdge; if (b < 0 || b >= _hashsize) { return null; } halfEdge = _hash.get(b); if (halfEdge != null && halfEdge.edge == Edge.DELETED) { /* Hash table points to deleted halfedge. Patch as necessary. */ ...
4
private EditorMap erstelleEditorMap(Raum[][] raumArray) { EditorMap result = new EditorMap(raumArray.length, raumArray[0].length); GridButton[][] buttons = result.getButtonArray(); for(int y = 0; y < raumArray[0].length; ++y) { for(int x = 0; x < raumArray.length; ++x) { Raum raum = raumArray[x][y];...
3
public void interactWithCastle() { Hero hero = getActivePlayer().getActiveHero(); System.out.println("interact with castle "+hero+", "+hero.isInCastle()); if (hero.isInCastle()) { WorldMapObject castle = wmap.getObjectAt(hero.getX(), hero.getY()); castle.stand(hero, getActivePlayer()); } }
1
public CipherDataType createCipherDataType() { return new CipherDataType(); }
0
private void analyze(Component root){ SingleTreeModel treeModel = new SingleTreeModel(root); treeModels.add(treeModel); if (treeModels.size() == 1){ oldComboBox.setSelectedIndex(0); }else if (treeModels.size() == 2){ oldComboBox.setSelectedIndex(-1); o...
4
public static List<ActionCom> selectActionCom() throws SQLException { String query = null; List<ActionCom> Action = new ArrayList<ActionCom>(); ResultSet resultat; try { query = "SELECT * from ACTION_COM "; PreparedStatement pStatement = (PreparedStatement) Conn...
2
private void activity_submit_buttonActionPerformed( java.awt.event.ActionEvent evt) {// GEN-FIRST:event_activity_submit_buttonActionPerformed // public Activity(String n, String sol, String lang, boolean p, boolean g) boolean prog; boolean group; if(activity_type_combo.getSelectedItem().toString().equalsIgnore...
3
private boolean isWin(){ for (int i = 0; i < model.getField().size; i++) { if(isColWin(i)) return true; if(isLineWin(i)) return true; } if(isCrossWin()) return true; if(turn < MAX_TURNS) return false; else return true; }
5
private void zoomAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zoomAllButtonActionPerformed int minX = Integer.MAX_VALUE; int minY = Integer.MAX_VALUE; int maxX = 0; int maxY = 0; Element minEX = null; Element minEY = null; Element ma...
8
public static String limitToTen(String pastPrices) { // TODO Auto-generated method stub if (pastPrices.contains("Split")) System.out.println("**S-->" + pastPrices); if (pastPrices.equals("HISTORIC")) return "#_#_#_#_#_#_#_#_#@#_#_#_#_#_#_#_#_#@#_#_#_#_#_#_#_#_#@#_#_#_#_#_#_#_#_#@#_#_#_#_#_#_#_#_#@#_#_#_#_#_...
9
@Override public void dispose() { if (!mIsClosed) { try { saveBounds(); super.dispose(); } catch (Exception ex) { // Necessary, since the AWT appears to sometimes spuriously try // to call Container.removeNotify() more than once on itself. } mIsClosed = true; } }
2
public Vector<Identifier> getMultiKey(Identifier identifier) { Vector<Identifier> hash = new Vector<Identifier>(); Vector<Identifier> one = new Vector<Identifier>(); one.add(identifier); for (Entry<Identifier, HashSet<Vector<Identifier> > > ii : rules.entrySet() ){ ...
3
@Override public Command planNextMove(Info info) { //List<InfoDetail> seznamGranatu = info.getGrenades(); //udaje meho tanku int tanX = info.getX(); int tanY = info.getY(); int tanDir = info.getDirection(); //projizdim seznam granatu ...
7
static private int jjMoveStringLiteralDfa5_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(3, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(4, active0); return 5; } switch(curChar) { cas...
8
private double arbitrary (double n) { if ( n <= 10 && n < d) { return 0; } else if ( n <= 10 ) { return 1; } double result; int first = getFirstDigit (n); // We don't want the actual log, we want the log of the highest power of 10 lower // than this number; casting to an int drops the decimal part which a...
6
public void handleKeyRelease(int value) { switch (value) { case MinuetoKeyboard.KEY_UP: this.keyUp = false; break; case MinuetoKeyboard.KEY_LEFT: this.keyLeft = false; break; case MinuetoKeyboard.KEY_RIGHT: this.keyRight = false; break; case MinuetoKeyboard.KEY_DOWN: this.ke...
4
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof LabeledInstance)) return false; final LabeledInstance labeledInstance = (LabeledInstance) o; if (instance != null ? !instance.equals(labeledInstance.instance) : labeledInstance.instance != null) return false; if (labe...
6
public final EsperParser.if__return if_() throws RecognitionException { EsperParser.if__return retval = new EsperParser.if__return(); retval.start = input.LT(1); Object root_0 = null; Token IF31=null; EsperParser.condition_return condition32 =null; EsperParser.stateme...
1
private static void defineSeleccion(String seleccion) { if (seleccion.equals(opcionesMenu[0])){ Path path = Paths.get(textfile); writeDataInFile(path, 0); showMenu(); }else if (seleccion.equals(opcionesMenu[1])){ Path path = Paths.get(bytefile); ...
4
public String getDepotlegal() { return depotlegal; }
0
public boolean equals(Object other) { if (other instanceof Pair) { Pair otherPair = (Pair) other; return (( this.first == otherPair.first || ( this.first != null && otherPair.first != null && this.first.equals(otherPair.first))) && ( this.second == otherPair.second || ...
8
protected static void check_unused() { terminal term; non_terminal nt; /* check for unused terminals */ for (Enumeration t = terminal.all(); t.hasMoreElements(); ) { term = (terminal)t.nextElement(); /* don't issue a message for EOF */ if (term == terminal.EOF) continue; /* o...
8
public ArrayList<Card> getCreatures() { ArrayList<Card> creatures = new ArrayList<Card>(); for (Card c : this.permanents) { if (c.getTypes().contains("Creature")) { creatures.add(c); } } return creatures; }
2
private void deselectToolbarButton(JToggleButton sauf){ for(Component comp: toolbar.getComponents()){ if(comp instanceof JToggleButton && comp!=sauf){ ((JToggleButton) comp).setSelected(false); } } sauf.setSelected(true); }
3
@Override public void characters(char[] ch, int start, int length) throws SAXException { if (ch != null) { String s = new String(ch, start, length).trim(); if (product == null || s.length() < 1) { return; } else { if (qName.equalsIgnoreCase(ProductsConstants.PROVIDER.getContent())) ...
9
public static boolean addComboData(String aCombo) { File f = new File(FILE_NAME); if (!f.exists()) { try { if (!f.createNewFile()) { return false; } } catch (IOException ex) { Logger.getLogger(ComboElemPersistenc...
5
@Override public void logicUpdate(GameTime gameTime) { for (Entity entity : entityList) { processEntity(entity, gameTime.getElapsedTimeMilli()); } }
1
@Override public void mouseClicked(MouseEvent arg0) { // int x = arg0.getX()/currentMap.getWidth(); // int y = arg0.getY()/currentMap.getHeight(); int x = arg0.getX() / TILE_DIMENSION; int y = arg0.getY() / TILE_DIMENSION; if (theGame.canPlaceTower(x, y) && theGame.getIsPlacingTower()) { theGame.c...
9
@Override protected void createForm() { RadarGraphPrimitive prim; prim = new RadarGraphPrimitive(x-widthDest, y, 8, 8, 0, 0, "Select"); primitives.put(prim.getName(), prim); for (MassAttractObject3D obj : world.getSystem()) { prim = new RadarGraphPrimitive(x-widthDest, y,...
1
public void attachClean(Record instance) { log.debug("attaching clean Record instance"); try { Session session = getSession(); Transaction tr = session.beginTransaction(); session.lock(instance, LockMode.NONE); tr.commit(); session.flush(); session.close(); log.debug("attach successful"); }...
1
public Boolean isEmpty() { return (head == null) ? true : false; }
1
private void fixGenome() { boolean[] digitMap = new boolean[DIGIT_COUNT]; for (int i = 0; i < DIGIT_COUNT; ++i) { digitMap[numbers[i]] = true; } int unusedDigit = 9; boolean[] collisionMap = new boolean[DIGIT_COUNT]; for (int i = 0; i < DIGIT_COUNT; +...
4
public void controllerButtonPressed(int controller, int button) { if (button == Controls.GAMEPAD_START) { for (Player p : players) { if (!p.getControls().isUseGamepad()) { for (Player pr : players) if (pr.getControls().getGamepadNumber() == controller) return; ...
5
@Override public boolean isNotArcherFortify(){ if(type.equals(GameConstants.ARCHER) && this.getDefensiveStrength() == defenseStrength) { setIsNotFortify(true); return isFortify; } else if (type.equals(GameConstants.ARCHER) && this.getDefensiveStrength() != defenseStrength) { return isFortify; } else...
4
Incrementable getCallbackReference() { return new Closure(); }
0
private void findCutOff(double[] pos, double[] neg){ int[] pOrder = Utils.sort(pos), nOrder = Utils.sort(neg); /* System.err.println("\n\n???Positive: "); for(int t=0; t<pOrder.length; t++) System.err.print(t+":"+Utils.doubleToString(pos[pOrder[t]],0,2)+" "); System.err.println...
9
public Object createProxy(Class<?> type) { Object proxy = null; try { final javassist.util.proxy.ProxyFactory pf = new javassist.util.proxy.ProxyFactory(); pf.setSuperclass(type); final MethodHandler methodHandler = createMethodHandler(); proxy = pf.create(new Class<?>[0]...
7
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try { int numeroDelUsuario = Integer.valueOf(campoNumero.getText()); if (numAleatorio < numeroDelUsuario) { campoPista.setText("El número es menor que " + nume...
3
protected void setAll(PreparedStatement pstmt, int i, Field field) throws SQLException { double d; try { switch (field.getTypeFormat()) { case STRING: pstmt.setString(i, field.getBuffer()); break; case INTEGER: d = Double.parseDouble(field.getBuffer()) * field.getCoeff...
9
public static void remove(SnmpAgent snmpAgent) throws IOException, InterruptedException { snmpAgents.remove(snmpAgent).getIP(); activeAgents--; if (activeAgents == 0) { snmp.close(); t.join(); } }
1
public void setZeroes(int[][] matrix) { HashSet<Integer> col = new HashSet<Integer>(); HashSet<Integer> row = new HashSet<Integer>(); if (matrix.length == 0) return; if (matrix[0].length == 0) return; for (int i = 0; i < matrix.length; i++) { for (in...
9
public static String returnAsyncAPICallResult(int id, boolean remove) { if(remove) return asyncResults.remove(id); return asyncResults.get(id); }
1
public Shader(String vertPath, String fragPath) { int vertShader = 0; int fragShader = 0; canShade = false; try { vertShader = createShader(vertPath, ARBVertexShader.GL_VERTEX_SHADER_ARB); fragShader = createShader(fragPath, ARBFragmentShader.GL_FRAGMENT_SHADER_ARB); } catch (Exception e) { ...
6
public int loggingCheck(String nr_lekarza, String password) { String hashpass = null; String pass2 = encode.encode(password); int status; try { String pyt = "SELECT * from lekarze where nr_lekarza=?"; PreparedStatement check = getConn().prepareStatement(pyt); ...
4
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { String funcion = request.getParameter("funcion"); ...
8
public final Color getPolygonColor() { return polygonColor; }
0
public boolean isValidMaterial(Material m) { if (!m.isBlock()) return false; Iterator<Material> i = DisallowedTypes.iterator(); while (i.hasNext()) { if (i.next().equals(m)) return false; } return true; }
3
@Override public void addAppender(LoggerAppender appender) throws Exception { doAddAppender(appender); }
0
protected int handleInput(Automaton automaton, AutomatonSimulator simulator, Configuration[] configs, Object initialInput, List associatedConfigurations) { JFrame frame = Universe.frameForEnvironment(getEnvironment()); // How many configurations have we had? int numberGenerated = 0; // When should the nex...
6
public static void insertStation(Station station) { PreparedStatement stat; try { stat = ConnexionDB.getConnection().prepareStatement("insert into station (serialNumber, etat, latitude, longitude) values (?,?,?,?)"); stat.setString(1, station.getSerialNumber()); stat...
2
@Override public void writePortable(PortableWriter writer) throws IOException { if(dateProperty != null) { writer.writeLong("dateProperty", dateProperty.getTime()); } if(intProperty != null) { writer.writeInt("intProperty", intProperty); } if(longPrope...
9
public static JSONObject toJSONObject(String string) throws JSONException { JSONObject jo = new JSONObject(); JSONTokener x = new JSONTokener(string); while (x.more()) { String name = Cookie.unescape(x.nextTo('=')); x.next('='); jo.put(name, Cookie.unescape(x....
1
@Override public final void setGameBoard() { gameBoard.setLayout(new GridLayout(PlayerInterface.LETTERS.length, PlayerInterface.NUMBERS.length)); grid = new JButton[PlayerInterface.LETTERS.length][PlayerInterface.NUMBERS.length]; for (int j = 0; j < PlayerInterface.LETTERS.length; j++) { for (int i = 0; ...
7
public static String dateFormatFix(String str) { if (str.indexOf("M") != -1 && str.indexOf("MM") == -1 && str.indexOf("MMM") == -1) { str = str.replaceAll("M", "MM"); } if (str.indexOf("d") != -1 && str.indexOf("dd") == -1 && str.indexOf("ddd") == -1) { str = str.replaceAll("d", "dd"); } if (str.indexOf...
9
public void award_bonus(BigInteger threshold, BigInteger bonus) { if (getBalance().compareTo(threshold) >= 0) deposit(bonus); }
1
public String getNameByUID(Statement statement,String UID)//根据用户名获取邮箱 { String result = null; sql = "select name from Users where UID = '" + UID +"'"; try { ResultSet rs = statement.executeQuery(sql); while (rs.next()) { result = rs.getString("name"); } } catch (SQLException e) { Syste...
2
@Override public void receive(Message m){ // Get the process ID from the message int processID = m.getSource(); long time = System.currentTimeMillis(); String[] messageParts = m.getPayload().split(" "); // Get payload information for heartbeat ID and when heartbeat was sent int heartbeatID = Integer...
8
private boolean jj_3R_29() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(29)) { jj_scanpos = xsp; if (jj_scan_token(30)) { jj_scanpos = xsp; if (jj_scan_token(31)) return true; } } return false; }
3