text
stringlengths
14
410k
label
int32
0
9
private void initCumulative() { cumulative = new int[frequencies.length + 1]; int sum = 0; for (int i = 0; i < frequencies.length; i++) { sum = checkedAdd(frequencies[i], sum); cumulative[i + 1] = sum; } if (sum != total) throw new AssertionError(); }
2
public static final String crypt(String salt, String original) { while(salt.length() < 2) salt += "A"; StringBuffer buffer = new StringBuffer(" "); char charZero = salt.charAt(0); char charOne = salt.charAt(1); buffer.setCharAt(0, charZero); bu...
8
public static void main(String args[]) { try { final String str_sysORTable = "1.3.6.1.2.1.1.9"; final String str_sysOREntry = "1.3.6.1.2.1.1.9.1"; final String str_sysORIndex = "1.3.6.1.2.1.1.9.1.1"; final String str_sysORID = "1.3.6.1.2.1.1.9.1.2"; fi...
9
public String boolStrVal() { if (null == isTrue) { return "null"; } if (isTrue) { return "true"; } else { return "false"; } }
2
private Palos parsePalo(String s) { if(s.endsWith("d")){ return Palos.diamantes; }else if(s.endsWith("h")){ return Palos.corazones; }else if(s.endsWith("c")){ return Palos.treboles; }else if(s.endsWith("s")){ return Palos.picas; } re...
4
@Override public void draw(Object obj, Component comp, Graphics2D g2) { Image finalImage; if (isConnected) { finalImage = this.conectedTexture.connectedImage((ConectedTexture) obj); } else { finalImage = this.image; } int width = finalImage.getWidth(nu...
1
public static boolean isInputDown(GameContainer container, List<Integer> input) { for (Integer key : input) { if (container.getInput().isKeyDown(key)) { return true; } } return false; }
2
public void setCast2(String[] src) { charCast2 = new Image[src.length]; for (int i = 0; i < src.length; i++) { try { charCast2[i] = new Image(src[i]); } catch (SlickException e) { System.out.println(e); } } }
2
public final GalaxyXPreprocessorParser.parameter_return parameter() throws RecognitionException { GalaxyXPreprocessorParser.parameter_return retval = new GalaxyXPreprocessorParser.parameter_return(); retval.start = input.LT(1); int parameter_StartIndex = input.index(); Object root_0 = nu...
9
public void MakeAllPackets() { while (packetsCreated < totalNumberOfPackets) { //add created packet to packet created queue packetCreated.add(CreatePacket()); } }
1
@Override public void init() { // グリッド初期化 _grid = new short[ GRID_Y ][ GRID_X ]; _gridColor = new short[ GRID_Y ][ GRID_X ]; // ファイルパスルート String filePathRoot = new File( "" ).getAbsolutePath(); // 背景読み込み ImageIcon bgIcon = new ImageIcon( filePathRoot + "/res/image/bg.png" ); _bgImg = bgIcon.ge...
7
public void omitLessFreq() { if (name == null) return; // Illegal int threshold = n_words[0] / LESS_FREQ_RATIO; if (threshold < MINIMUM_FREQ) threshold = MINIMUM_FREQ; Set<String> keys = freq.keySet(); int roman = 0; for(Iterator<String> i = keys.iterator(); i....
8
public void setQuantidade(int quantidade) throws ErroValidacaoException{ if(quantidade < 0){ throw new ErroValidacaoException("A quantidade não pode ser menor que 0"); }else { this.quantidade = quantidade; } }
1
public boolean equals (Object other) { if ( ! (other instanceof MavenVersion)) return false; MavenVersion that = (MavenVersion) other; return this.major == that.major && this.minor == that.minor && this.incremental == that.incremental && t...
4
public static Strategy getStrategy(String strategyName) { if("average".equals(strategyName)) { return new AverageStrategy(); } else if("vacancyRate".equals(strategyName)) { return new VacancyRateStrategy(); } else { return new DefaultStrategy(); } ...
2
public void getFriendshipWindmillGraph(mxAnalysisGraph aGraph, int numBranches, int branchSize) { if (numBranches < 2 || branchSize < 2) { throw new IllegalArgumentException(); } mxGraph graph = aGraph.getGraph(); Object parent = graph.getDefaultParent(); int numVertices = numBranches * branchSize + 1;...
6
public static Uiswt getInstance() { if (uniqueInstance == null) { synchronized (Uiswt.class) { if (uniqueInstance == null) { uniqueInstance = new Uiswt(); } } } return uniqueInstance; }
2
public TabStripper(String args[]) { // Get input from the console String startingPath = ConsoleTools.getNonEmptyInput("Enter starting path: "); int numOfTabs = ConsoleTools.getIntInput("Enter the number of tabs to strip: "); String[] fileExtensions = ConsoleTools.getSeriesOfInputs("Enter file extension to ma...
1
@Override public void setPrerequisites(String prerequisites) { if(prerequisites == null || prerequisites.isEmpty()) { this.prerequisites = "none"; } this.prerequisites = prerequisites; }
2
public static boolean isInside(Positioned a, Positioned b, boolean notOnTheEdge) { if (notOnTheEdge) { if (occupySameSpace(a, b)) return true; if (isInsideInSameHorizontalSpace(a, b)) return true; if (isInsideInSameVer...
7
public LinkedList<Semester> uniformCostSearch() { LinkedList<Semester> optimalSemesterList = new LinkedList<Semester>(); if ( directoryOfClasses == null ) { System.err.println( "Error: directoryOfClasses does not exist"); System.exit(1); } // instantiate the root semester, which contains any courses pr...
7
public void playRound() { // Reset our players piles (hand and won pile) -- necessary if this is // not the first game played with these Players. for (int i = 0; i < players.length; i++) players[i].resetPiles(); // Create the game piles this.createGamePiles(); // Increment our dealer. dealerIndex = (...
8
public double hiddenBias(int index) { if(index < 0 || index >= n) throw new RuntimeException("given n=" + n + ", illegal value for index: " + index); return _hiddenBias[index]; }
2
@Override public void check(final FolderConfig folderConfig) { // folderConfig.getSongs().clear(); String artistString = null; String user = null; try { final long artistId = getApi().resolve(folderConfig.getArtistUrl()); final HttpResponse artistResponse = getApi().get(new Request(String.format(Constant...
2
public boolean hasTarget() { if (rangeHandler.getPlacablesInRange().isEmpty()) { return false; } return true; }
1
public static void main(String[] args) throws Exception { long time = System.currentTimeMillis(); // Loading configuration first try (FileInputStream fis = new FileInputStream(CONFIG_PATH)) { logger.info("Loading configuration"); System.getProperties().load(fis); } catch (Throwable t) { logger.error(...
8
@Override public void update(Observable o, Object arg) { Integer mode = (Integer) arg; switch (mode) { case ApplicationState.MESSAGES_UPDATED: Messages m = (Messages) o; DefaultTableModel tableModel = (DefaultTableModel) jTable2.getModel(); ...
4
private int minimax(NeutronBoard nb, int depth) { NeutronBoard n_copy; int best_value=-3000; if (nb.whoToMove()==NeutronBoard.BLACK) { best_value=3000; } if ((depth==0) || (nb.isGameOver()!=NeutronBoard.NOPLAYER)) { return NeutronUtil.evaluation(nb); } for (String AM...
6
public String getLinkID() { return LinkID; }
0
public void setEntradasCollection(Collection<Entradas> entradasCollection) { this.entradasCollection = entradasCollection; }
0
@Override public EnvironnementAbs run(EnvironnementAbs env) { EnvironnementWator univert = (EnvironnementWator)env; ArrayList<AgentSwatorAbs> voisins = univert.voisins(pos_x, pos_y); boolean depalcementPossible = voisins.contains(null); cycleReproduction++; int x = pos_x,y = pos_y; if (depalcementPossible)...
3
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); controller.populateMovies(); this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } catch (IOException ex) ...
1
@EventHandler(priority = EventPriority.HIGH) public void InteractAggroMob(EntityTargetEvent event){ final EntityTargetEvent realEvent = (EntityTargetEvent) event; if(realEvent.getTarget() instanceof Player){ String TargetName = ((Player) realEvent.getTarget()).getName(); Player TargetedPlayer = Bukkit.ge...
4
public ManifestType createManifestType() { return new ManifestType(); }
0
* @param genFormatList the genFormat argument substitution sequence * * @throws UnknownHostException if cyc server host not found on the network * @throws IOException if a data communication error occurs * @throws CycApiException if the api request results in a cyc server error */ @Deprecated public ...
1
public void manageEconomy(final User user) { if (user == null) return; try { // Manage account final BankAccount acc = Economy.getInstance().getAccount(user); if (acc == null) return; // Check for welfare double welfare = acc.hasWelfare() ? Economy.getWelfareAmount() : 0.0D; ...
4
private void shoot() { boolean cur = GUI.whosTurn; if (this.p == GUI.getPlayer(cur)) { //ei voi ampua omalle alueelle return; } int result; /*yritys optimoida allaolevaa metodin osiota. ei toimi vielä*/ // result = GUI.getPlayer(cur).shoot(GUI.getPlayer(!cu...
8
public boolean maskContainsRelativePoint(Point relativep, int maskindex) { // In case mask is not used (mask == null), always returns true if (getMask() == null) return true; // Checks if the maskindex was a valid number if (maskindex >= getMask().getImageNumber()) maskindex = getMask().getImageNumb...
6
public void handleDeath() { for (Iterator<NPC> i = NPC.iterator(); i.hasNext();) if (i.next().getDeath()) i.remove(); for (Iterator<Bullet> i = BulletAlly.iterator(); i.hasNext();) if (i.next().getDeath()) i.remove(); for (Iterator<Bullet> i = BulletNPC.iterator(); i.hasNext();) if (i...
7
private static char lookChar() { // return next character from input if (buffer == null || pos > buffer.length()) fillBuffer(); if (buffer == null) return EOF; else if (pos == buffer.length()) return '\n'; else return buffer.charAt(pos); }
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AbstractComponent other = (AbstractComponent) obj; if (identifier == null) { if (other.identifier != null) return false; } else if (!ide...
6
public PopupMenu(JPopupMenu menu){ this.menu = menu; }
0
public NetworkListener(int port) { this.port = port; }
0
public void actionPerformed(ActionEvent e) { if(forest ==1 && oldMan ==0){ boyY = boyY + velY; } if(forest ==1 && oldMan ==1){ GameFile.iLocY = GameFile.iLocY + velY; } }
4
public boolean inSameRankAs(Field otherField) { return this.distanceBetweenRank(otherField) == 0; }
0
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Node other = (Node) o...
9
private void cmbSearchItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cmbSearchItemStateChanged // TODO add your handling code here: String studentID = ""; String examID = ""; if (cmbExamID.getSelectedItem() != null) { examID = cmbExamID.getSelectedItem().to...
5
public Set<String> findSet(String woe_id,String group_id) { SearchParameters search_parameters = new SearchParameters(); search_parameters.setWoeId(woe_id); Set<String> user_set = findUserSet(woe_id); Set<String> result = new HashSet<String>(); PhotoList photo_list = null; System.out.println("total user:"...
8
public String commonPrefix(PGridPath path) { if (path == null) { throw new NullPointerException(); } int index = 1; String oPath = path.toString(); while (path_.regionMatches(0, oPath, 0, index)) { index++; } index--; return path...
2
public static String[] getKeyandValue(String line) { String[] words = Tools.readWords(line); if (words.length==0 || words[0].charAt(0)==commentChar) { return new String[] {"",""}; } String key, value=""; if (words[0].contains("=")) { String[] subwords = wo...
9
public PolyCubicSplineFast(Object xArrays, Object fOfX){ this.fOfX = Fmath.copyObject(fOfX); this.xArrays = Fmath.copyObject(xArrays); // Calculate fOfX array dimension number Object internalArrays = Fmath.copyObject(fOfX); this.nDimensions = 1; while(!((intern...
9
public Piece selectMonRoi(int tour) { Piece monRoi = null; for(int i = 0; i < 8; i++){ for(int j = 0; j < 8; j++){ if(this.E.getTableau()[i][j]!=null) if(this.E.getTableau()[i][j].getClass().getName() == "pieces.Roi") if((this.E.getTableau()[i][j].getCouleur() == "blanc") && ((tour%2 != 0)) || ...
8
public void countNeuralValues(){ int i=0; int j=0; int k=0; for(i=0;i<incomeLayoutNeuronCount;i++){ incomeLayout.get(i).countOutcomeValue(); } for(i=0;i<hideLayoutNeuronCount;i++){ for(j=0;j<incomeLayoutNeuronCount;j++){ ...
7
public void handle(SingleUserCrawlingEvent event) { long uid = event.getOriginalSourceUid(); if (uid > 0) { try { weibo4j.model.User user = SinaWeibo.getInstance().getUser(uid); if (user != SinaWeibo.USER_NOT_FOUND) { com.julu.weibouser.m...
8
public static int queryGetInt(HttpRequest req, String key, int def) { int ret = def; String val = null; if(req.method().equals("GET")) val = req.queryParam(key); else if(req.method().equals("POST")) val = req.postParam(key); if(val != null) try { ret = Integer.parseInt(val); } catch(Num...
4
@Override public Map convertMap(pplgg.Map myMap) { Tile[][] newMap = new Tile[myMap.getWidth()][myMap.getHeight()]; List<Tile> keys = new ArrayList<Tile>(); for (int x = 0; x < myMap.getWidth(); x++) { for (int y = 0; y < myMap.getHeight(); y++) { int type = myMap.getTerrain(x, y); if (type == 0) {...
4
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Feature)) { return false; } Feature other = (Feature) object; if ((this.id == null && other.id != null) || (thi...
5
private DPTXlator createTranslator(final int objIndex, final int pid) throws KNXException, InterruptedException { final int ot = getObjectType(objIndex, true); int pdt = -1; Property p = (Property) properties.get(new PropertyKey(ot, pid)); // if no property found, lookup global pid if (p == null && pid < 5...
8
@Override public void setName(String name) { this.name = name; }
0
public final static double roundBidAsk(double number, double tick, boolean bid) { // get rid of trailing 00..001s and 99..99s double raw = Math.round((number) * scale); long recpTick = Math.round(1 / tick); // get back to basis, tricky with the tick size due to floating issues raw /= scale * 1 / recpTick; // ro...
1
void setReverb(JSSample sample) { /* * Only third sample of multisample sounds has reverb parameters set. * For now, only positional and directional sounds are reverberated. */ int soundType = sample.getSoundType(); int dataType = sample.getDataType(); ...
8
static void optimize(final File f, final File d, final Remapper remapper) throws IOException { if (f.isDirectory()) { File[] files = f.listFiles(); for (int i = 0; i < files.length; ++i) { optimize(files[i], d, remapper); } } else if (f.get...
9
public static void makeReports(List<Book> bookL){ StringBuilder data=new StringBuilder(); for(Book b:bookL){ if (b.getQuantity() == 0){ data.append(b.toReport()); data.append("\n"); } } try { FileOutputStream file=new FileOutputStream(new File("report.txt")); file.write(data.toString().getBy...
4
public void startElement( String namespaceURI, String simpleName, String qualifiedName, Attributes attributes) throws SAXException { short currentTag = 0; String element = simpleName; if ("".equals(simpleName)) { ...
6
public boolean storeImageFreqsToDb(String imageFileName, long[][] bins, long pixels) { StopWatch sw = new StopWatch(); sw.start(); StringBuilder sql = new StringBuilder("INSERT INTO frequencies (id_image, r_value, g_value, b_value, frequency, frequency_perc) VALUES (?, ?, ?, ?, ?, ?)"); ...
8
public static ArrayList<Subcategorias> sqlSelectDos(Categorias cat){ ArrayList<Subcategorias> subcat = new ArrayList(); if(!BD.getInstance().sqlSelect("SELECT sc.nombre, sc.idsubcategorias FROM subcategorias sc INNER JOIN cat_subcat_tit_attr_descr pr ON pr.subcategorias_id = sc.idsubcategorias INNER JOI...
2
private void CommandQuickPlay( boolean priority, boolean toStream, boolean toLoop, String sourcename, FilenameURL filenameURL, float x, float y, float z, int attModel, float distORroll, ...
3
void hash(){ if(hashed) return; MAC macsha1=getHMACSHA1(); if(salt==null){ Random random=Session.random; synchronized(random){ salt=new byte[macsha1.getBlockSize()]; random.fill(salt, 0, salt.length); } } try{ synchronized(macsha1...
3
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
protected void startGame() { notifyNewGame(); discardCards(); shuffle(); community.clear(); doAntes(); doBlinds(); dealCard(players.get((dealer + 1) % numplayers), false); dealCard(players.get((dealer + 1) % num...
7
public static Criteria parseCriteria( Ptg[] criteria ) { DB dblist = DB.parseList( criteria ); if( dblist == null ) { return null; } Criteria crit = new Criteria( dblist.getNCols(), dblist.getNRows() ); crit.colHeaders = dblist.colHeaders; crit.rows = dblist.rows; if( log.isDebugEnabled() ) { l...
5
public void checkTableStructure(TableRegistration table) { // TODO Update table structure StringBuilder query = new StringBuilder(); query.append("SELECT * FROM ") .append(table.getName()) .append(" LIMIT 1"); try { ResultSetMetaData meta = connection.prepareStatement(query.toString()).executeQuery()...
6
public void DVD() { pcIncrease(); if ((getXF().get().equals("00") || getXF().get().equals("10")) && (getRF().get().equals("00") || getRF().get().equals("10"))) { if (SelectRegister().get().equals("00000000000000000000")||SelectRegister().get().equals("10000000000000000000")){ ...
6
private ArrayList<AnchorPiece> getAnchorPieces(Board board) { ArrayList<AnchorPiece> anchors = new ArrayList<AnchorPiece>(); ArrayList<Piece> opposingPieces = getOpposingNeighbors(board); for(Piece p : opposingPieces) { int x = this.getX(), y = this.getY(); int dirX = p.getX() - this.getX()...
6
private void placeButtons() { createButton(0 + startPointXCoordinate, 40 + startPointYCoordinate, 40, 40, new Runnable() { public void run() { MoveAction moveAction = objectTron .moveAction(Movement.LEFT); doAction(moveAction); repaint(); } }).setImage(loadImage("view/asset...
2
public void makeReactions(final SquirmChemistry chemistry, int n_x, int n_y, SquirmCellSlot cell_grid[][]) { // collect the unbonded neighbours of this cell (up to 8) final Vector<SquirmCell> neighbours = new Vector<SquirmCell>(); int tx, ty; SquirmCellSlot slot; SquirmCell cell;...
7
@Override public void actionPerformed(ActionEvent e) { int numPages = pages.size(); String pageNumMessage; if(numPages > 1){ pageNumMessage = numPages + " pages."; } else{ pageNumMessage = numPages + " page."; } String allWords = ""; for(int i = 0; i < pages.size(); i++){ JTextPane curre...
5
private boolean inPoly(FastVector ob, double x, double y) { int count = 0; double vecx, vecy; double change; double x1, y1, x2, y2; for (int noa = 1; noa < ob.size() - 2; noa += 2) { y1 = ((Double)ob.elementAt(noa+1)).doubleValue(); y2 = ((Double)ob.elementAt(noa+3)).doubleValue(); if (...
8
public ArrayList viewServiceDesc() { ArrayList temp = new ArrayList(); Query q = em.createQuery("SELECT t from ServiceEntity t"); for (Object o : q.getResultList()) { ServiceEntity p = (ServiceEntity) o; temp.add(p.getDescription()); } return temp; }
1
public static int[] findMinMax(int[] arr) { if( arr == null ){ throw new IllegalArgumentException("Can't find max/min in NULL array"); } if( arr.length == 0 ){ throw new IllegalArgumentException("Can't find max/min in EMPTY array"); } if( arr.length < 2 ){ return new int[]{ arr[0], arr[0] ...
9
public void startClient() { udpSocket = new UDPSocket(udpPort); MainClient.clientExecutionService.execute(udpSocket); try { socket = new Socket(host, tcpPort); in = new BufferedReader(new InputStreamReader(socket.getInputStream())); } catch (UnknownHostE...
6
private static void enqueueCacheEntry(String name, String version, String packCacheLocation, String minecraftVersion, List<String> installationQueue) { //Get entry location String entryPath = getCacheEntryPath(name, version, packCacheLocation); if (entryPath != null) { ...
6
private static void writePairs( Document dom, MVD mvd, Element parent, String encoding ) throws Exception { Element pParent = dom.createElement( "pairs" ); HashMap<Pair,Integer> parents = new HashMap<Pair,Integer>(); HashMap<Pair,LinkedList<Element>> orphans = new HashMap<Pair,LinkedList<Element>>(); in...
9
public static String encodeURIComponent(String s) { StringBuilder o = new StringBuilder(); for (char ch : s.toCharArray()) { if (isUnsafe(ch)) { o.append('%'); o.append(toHex(ch / 16)); o.append(toHex(ch % 16)); } el...
2
public void keyReleased(KeyEvent e) { int code = e.getKeyCode(); if (code == KeyEvent.VK_LEFT) { leftPressed = false; } else if (code == KeyEvent.VK_RIGHT) { rightPressed = false; } else if (code == KeyEvent.VK_UP) { upPressed = false; if (onGround) jumping = false; if (jumpHold) jumpHold = f...
5
private List<String> getListOfStyles() { List<String> styles = new ArrayList<String>(); try { String baseURL = Options.getInstance().getProperty("cloudURL"); URI rURI = new URI("http", null, baseURL, 80, "/styles/", null, null); URL url = rURI.toURL(); //URL url = ...
3
public boolean isChunkFullyGenerated(int x, int z) { // if all adjacent // chunks exist, it // should be a safe // enough bet that // this one is fully // generated return !(!doesChunkExist(x, z) || !doesChunkExist(x + 1, z) || !doesChunkE...
4
public void setCarPositions(ArrayList<CarPosition> carPositions) { allCars2.clear(); for (CarPosition carPosition : carPositions) { CarInfo carInfoOld = null; for (CarInfo car : allCars) { if (car.color != null && car.color.equals(carPosition.color)) { ...
8
public double[] getTemperatures(double[] var1, int var2, int var3, int var4, int var5) { if(var1 == null || var1.length < var4 * var5) { var1 = new double[var4 * var5]; } var1 = this.field_4194_e.func_4112_a(var1, (double)var2, (double)var3, var4, var5, 0.02500000037252903D, 0.02500000037252...
6
public void saveXml(String xmlFileName){ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { DocumentBuilder db = factory.newDocumentBuilder(); DOMImplementation domImplementation = db.getDOMImplementation(); Document doc = domImpleme...
2
@Override public boolean hasNext() { if (mNextValid) { return true; } while (mIterator.hasNext()) { Object obj = mIterator.next(); if (obj == null) { if (!mOmitNulls) { mNext = null; mNextValid = true; return true; } } else if (mContentClass.isInstance(obj)) { mNext = mCon...
5
public static void deleteDirectory(File path) { if (path.exists()) { File[] files = path.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { deleteDirectory(file); } else { ...
7
public PreferenceString getCreateModDatesFormat() { if (useDocumentSettings()) { return this.createModDatesFormat; } else { return Preferences.getPreferenceString(Preferences.CREATE_MOD_DATES_FORMAT); } }
1
public boolean contains(Mark m) { if((m.top() || m.vmiddle()) && m.left()) { return m.y < (m.x / 2 + radius / 2); } else if(m.bottom() && (m.left() || m.middle())) { return (Math.pow(m.x, 2) + Math.pow(m.y, 2)) < Math.pow(radius, 2); } else if(m.bottom() && m.right()) { ...
9
static boolean unpackZipTo(Path zipfile, Path destDirectory) throws IOException { boolean ret = true; byte[] bytebuffer = new byte[BUFFERSIZE]; ZipInputStream zipinputstream = new ZipInputStream(new FileInputStream(zipfile.toFile())); ZipEntry zipentry; while ((zipentry = zipin...
4
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SessionRequestContent req = new SessionRequestContent(request); ActionCommand command = CommandFactory.defineCommand(req); String page = command.execute(req...
1
public void sendServerMessage (String message) { for (Map.Entry<String, Socket> user : activeSockets.entrySet()) { Socket socket = user.getValue(); try { PrintWriter out = new PrintWriter(socket.getOutputStream(), true); out.println("*** [SERVER] " + messa...
2
private void sing(String singname) { System.out.println("唱歌:" + singname); }
0
public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.next(); char[] str = s.toCharArray(); int n = 1 << s.length(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { sb = new StringBuilder(); for (int j = 0; j < s.length(); j++) { if (((i ...
3
private void parseDayDetails(int i) { int firstOccurance = 0; for (int j=i-1; j>=0; j--) { if (parts[j].equals("next") || parts[j].equals("following") ) { isCommandDetails[j] = false; } else { firstOccurance = j+1; break; } } if ((firstOccurance > 0) && getConnectorWords().contains(par...
9