text
stringlengths
14
410k
label
int32
0
9
@Override protected void validateParameters(Map<String, String> parameters) { //mandatory parameters for multi use pipeline if (!parameters.containsKey("globalAmountLimit")) { throw new RuntimeException("globalAmountLimit is missing in parameters."); } //conditio...
7
public static void main(String[] args) throws Exception{ String fileName=args[0]; int jarPost=fileName.indexOf(".jar"); String jarName=fileName.substring(0,jarPost); // String jarName="ciku"; f = new ZipFile(fileName); Enumeration<? extends ZipEntry> en=f.entries(); Scanner checkAll...
8
private void parseEllipsoid(Map<String, String> params, DatumParameters datumParam) { double b = 0; String s; /* * // not supported by PROJ4 s = (String) params.get(Proj4Param.R); if (s != * null) a = Double.parseDouble(s); ...
8
public void alert(String msg){ for (Player p : Bukkit.getOnlinePlayers()) { if (p.hasPermission("hyperpvp.seereports")) { p.sendMessage(msg); } } }
2
public static void main(String[] argument) { try { if (argument.length == 4) { InputStream inputStream = new FileInputStream(argument[0]); OutputStream outputStream = new DeflaterOutputStream(new FileOutputStream(argument[1]), new...
7
private int edmondKarp() { int f = 0; // Det maximala flödet int m, bFlow; Edge v, u, ub; while (true) { // Infinate loop m = BFS(); if (DEBUG_EK) { System.err.println("m: " + m + " path: " + edgeArrayToString(path)); } // When the BFS doesn't find anymore augmenting paths if (m == 0)...
9
public static Set<Node> findMostVisitedNodes(Set<TreeRandForest> ngfForest, int noNodes){ HashMap<Node, Integer> countNode = new HashMap<Node, Integer>(); // map Node to # visits for (TreeRandForest t : ngfForest){ for (Node n : t.features()){ if (countNode.containsKey(n)){ ...
7
@Override public double[] get2DData(int px, int pz, int sx, int sz) { double[] res = new double[sx*sz]; int ind = 0; for (int x = 0; x < sx; x++) for (int z = 0; z < sz; z++) { double xin = (x + px) / xScale; double yin = (z + pz) / zScale; double n0, n1, n2; // Noise contributions...
6
public void notifyStopped(SoundRecord paramSoundRecord, boolean paramBoolean) { if (paramSoundRecord.getSoundListener() != null) { paramSoundRecord.getSoundListener().soundStopped(paramSoundRecord.getName(), paramBoolean ? 0 : this.muted ? 2 : 1); } this.soundRecords.r...
3
public String printCreatures(){ String result = ""; for (int i = 0; i < this.creatures.size(); i++) { Creature tempItem = this.creatures.get(i); if (i == (this.creatures.size() - 1)) { if (tempItem.toString().substring(0, 3).equals("The")) { re...
4
public static RgbImage convertToRgb(HsvImage hsv) { RgbImage rgb = new RgbImage(hsv.getWidth(), hsv.getHeight()); for (int x = 0; x < rgb.getWidth(); x++) { for (int y = 0; y < rgb.getHeight(); y++) { RgbPixel px = convertPixel(hsv, x, y); rgb.setPixel(x, y, RED, px.red); rgb.setPixel(x, y, GREEN, px...
2
@XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "EncryptedKey") public JAXBElement<EncryptedKeyType> createEncryptedKey(EncryptedKeyType value) { return new JAXBElement<EncryptedKeyType>(_EncryptedKey_QNAME, EncryptedKeyType.class, null, value); }
0
public void exportCSV() { try { PrintWriter pw = new PrintWriter("export.csv"); pw.println("\"Step\",\"Server\",\"Application\",\"Links\""); int step = 0; for (int i = 0; i < bpgHistory.getApplicationHistory().get(step).size(); i++) { for (int j = ...
9
private static boolean getKeyUp(int keyCode) { return !getKey(keyCode) && lastKeys[keyCode]; }
1
public ITestRefImpl(ITestParamState initRefParam) { ITestParamState useClassParam = initRefParam.getElement(USE_CLASS); if ( null != useClassParam && null != useClassParam.getValue() ) { try { this.useClass = Class.forName(useClassParam.getValue()); ...
8
public final void setLName(String lname) { if(lname == null || lname.isEmpty()){ throw new IllegalArgumentException(); } this.lName = lname; }
2
private boolean checkIfDFAisComplete() { Transition[] t=automaton.getTransitions(); State[] s=automaton.getStates(); TreeSet <String> reads=new TreeSet<String>(); for (int i=0; i<t.length; i++) { reads.add(t[i].getDescription()); } int count=0; for (int i=0; i<s.length; i++) { Transition[] tt=a...
4
private List<String> retriveData(String projectionLink) throws IOException { List<String> playerData = new ArrayList<String>(); InputStream input = new URL(projectionLink).openStream(); try (BufferedReader br = new BufferedReader(new InputStreamReader(input, "UTF-8"))) { // skips...
3
@Override public int compareTo(Contestant otherC) { // ugly, but works. :) // account for null: if (isNull() && otherC.isNull()) { return 0; } else if (isNull() && !otherC.isNull()) { return -1; } else if (!isNull() && otherC.isNull()) { return 1; } // otherwise both are not null: int resul...
9
public void play(InputStream source) { // use a short, 100ms (1/10th sec) buffer for real-time // change to the sound stream int bufferSize = format.getFrameSize() * Math.round(format.getSampleRate() / 10); byte[] buffer = new byte[bufferSize]; // create a line to play to SourceDataLin...
6
private void fire(Type t, EventObject E) { Object[] listeners = ll.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { ((Listener) listeners[i + 1]).notice(t, E); } }
1
private boolean setAustinMap(String mapName){ Image mapImage = null; ImageIcon imageIcon; boolean hasFile = false; austinSearchPanel.appendText(">> Connecting... \n" + ">> Destination: " + urlStr + " \n"); if (url_status){//If URL connection is available, downloads the image. try { UR...
6
public void setItem(int index, int id, short dam, String title, String action, List<String> lore) throws IllegalArgumentException { String[] acpar = action.split("\\|"); if(acpar.length != 2) return; if(index < 0 || index > 26) throw new IllegalArgumentException("Index is "+(index < 0 ? "too...
5
public int[][] getPixels2i() { int r; int[][] pix = new int[ih][iw]; double[] tem = new double[ih * iw]; double max = 0, temp, re, im; System.out.println("还原图开始"); for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { re = fd[j * w + i].re(); im = fd[j * w + i].im(); temp = (i...
5
@Override public void setupJob(JobContext jobContext) throws IOException { /** * note: we don't really have to do anything here - * MongoDB is one of the few systems that don't require you to * create a database or collection before writing to it * * but in order to ingest a ton of data quickly we...
8
public void pickCode() { codeNum1 = (int) (Math.random()*10); do { codeNum2 = (int) (Math.random()*10); } while (codeNum2==codeNum1); do { codeNum3 = (int) (Math.random()*10); } while ((codeNum3==codeNum1)||(codeNum3==codeNum2)); do { codeNum4 = (int) (Math.random()*10); } while ((codeNum4==codeN...
6
private Move searchStrategy() { Move move = null; double maxCoinsPerMove = 0; for (int x = 0; x < size; x++) { for (int y = 0; y < size; y++) { Point p = board.getPoint(x, y); // Only focus on capturing neutral or opponent coins if (p.owner != id) { ArrayList<Move> moves = movesToDoubl...
9
public String beschrijving() { StringBuilder s = new StringBuilder(); s.append(standaardGegevens()); if (ouders != null) { if(ouders.getOuder1() != null) s.append("; 1e ouder: ").append(ouders.getOuder1().getNaam()); if(ouders.getOuder2() != null) ...
5
public double getValue() { return value; }
0
public void putAll( Map<? extends Character, ? extends Double> map ) { Iterator<? extends Entry<? extends Character,? extends Double>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Character,? extends Double> e = it.next(); thi...
8
String checkPrivCommand (String msg) { Scanner s = new Scanner(msg); String command = s.next(); int tableID = 0; if (s.hasNext(tablePattern)) { tableID = s.nextInt(); } String d = s.next(datePattern); String t = s.next(timePattern); String key = s.next(keyPattern[tableID]); ...
7
public int getLUSLength(){ //Run the LUS computations, if they haven't been done yet if (lus_cache.isEmpty()) getLUS(false); return lus_max_length; }
1
private void addBlockToRed() { debug("Adding block to red"); if (rLoc1.getBlock().getType() == Material.AIR) { rLoc1.getBlock().setType(Material.GOLD_BLOCK); } else if (rLoc2.getBlock().getType() == Material.AIR) { rLoc2.getBlock().setType(Material.GOLD_BLOCK); } ...
4
public void method558(int i, int j) { if(i < 0 || i > versions.length || j < 0 || j > versions[i].length) return; if(versions[i][j] == 0) return; synchronized(nodeSubList) { for(OnDemandData onDemandData = (OnDemandData) nodeSubList.reverseGetFirst(); onDemandData != null; onDemandData = (OnDemandData...
8
public static void deleteVelo(Velo velo) { Statement stat; try { stat = ConnexionDB.getConnection().createStatement(); stat.executeUpdate("delete from velo where id_velo="+ velo.getId_velo()); } catch (SQLException e) { while (e != null) { Sys...
2
public void gatherInformation() { StringBuilder builder = new StringBuilder(); //Append current date String date = new SimpleDateFormat("YYYY-MM-dd").format(new Date()); builder.append("Date="); builder.append(date); builder.append("\n"); if(Main.VERBOSE...
7
@Override public void contextInitialized(ServletContextEvent sce) { logger.info("Initialize JdbcRealm database"); Connection cnn = null; try { if (dataSource == null) { throw new IllegalStateException("DataSource not injected, verify in web.xml that 'metadata-comp...
2
@Override public void tick(int i, int j, int k) { Vector2 buttonPos = new Vector2((float) (pos.x+(dim.x-buttonWidth)*progress),pos.y); if(buttonPos.getColliderWithDim(new Vector2(buttonWidth,dim.y)).isPointInside(new Vector2(i,j)) && Remote2D.hasMouseBeenPressed()) { mouseDown = true; offset = i-buttonPos....
5
private int[] getResList() { Object[] resList = super.getLocalResourceList(); int resourceID[] = null; // if we have any resource if ((resList != null) && (resList.length != 0)) { resourceID = new int[resList.length]; for (int x = 0; x < resList.length; x++) ...
4
@Override public void paint(Graphics g) { // Because of init ordering, this is required to not through null exceptions during init. if (bufferGraphics == null) return; // Get font sizes else if (mainFontMetrics == null) { mainFontMetrics = bufferGraph...
5
public void mousePressed(MouseEvent e) { switch (subMode) { case Constants.EDIT_LUGAR: addPlace(e); break; case Constants.EDIT_TRANS: addTransition(e); break; case Constants.EDIT_LABEL: addMarker(e); break; case Constants.EDIT_ARC: setStartArc(e); break; case Constants.EDIT_MOUSE: ...
8
int insertKeyRehash(double val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look...
9
private void doAesthetics() { setSize(new Dimension(220, 155)); setResizable(false); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setLocationRelativeTo(null); mainPanel.setLayout(new BorderLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10,...
3
@Override public boolean equals(Object other) { if (other instanceof Tuple) { Tuple otherTuple = (Tuple) other; return (( this.first == otherTuple.first || ( this.first != null && otherTuple.first != null && this.first.equals(otherTuple.first))) && ( this.second == otherTuple.second || ...
8
private void merge(int left, int middle1, int middle2, int right) { int leftIndex= left; int rightIndex = middle2; int combIndex= left; int[] combArray= new int[array.length]; // output two subarrays before merging System.out.println( "merge: " + subarray( left, middle1 ) ); System.out.println( " ...
7
public Instances instancesLoader() throws IOException { Instances data = null; data = new Instances(this.fr); this.closeFR(); // Close the file return deleteUselessAtributes(data); }
0
public static boolean checkForPalindrome(String s){ StringBuilder sb = new StringBuilder(s.length()); for(int i = s.length() -1 ; i >=0; i--){ sb.append(s.charAt(i)); } /* * Alternative method : * new StringBuilder(s).reverse().toString(); */ return s.equals(sb.toString()); }
1
private int moverListSolido(List listMovibles){ int vivos = 0; Iterator<Solido> itNave = listMovibles.iterator(); while(itNave.hasNext()){ Solido solido = itNave.next(); //lo movemos y retornamos su salud actual if(solido.move...
2
public static List<Integer> retrieveDoctorFreeSlots(Date date, int doctorID) { DBMinder minder = DBMinder.instance(); ArrayList<Integer> toReturn = new ArrayList<Integer>(); Connection conn = minder.getConnection(); PreparedStatement ps; ResultSet rs; try { //retrieve hours working ...
7
public static Keyword continueParallelStrategiesProofs(ParallelControlFrame pframe, Keyword lastmove) { if (lastmove == Logic.KWD_DOWN) { if (pframe.down != null) { ParallelControlFrame.enterParallelThread(pframe, null); return (Logic.KWD_MOVE_DOWN); } return (ControlFrame.continue...
7
@Test public void testFindStrings_empty() throws Exception { Assert.assertEquals( Arrays.asList(), _xpath.findStrings("//li/text()") ); }
0
private AbstractButton getAbstractButton(ButtonModel bm) { if (getContentType().equals("text/plain")) return null; Component[] c = getComponents(); if (c == null || c.length == 0) return null; Container container = null; JComponent comp = null; for (Component x : c) { if (x instanceof Container) { ...
7
private static void afficherCoursEtudiant() { ArrayList<Etudiant> listeEtudiant = ListeEtudiants.getInstance().getListe(); // Liste des etudiants int i = 0; // Compteur int element; // Nombre lu au clavier representant le numero d'un etudiant Etudiant choix = null; // Etudiant ...
9
private boolean jj_3_28() { if (jj_3R_45()) return true; return false; }
1
public void SetToLastBusStopTicks(int toLastBusStopTicks) { //set the tick time bus got to the last bus stop this.toLastBusStopTicks = toLastBusStopTicks; }
0
public String columnsToGraphviz(Network network) { beginHeader(); { // command: dot -Tpng -Kfdp network.dot -o network.png int pos = 0; for (ColumnNode column : network.columnNodes()) { addHead(column.base, column.size, pos); for (Node node = column.base.top; node != column.base; node = node.top) {...
7
public void testVehiclesRemoved() { TimeServer ts = new TimeServerLinked(); VehicleAcceptor sink = VehicleAcceptorFactory.newSink(ts); Vehicle[] cars = new Vehicle[5]; for (int i = 0; i < cars.length; i++) { cars[i] = VehicleFactory.newCar(ts, sink); sink.accept(cars[i]); } Assert.asser...
1
public War readXML() throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); // Get the DOM Builder DocumentBuilder builder; builder = factory.newDocumentBuilder(); InputStream xml_file = ClassLoader .getSystemResourceAsStr...
4
@Test public void testSimple() throws Exception { final Properties p = new Properties(); p.setProperty("type", "Zero"); final Properties[] configs = new Properties[]{p}; final FilterFactory ff = new FilterFactory(configs); final Filter[] filters = ff.getInstances(new MockConn...
0
public String toString() { String s = ""; if (child1 != null) { s = "(" + child1.toString() + ")"; } s = s + key1; if (child2 != null) { s = s + "(" + child2.toString() + ")"; } else if (keys > 1) { s = s + " "; } if (keys > 1) { s = s + key2; if (child3 !=...
8
private SpriteState createTileState(StateMap stateMap, int add, RawMemoryMap memoryMap, int scene, int frame, int scanLine) { byte[] upperTileData = new byte[16]; byte[] lowerTileData = new byte[16]; byte[] paletteData = new byte[8]; boolean flipHorizontally; boolean flipVertically; boolean objT...
8
public int getInt(Object key) { Number n = get(key); if (n == null) { return (int) 0; } return n.intValue(); }
1
protected final String escapeSlow(String s, int index) { int end = s.length(); // Get a destination buffer and setup some loop variables. char[] dest = DEST_TL.get(); int destIndex = 0; int unescapedChunkStart = 0; while (index < end) { int cp = codePointAt(...
9
public boolean addItem(Item item) { final int oldAmount = (int) amountOf(item) ; if (super.addItem(item)) { final int inc = ((int) amountOf(item)) - oldAmount ; if (venue.inWorld() && inc != 0 && item.type.form != FORM_PROVISION) { String phrase = inc >= 0 ? "+" : "-" ; phrase+=" "+i...
5
@GET @Path("/v2.0/networks/{networkId}") @Produces({MediaType.APPLICATION_JSON, OpenstackNetProxyConstants.TYPE_RDF}) public Response showNetwork(@PathParam("networkId") String networkId, @HeaderParam("Accept") String accept) throws MalformedURLException, IOException{ if (accept.equals(OpenstackNetProxyConstants.T...
1
public static String unescape(String string) { int length = string.length(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; ++i) { char c = string.charAt(i); if (c == '+') { c = ' '; } else if (c == '%' && i + 2 < length) { ...
6
private void createContents(int coordX, int coordY) { timeDiagramsShell = new Shell(getParent(), SWT.BORDER | SWT.RESIZE | SWT.TITLE); timeDiagramsShell.setSize(563, 498); timeDiagramsShell.setMinimumSize(new Point(300, 300)); timeDiagramsShell.setBounds(coordX, coordY, WIDTH, HEIGHT); ...
7
public void sendProbe() throws IOException { DatagramPacket findBroadcast = new DatagramPacket(probeData, probeData.length, broadcastTarget, Config.DISCOVERPORT); sock.send(findBroadcast); }
0
public final void applyProxySettings() { String proxyUrl = Configuration.getProperty("HTTP_PROXY_URL"); if (proxyUrl != null) { System.getProperties().put("http.proxyHost", proxyUrl); } String proxyPort = Configuration.getProperty("HTTP_PROXY_PORT"); if (proxyPort != ...
2
public int countLines(String filename) throws IOException { InputStream is = new BufferedInputStream(new FileInputStream(filename)); try { byte[] c = new byte[1024]; int count = 0; int readChars = 0; boolean empty = true; while ((readChars = is.read(c)) != -1) { ...
5
private void startField(final Attributes attributes) { String attPosition = attributes.getValue("pos").toUpperCase(); tmpField = new Field(); tmpField.setPosition(FieldPosition.valueOf(attPosition)); tmpField.setType(attributes.getValue("type")); if (attributes.getValue("left...
4
public UserDatabase(){ // load login information from file file = new File("data.txt"); try { Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { String username = scanner.next(); String password = scanner.next(); ...
4
private void printObjectDebug(Object ob) { if (ob == null) { log.finer("null object found"); } else if (ob instanceof PObject) { PObject tmp = (PObject) ob; log.finer(tmp.getReference() + " " + tmp.toString()); } else if (ob instanceof Dictionary) { ...
3
private void addAllUniforms(String shaderText) { HashMap<String, ArrayList<GLSLStruct>> structs = findUniformStructs(shaderText); final String UNIFORM_KEYWORD = "uniform"; int uniformStartLocation = shaderText.indexOf(UNIFORM_KEYWORD); while(uniformStartLocation != -1) { if(!(uniformStartLocation != 0 ...
5
public static boolean isStraight(List<Card> cards) { boolean isStraight = true; int startValue = 0; // If the first card is an ACE and the last one a // TWO there might be a "small" straight (ACE, TWO, // THREE, ...), so than start with the second // highest card at index 1 // Avoid null poi...
6
public boolean rankMatch( LinkedHashMap<String, LinkedHashMap<String, String>> humanPropRoot, String correctName1, String correctName2) { if (humanPropRoot.containsKey(correctName1) && humanPropRoot.containsKey(correctName2)) return true; else return false; }
2
public int getSize() { return size; }
0
public CheckResultMessage checkSum4(int i, int j) { int r1 = get(17, 2); int c1 = get(18, 2); int tr1 = get(33, 5); int tc1 = get(34, 5); BigDecimal sum = new BigDecimal(0); if (checkVersion(file).equals("2003")) { for (File f : Main1.files1) { try { in = new FileInputStream(f); hWorkbook =...
9
public void echo(Scanner in, PrintWriter out){ boolean done = false; while (!done && in.hasNextLine()) { String line = in.nextLine(); out.println("Echo: " + line); if (line.trim().equals(Constants.SHUTDOWN_MESSAGE)) done = true; } }
3
public void prettyPrint(){ for(int i = 0; i < x; i++){ for(int j = 0; j < y; j++){ System.out.print(mat[i][j]); System.out.print("\t"); } System.out.println(); } }
2
public ConverterAdapter(ConvertiblePair typeInfo, Converter<?, ?> converter) { this.converter = (Converter<Object, Object>) converter; this.typeInfo = typeInfo; }
2
public void method276(int y, int x) { GroundTile groundTile = groundTiles[0][x][y]; for (int z = 0; z < 3; z++) { GroundTile heightGroundTile = groundTiles[z][x][y] = groundTiles[z + 1][x][y]; if (heightGroundTile != null) { heightGroundTile.anInt1307--; for (int j1 = 0; j1 < heightGroundTile.anInt131...
7
public void testIsBefore_TOD() { TimeOfDay test1 = new TimeOfDay(10, 20, 30, 40); TimeOfDay test1a = new TimeOfDay(10, 20, 30, 40); assertEquals(false, test1.isBefore(test1a)); assertEquals(false, test1a.isBefore(test1)); assertEquals(false, test1.isBefore(test1)); assert...
1
private void onDoneClick() throws IOException { for (ImageMarker marker: cornerAndControlMarkers) { if (marker.getID() == null) { JOptionPane.showMessageDialog(this, "You can't be done until you've " + "labeled every corner and control ...
4
private static void startComboBox() { language.removeAllItems(); language.addItem(model.save.SettingsModel.getLocale().getDisplayLanguage( model.save.SettingsModel.getLocale())); Locale[] l = model.save.SettingsModel.getAllLocales(); for (int a=0; a< l.length; a++){ if (!(l[a]).equals(model.save.Settings...
2
public JSONWriter object() throws JSONException { if (this.mode == 'i') { this.mode = 'o'; } if (this.mode == 'o' || this.mode == 'a') { this.append("{"); this.push(new JSONObject()); this.comma = false; return this; } t...
3
public Tuple<ArrayList<Vertex<T>>, Double> minimalPath( Vertex<T> src, Vertex<T> dest ) { ArrayList<Tuple<Pair<Vertex<T>>,Double>> verticesInPath = new ArrayList<Tuple<Pair<Vertex<T>>, Double>> (); ArrayList<Vertex<T>> visitedVertices = new ArrayList<Vertex<T>> (); final Comparator pathCostCompara...
4
public JTextField getNumberOfPointsTextField() { return numberOfPointsTextField; }
0
public ExameDAO getExame(){ try{ EntityManager em = conecta(); if (em!=null){ String consulta = "SELECT e FROM Exame e WHERE e.idExame="+idExame; //System.out.println(consulta); Query q = em.createQuery(consulta); List<Exame...
3
public static int numPandigital() { int ret = 0; HashSet<Integer> hs = new HashSet<Integer>(); String temp; for (int i = 2; i < 10000; i++) { for (int j = i; j < 10000; j++) { temp = i + "" + j + (i * j); if (temp.length() > 9) { break; } if (temp.length() == 9 && !hs.contains(i * j)) { ...
6
public void endElement(String namespaceURI, String localName, String rawName) throws SAXException { if (rawName.equals("authors")) { publication.addAuthor(content); } else if (rawName.equals("title")) { publication.setTitle(content); } else if (rawName.equals("school")) { publication.setSchool(content...
8
public static void robarFicha(boolean humano){ if (Domino.listaFicha.size()!=0){ int n = (int) Math.floor(Math.random() * Domino.listaFicha.size()); // int cabeza = this.listaFicha.get(n).getCabeza(); // int cola = this.listaFicha.get(n).getCola(); // this.listaFicha...
2
private boolean write (Pipe pipe_, Msg msg_) { if (!pipe_.write (msg_)) { Utils.swap(pipes, pipes.indexOf (pipe_), matching - 1); matching--; Utils.swap(pipes, pipes.indexOf (pipe_), active - 1); active--; Utils.swap(pipes, active, eligible - 1); ...
2
@Override public int getSize() { return opcode==XOpcode.LOADB?2:opcode==XOpcode.LOADS||opcode==XOpcode.LOADI||opcode==XOpcode.LOADF||opcode==XOpcode.LOADD||opcode==XOpcode.LOADT?3:1; }
6
@Override public void mousePressed(MouseEvent e) { mX = e.getX(); mY = e.getY(); pX = (int) Math.floor((mX - Game.MAPOFFX) / (double) Game.TILESIZE) + Game.xOff; pY = (int) Math.floor((mY - Game.MAPOFFY) / (double) Game.TILESIZE) + Game.yOff; switch(e.getButton(...
3
public int searchInsert(int[] A, int target) { int l = 0, r = A.length - 1; while(l <= r){ int m = (l+r) >> 1; if(A[m] < target) l = m + 1; else r = m - 1; } return l; }
2
public JSONObject toJSONObject(JSONArray names) throws JSONException { if (names == null || names.length() == 0 || this.length() == 0) { return null; } JSONObject jo = new JSONObject(); for (int i = 0; i < names.length(); i += 1) { jo.put(names.getString(i), this....
4
@Override public synchronized void run() { try { BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream()); String line = in.readLine(); if (line == null) { logger.error("Received invalid file...
8
public double getPolarityIndex(String text) throws APIErrorException { // API settings String APIkey = "your_api_key"; String language = "eng"; String categories = "sentiment"; // Encodes text try { text = URLEncoder.encode(text,"ISO-8859-1"); } catch (UnsupportedEncodingException e) { e.print...
9
public void loadAccounts () { try { BufferedReader freader = getAccountFile(); String str; while ((str = freader.readLine ()) != null) { Accounts.add (str.split (" ")); } } catch (Exception ex) { ex.printStackTrace (); } }
2