text
stringlengths
14
410k
label
int32
0
9
static public String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String s = Double.toString(d); if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) { ...
7
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { resp.setContentType("text/html"); resp.setCharacterEncoding("utf-8"); setSearchResult(); extendedLinkedHashMap<String, String> elhm = this.searchResult .getRootMap(); resp.getWriter() .printl...
7
public static boolean writeUserSelectedFile() { if (fileDialog == null) fileDialog = new JFileChooser(); fileDialog.setDialogTitle("Select File for Output"); File selectedFile; while (true) { int option = fileDialog.showSaveDialog(null); if (option != ...
8
protected void execute() {}
0
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //Vastaanotetaan käyttäjätunnus jsp-sivulta String username = request.getParameter("username"); System.out.println("Käyttäjätunnus:" + username); //Vastaanotetaan salasana jsp-sivulta String ...
5
public int GetY() { return this.y; }
0
public void easeOpacity(float opacity) { if (opacity <= 0) { opacity = 0; return; } else if (opacity > 1) { opacity = 1; } AWTUtilities.setWindowOpacity(loginDialog, opacity); }
2
private int PNToAscii(String recieved) { // split the recieved code into 2 parts String[] recieveds = new String[] { recieved.substring(0, 8), recieved.substring(8, 16) }; // decode each part and join them to get the result byte StringBuffer decoded = new StringBuffer(); for (String recievedi : ...
4
private void loadComponentsFromXML() { //First Child should be a Desktop Tag if(desktopElement == null) { logger.info("No Desktop in XML"); return; } Element _containerElement = null; //Walk through All Children and Load Them up NodeList _list = deskto...
7
public int characterAt(int at) throws JSONException { int c = get(at); if ((c & 0x80) == 0) { return c; } int character; int c1 = get(at + 1); if ((c1 & 0x80) == 0) { character = ((c & 0x7F) << 7) | c1; if (character > 0x7F) { ...
8
public boolean stem() { int v_1; int v_2; int v_3; int v_4; // (, line 72 // do, line 74 v_1 = cursor; lab0: do { // call mark_regions, line 74 ...
8
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { if (averageGroundLevel < 0) { averageGroundLevel = getAverageGroundLevel(par1World, par3StructureBoundingBox); if (averageGroundLevel < 0) { ...
8
@Override public ArrayList<TCliente> listarClientes() throws Exception { Statement query = null; Connection connection = null; TCliente temp = new TCliente(); ArrayList<TCliente> ret = new ArrayList<TCliente>(); //baja lógica de cliente (solo en la tabla de los genéri...
4
public boolean collide(GameSphere gs){ int newX = (int)(gs.getPosition()[0] + gs.getVelocity()[0]); int newY = (int)(gs.getPosition()[1] + gs.getVelocity()[1]); if(newX < 0 || newX > screen.width || newY < 0 || newY > screen.height) return false; if(levelLayout[newX + newY * screen.width...
5
public static boolean walkToAndClick(String action, int... id) { SceneObject o = SceneEntities.getNearest(id); if (Calculations.distanceTo(o) > 5 && !Players.getLocal().isMoving()) Walking.walk(o); else { if (o != null && o.isOnScreen()) { Mouse.move(o.getCentralPoint(), 30, 50); return (o.interact(...
4
public static void modificaIntervento(String id, String idPaziente, String idInfermiere, String citta, String civico, String cap, String data, String ora, DefaultTableModel tipiIntervento) { //VERIFICA VALIDITA' E CORREZIONE DEI DATI String errLog = ""; errLog += Paziente.verificaCoerenzaID(idPaziente); ...
9
protected void updateCapabilitiesFilter(Capabilities filter) { Instances tempInst; Capabilities filterClass; if (filter == null) { m_ClassifierEditor.setCapabilitiesFilter(new Capabilities(null)); return; } if (!ExplorerDefaults.getInitGenericObjectEditorFilter()) tempInst...
8
@Override public void onDraw(Graphics G, int viewX, int viewY) { if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300) { Graphics2D g2d = (Graphics2D)G; G.setColor(Color.white); G.fillArc((int)X-viewX-1,(int)Y-viewY-1,2,2,0,360); } }
4
public JSettingsPane(final boolean mutable) { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); for (final Parameter p : Parameter.values()) { add(new JParameterPane(p, mutable)); } }
1
public boolean compareTwoStrings(String aString, String anotherString) { int aStringSize = aString.length(); int anotherStringSize = anotherString.length(); if(aStringSize != anotherStringSize) return false; for(int index = 0; index < aStringSize; index++) if(aString.charAt(index) != anotherString.charAt(inde...
3
private void addStamp(CHRMultiTilePanelDecorator decorator){ _stamps.add(decorator); _stampPanel.add(decorator); if(! decorator.isAdded()) { CHRMultiTilePanel stamp = decorator.getTilePanel(); CHRTile tiles[] = stamp.getTiles(); for(int i=0;i<tiles.length;i++)...
6
public void removeAllListeners() { //// Preconditions assert listeners != null : "listeners must not be null"; if (cycAccess.getCycConnection() instanceof CycConnection) { assert cycAccess.getCycLeaseManager().isAlive() : "the CycLeaseManager thread has died because a lease timed-out, errored or was d...
1
public synchronized void increase() { // if(0 != number) //只能在两个线程的时候使用if作为判断,当多个线程(2个以上的时候)会出现异常,例如: // 同时有两个进入等待,来了一个通知,唤醒的线程不知道在等待的过程中发生了什么,却继续了后续的操作,唤醒后应该立即检查判断条件。 while(0 != number) // { //如果number不是0的时候就会进入等待的状态,等待notify try { wait(); } catch (InterruptedException e) { e.printStackTr...
2
@Override public void onMessageNotDelivered(int messageId, int resendMessageId, String message) { System.out.println("Message not delivered: \"" + message + "\" Resending..."); try { conn.resend(resendMessageId, message); } catch (CouldNotSendPacketException e) { System.out.println("Message could not be re...
1
public boolean collision(int xa, int ya, List<Block> blocks) { collision.position.x = x + xa + width / 2; collision.position.y = y + ya + height / 2; for (int i = 0; i < blocks.size(); i++) { Block b = blocks.get(i); if (b == this) continue; if (Box.collides(collision, b.collision)) return true; } re...
3
@Override public FullNameData build(String[] params) { if (params.length != 6) { throw new IllegalArgumentException("You should pass exactly 6 parameters"); } FullNameData data = new FullNameData(); data.setInput(params[0]); data.setExpectedFirstName(params[1].equ...
5
public void start(){ Form form = new Form(/*person*/); while(true){ System.out.println("What do you wana do? \n<1> Fill out Form. \n<2> Search for person. \n<3> Quit."); myChoice = input.nextInt(); if(myChoice == 1){ form.StoreForm(); System.out.println("--------------------------...
4
public double getTotalBalance() { bankLock.lock(); try { double sum = 0; for (double a : accounts) sum += a; return sum; } finally { bankLock.unlock(); } }
1
public KeyDataType getData() { return data; }
0
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Schema other = (Schema) obj; if (name == null) { if (other.name != null) ...
6
private void sendProcessingError(Throwable t, ServletResponse response) { String stackTrace = getStackTrace(t); if (stackTrace != null && !stackTrace.equals("")) { try { response.setContentType("text/html"); PrintStream ps = new PrintStream(response.getOutput...
4
public static String singleOccurance(String s) { char c[] = s.toCharArray(); int count = 0; for (int i = 0; i < c.length; i++) { if (c[i] != ' ') { for (int j = i + 1; j < c.length; j++) { if (c[i] == c[j]) { count++; } else { i = j - 1; break; } } } } System.out...
7
public static int[] rotationArray() { int n = cad.length; Integer[] order = new Integer[n]; for (int i = 0; i < n; i++) order[i] = i; Arrays.sort(order, comp); int[] sa = new int[n]; int[] classes = new int[n]; for (int i = 0; i < n; i++) { sa[i] = order[i]; classes[i] = cad[i]; } for (int le...
9
public void sendPaquets() throws IOException, InterruptedException { long start_time; boolean dropped; System.out.println("[Host] Ready to send paquets."); NATBox.eth_frame pqt; while (Host.RUNNING) { /* Wait until there are paquets to send */ while(Host.pqts.isEmpty()) { } /* Send paqu...
5
@Override public void run() /* The frames of the animation are drawn inside the while loop. */ { long beforeTime, afterTime, timeDiff, sleepTime; long overSleepTime = 0L; int noDelays = 0; long excess = 0L; gameStartTime = System.currentTimeMillis(); beforeTime = gameStartTime; running = true; whi...
6
public void MostarToken() { for (Token token : this.listaToken) { System.out.println(token.getLexema() + " => " + token.getValor_token()); } }
1
public static void addCommissions( Actor actor, Venue makes, Choice choice ) { final boolean hasCommission = actor.mind.hasToDo(Commission.class) ; if (hasCommission) return ; // Check to see if this venue makes the actor's device type, and if an // upgrade/repair to said device is needed. ...
9
private Expression renameJikesSuper(Expression expr, MethodAnalyzer methodAna, int firstOuterSlot, int firstParamSlot) { if (expr instanceof LocalLoadOperator) { LocalLoadOperator llop = (LocalLoadOperator) expr; int slot = llop.getLocalInfo().getSlot(); if (slot >= firstOuterSlot && slot < firstParamSlot...
9
public void writeAllMSISDNData(boolean writeAlsoInHex) { for (int i = 1; i <= DatabaseOfEF.EF_MSISDN.getNumberOfEntries(); i++) { if (!getters.getMSISDNString(i, false).isEmpty()) { if (writeAlsoInHex) { System.out.println("MSISDN n." + i + " in hex: " + getters.g...
3
protected void setPermissionUDF(SessionContext sc, String newUDFId, String clientUdfId) throws GranException { // скопировать права с поля Клиент String incidentsRoot = KernelManager.getTask().findByNumber("50"); Set<SecuredPrstatusBean> prstatusSet = new TreeSet<SecuredPrstatusBean>...
6
public static void TypeStatistics(String directoryPath) { File directory = new File(directoryPath); File[] files = directory.listFiles(); long[] typeCounts = new long[32]; for (int i = 0; i < typeCounts.length; i++) { typeCounts[i] = 0; } System.out.println("R...
9
private Constant newString(final String value) { key2.set('S', value, null, null); Constant result = get(key2); if (result == null) { newUTF8(value); result = new Constant(key2); put(result); } return result; }
1
@Override public Object getValueAt(int rowIndex, int columnIndex) { Object return_object = null; switch(columnIndex){ case 0: return_object = members.get(rowIndex).getName(); break; case 1: return_object = members.get(rowIndex).getSurname(); break; case 2: return_object = me...
7
public void addEdge(Vertex<T> source, Vertex<T> destination, Integer weight) { if (!vertexes.containsKey(source)) { throw new RuntimeException("There is no vertex in graph " + source); } if (!vertexes.containsKey(destination)) { throw new RuntimeException("There is no ...
5
public boolean getOnline(){ return IsOnline; }
0
public void actionPerformed(ActionEvent arg0) { Object[] inputDetails = new Object[16]; int counter = 0; for(int i = 0; i < comps.length; i++){ if(comps[i].getClass() == JTextField.class){ JTextField compTemp = (JTextField) comps[i]; inputDetails[counter] = compTemp.getText(); counter++; } i...
8
private void addCampo(Attributes attr) { try { ArrayList<Tabela> tbl = bd.get(bd.size() - 1).getTabela(); tbl.get(tbl.size() - 1).addCampo(attr); } catch (Exception e) { System.out.println("Erro ler tag \'campo\': " + e.getMessage()); } }
1
public double getPropagationEnergy(int index, double energy_min, double energy_max) { System.out.println("ENTERING BISECTION..."); double energy = (energy_min + energy_max) / 2; // double dprop = getPropagationValueLogDerivative(index, energy); double dprop = getPropagationValueDerivativ...
4
private static String getNextInputToken (boolean skip) { final String delimiters = " \t\n\r\f"; String token = null; try { if (reader == null) reader = new StringTokenizer (in.readLine(), delimiters, true); while (token == null || ...
6
public void testJulianYearZero() { DateTime dt = new DateTime(JulianChronology.getInstanceUTC()); try { dt.year().setCopy(0); fail(); } catch (IllegalFieldValueException e) { assertEquals(DateTimeFieldType.year(), e.getDateTimeFieldType()); assertE...
1
public static void updateCommandeFounisseur(int idcommandefournisseur,int idutilisateur, String referencefournisseur, Date datecommandefournisseur, Float remisefournisseur ) throws SQLException { String query = ""; try { query = " UPDATE COMMANDE_FOURNISSEUR SET ID_UTILISATEUR=?,COMFOUREF=...
1
public void handleResponse(JSONObject jo) { try { String op = jo.getString(Field.OPERATION_TYPE); if (op.equals(OperationTypes.COMM_RESP)) { boolean succeed = jo.getBoolean(Field.SUCCEED); String msg = jo.getString(Field.MESSAGE); if (succeed) { out.println("Succeed!"); } else { out.pr...
9
public static int som(int k) { if(k == 0) return 0; int ksom = 1; while(k > 1) { ksom = ksom + k; k = k - 1; } return ksom; }
2
public void paint(Graphics paramGraphics) { if (isShowing()) { int i = getComponentCount(); Component[] arrayOfComponent = getComponents(); Rectangle localRectangle1 = paramGraphics.getClipBounds(); for (int j = i - 1; j >= 0; j--) { Component localComponent = arrayOfComp...
7
public static void showRecognizeDialog(Component c) throws HeadlessException { HashMap<String, ArrayList<String>> shapeCoords = App.ge.getShapeCoordString(); StringBuilder sb = new StringBuilder("Recognized:\n"); if (shapeCoords.get(Shapes.POLY) != null) { sb.append(" ").append(sha...
3
protected void SendQueuedCommand() { if(!portOpened || waitingForCue) return; if(commandQueue.size()==0) { notifyListeners(); return; } String command; try { command=commandQueue.remove(0)+";"; Log(command+NL); serialPort.writeBytes(command.getBytes()); waitingForCue=true; ...
5
@Override public Iterable<Key> keys() { LinkedList<Key> keys = new LinkedList<Key>(); for (int i = 0; i < M; i++) keys.addAll((Collection<? extends Key>) st[i].keys()); return keys; }
2
public void cleanMinRowPedinaTab(){ int max=0; //Recupero la riga dei pezzi più avanzati for(int i=0;i<desmosse.length;i++) if(desmosse[i]!=null && desmosse[i].getMossa().getStartPos().getRow()>max) max = desmosse[i].getMossa().getStartPos().getRow(); System.out.println("Il massimo valore della rig...
7
private void generateElements(PrintStream out) { for (State state : repository.states()) { if(state.isStart()) { generateStartState(out, state); } else if(state.isEnd()) { generateEndState(out, state); } else { ...
4
double makeTotalPredict(Match match) { double predict = 0; Team homeTeam = match.homeTeam; Team awayTeam = match.awayTeam; double homeAttack = getAttack(match, homeTeam); double homeDefence = getDefence(match, homeTeam); double awayAttack = getAttack(match, awayTeam); ...
4
public byte getSREG() { int value = 0; if (I) value |= LegacyState.SREG_I_MASK; if (T) value |= LegacyState.SREG_T_MASK; if (H) value |= LegacyState.SREG_H_MASK; if (S) value |= LegacyState.SREG_S_MASK; if (V) value |= LegacyState.SREG_V_MASK; ...
8
public Render(int height, int width){ MAP_HEIGHT = Base.level.height; MAP_WIDTH = Base.level.width; xOffset = ((Base.level.width * 32) / 2) - (width / 2); yOffset = ((Base.level.height * 32) / 2) - (height / 2); this.height = height; this.width = width; pixels = new int[height * width]; }
0
public void jogada(Peca peca, int pos, int num, int id) { //0 - dir, 1 - esq if (turno == 0) { pontaDir = pontaEsq = peca.getDir(); pos = 2; } else { if (pos == 0) { if (peca.getDir() == pontaDir) { pontaDir = peca.getEsq(); ...
9
private Corner getCornerBasedOnDirection() { int bleh = random1.nextInt(100); if(direction == Direction.NORTH) { if (bleh < 50) return Corner.NE; else return Corner.NW; } else if(direction == Direction.SOUTH) { if(bleh < 50) return Corner.SE; else return Corner.SW; } else if...
7
public List<UUID> findPostUUIDsByTimeRange( DateTime start, DateTime end ) { // this method assumes the number of keys for the range is "not too big" so as to blow // out thrift's frame buffer or cause cassandra to take too long and "time out" DateTime firstRow = calculatePostTimeGranularity(sta...
8
public void testGetInstantConverterBadMultipleMatches() { InstantConverter c = new InstantConverter() { public long getInstantMillis(Object object, Chronology chrono) {return 0;} public Chronology getChronology(Object object, DateTimeZone zone) {return null;} public Chronolog...
1
public void drawTime(Graphics g){ int time_sec, time_min, time_hour; //System.out.println("current time: " + (new SimpleDateFormat("HH:mm:ss")).format(calender.getTime())); time_sec = Integer.parseInt((new SimpleDateFormat("ss")).format(calender.getTime())); time_min = Integer.parseInt((new SimpleDateFormat("mm...
3
public ArrayList<Item> alSort(ArrayList<Item> al) { for (int i=0;i<al.size();i++) { for (int e=0;e<al.size()-i-1;e++) { if (al.get(e).data2>al.get(e+1).data2) { swap(al,e,e+1); } } } return al; }
3
private void loadLevel(String level){ Scanner input = null; File f = new File(level); try{ input = new Scanner(f); }catch(FileNotFoundException e){ e.printStackTrace(); } width = Integer.parseInt(input.next()); height = Integer.parseInt(input.next()); String[] s = new String[height * width]; ...
4
public void onPickupFromSlot(ItemStack par1ItemStack) { func_75208_c(par1ItemStack); MerchantRecipe merchantrecipe = field_75233_a.func_70468_h(); if (merchantrecipe != null) { ItemStack itemstack = field_75233_a.getStackInSlot(0); ItemStack itemstack1 = fiel...
7
public void fetchFile(String fileName) throws IOException { if(Arrays.asList(rootFolder.list()).contains(fileName)) { throw new FileAlreadyExistsException(fileName); } DatagramSocket clientSocket = new DatagramSocket(); Sender sender = new Sender(clientSocket, GlobalConfig.TFTP_CONTROL_PORT, serverAddr...
2
public static int findGCD(int x, int y) { if(x == 0) { return y; } else if(y == 0) { return x; } else if(((x & 1) == 0) && ((y & 1) == 0)) { // both x and y are even return (findGCD(x >> 1, y >> 1) << 1); } else if(((x & 1) == 0) && ((y & 1) != 0)) { /...
9
public Behaviour getNextStep() { if (onPoint == null) return null ; final World world = actor.world() ; Target stop = onPoint ; if (verbose) I.sayAbout(actor, "Goes: "+onPoint+", post time: "+postTime) ; // // TODO: You need to add an intercept/attack behaviour for enemies near // th...
9
public void onButtonsEvent(WiimoteButtonsEvent wbe) { if(wbe.isButtonLeftPressed()) { isLeft = true; owner.getMainController().getZeppelinController().engineAstate(MotorA.LEFT); } else { isLeft = false; owner.getMainController().getZeppelinController().eng...
6
public String encode(String password) { try { MessageDigest md = MessageDigest.getInstance("SHA-256"); byte[] hashed = md.digest(password.getBytes()); StringBuilder sb = new StringBuilder(); for(int i=0; i< hashed.length ;i++) { sb.append(Integer.toString((hashed[i] & 0xff) + 0...
2
private Object readValue() throws JSONException { switch (read(2)) { case 0: return new Integer(read(!bit() ? 4 : !bit() ? 7 : 14)); case 1: byte[] bytes = new byte[256]; int length = 0; while (true) { int c = read(4); ...
9
* @return Cons */ public Cons difference(Cons otherlist) { { Cons self = this; if ((otherlist == null) || (otherlist == Stella.NIL)) { return (Cons.copyConsList(self)); } { Cons diff = Stella.NIL; { Stella_Object i = null; Cons iter000 = self; C...
6
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { MainView window = new MainView(); window.frmProgrammingContestSystem.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
1
@Override public void repaint(TextGraphics graphics) { if(hasFocus()) graphics.applyTheme(graphics.getTheme().getDefinition(Theme.Category.BUTTON_ACTIVE)); else graphics.applyTheme(graphics.getTheme().getDefinition(Theme.Category.BUTTON_INACTIVE)); Termin...
3
public V put(int key, V value) { if (entrycnt == threshold) { capacity <<= 1; // double the capacity allocateBuckets(); } final int bktid = getBucket(key); int[] bucket = keytbl[bktid]; final int lmt = (bucket == null ? 1 : bucket[0] + 1); int slot = 1; if (bucket == null) { // this bucket doe...
9
public Grammar(BufferedReader in) throws IOException { Pattern linePattern = Pattern.compile("^\\s*(\\S+)\\s*-*>\\s*(.*\\S+)\\s*$"); while (in.ready()) { String line = in.readLine(); Matcher matcher = linePattern.matcher(line); if (!matcher.matches()) throw new RuntimeException("Bad ...
7
public ArrayList<Vector2> getOpaqueTiles(){ ArrayList<Vector2> result = new ArrayList<Vector2>(); for(int y = 0; y < worldHeight; y++){ for(int x = 0; x < worldWidth; x++){ Tile tile = Tile.getTileById(mapData.get((y * worldHeight) + x)); if(tile.isOpaque){ result.add(new Vector2(x * tileSiz...
3
@Override public void setParametersOn(PreparedStatement statement) throws SQLException { logger.info("Setting INSERT parameters on prepared statement ..."); int index = 0; Object[] valueSet = null; for(Entry<Integer, Object[]> entry : getParameters()) { index = entry.getKey(); valueSet = entry.getValue()...
4
public static OperatingSystem getCurrentPlatform() { String osName = System.getProperty("os.name").toLowerCase(); for (OperatingSystem os : values()) { for (String alias : os.getAliases()) { if (osName.contains(alias)) return os; } } return UNKNOWN; }
3
public ItemPanel(final Item i) { super(); ImagePanel picture = new ImagePanel(i.getImage(), 120, 120); JLabel title = new JLabel("<html><h3>" + i.getTitle() + "</h3></html>"); JLabel bid = new JLabel(i.getHighestBid().formattedWithName()); JLabel history = new JLabel("<html><font color=\"#000099\"><u>View ...
3
public void keydown(KeyEvent ev) { setmods(ev); if (keygrab == null) { if (!root.keydown(ev)) root.globtype((char) 0, ev); } else { keygrab.keydown(ev); } }
2
public static HttpServletRequest getHttpServletRequest() { return ((ServletRequestAttributes) RequestContextHolder .getRequestAttributes()).getRequest(); }
0
public boolean deleteRoom(String name){ for (Cine movieTheatre : movieTheatres) { if(movieTheatre.getName().equals(name)){ movieTheatres.remove(movieTheatre); return true; } } for (Theatre theatre : theatres) { if(theatre.getNam...
4
public void compareJvmCost() { String rMapperFile = "realMapper.txt"; String rReducerFile = "realReducer.txt"; String realJvmCostDir = baseDir + jobName + "/RealJvmCost/"; String estiJvmCostDir = baseDir + jobName + "/estimatedJvmCost/"; String compJvmCostDir = baseDir + jobName + "/compJvmCost/"; List<...
5
@Test public void block() { Question q = mock(Question.class); // 1ый раз - не дубликат, 2ой раз и больше - дубликат assertFalse(blocker.isDuplicate(q)); for (int i = 0; i < limit; i++) { assertTrue(blocker.isDuplicate(q)); } Question q2 = mock(Question....
1
public Worker(int workerPriority,BlockingQueue<Worker> idleWorkers){ Integer bufferSize = Config.getInt(READ_BUFFER); if(bufferSize == null){ bufferSize = 10; } this.charBuffer = ByteBuffer.allocateDirect(1024 * bufferSize);// 创建读取缓冲区 this.idleWorkers = idleWorkers; handoffBox = new ArrayBlockingQueue...
2
public int getDealCounter(){ return dealCounter; }
0
private Map<QueueType, Team.QueueStat> convertStats(JsonObject statSummaryObject) { JsonArray statsArray = statSummaryObject.getArray("teamStatDetails"); //Might not exist in the response if no games have been played (not sure) if(statsArray == null) return new TreeMap<>(); Map<QueueType, Team.QueueSt...
5
public void largestPrimeFinder(long num) { System.out.println("Starting..."); //goal number is 600851475143 long largestPrime = 0; for (long i = num - 1; i > 1l; i--) { if (num % i == 0) { //First find a factor of the number if (isPrime(i)) { //Then determine if it is prime; if so, you've found t...
3
private int getTokenID(String name) { if (!tokens.contains(name)) tokens.add(name); return tokens.indexOf(name); }
1
public Expression negate() { if ((getType() != Type.tFloat && getType() != Type.tDouble) || getOperatorIndex() <= NOTEQUALS_OP) { setOperatorIndex(getOperatorIndex() ^ 1); return this; } return super.negate(); }
3
public ShellLink setWorkingDir(String s) { if (s == null) header.getLinkFlags().clearHasWorkingDir(); else { header.getLinkFlags().setHasWorkingDir(); s = Paths.get(s).toAbsolutePath().normalize().toString(); } workingDir = s; return this; }
1
@RequestMapping(value = "/room-event-object/{id}", method = RequestMethod.GET) @ResponseBody public RoomEventObjectResponse roomEventObject( @PathVariable(value = "id") final String idStr ) { Boolean success = true; String errorMessage = null; RoomEvent roomEvent = null; ...
1
public void filledRectangle(double x, double y, double halfWidth, double halfHeight) { if (halfWidth < 0) throw new RuntimeException("half width can't be negative"); if (halfHeight < 0) throw new RuntimeException("half height can't be negative"); double xs = scaleX(x); double ys = scale...
4
public void addFiles(File[] files) { clearList(); for (File file : files) { if (file.isDirectory() || file.getName().endsWith(".class")) { if (!file.isHidden()) { addFile(file); } } } }
4