text
stringlengths
14
410k
label
int32
0
9
public void settip(String t) { tooltip = t; q2 = -1; if (tooltip != null) { try { Matcher m = patt.matcher(tooltip); while (m.find()) { q2 = Integer.parseInt(m.group(1)); } Matcher valm = pattVal.matcher(tooltip); if (valm.find()) { count_of_value = Double.parseDouble(valm.group(1...
4
public void testGetFieldType() { YearMonthDay test = new YearMonthDay(COPTIC_PARIS); assertSame(DateTimeFieldType.year(), test.getFieldType(0)); assertSame(DateTimeFieldType.monthOfYear(), test.getFieldType(1)); assertSame(DateTimeFieldType.dayOfMonth(), test.getFieldType(2)); tr...
2
public void run() { while (true) { if (myDestinations.size() > 0) { // System.out.println("About to visit floor"); int dir = getMyDirection(); if (dir == DIRECTION_UP || dir == DIRECTION_NEUTRAL) { VisitFloor(myDestinations.first()); } if (dir == DIRECTION_DOWN) { VisitFloor(myDest...
7
@Override public int awardPoints(boolean[] sv,int objectSize) { if(objectSize>thresh){ for (boolean b : sv) { if(b) return 0; //If any part is touching } return 1; } else{ //Tracker should catch it int c = 0; for (boolean b : sv) { if(b) c++; } return c == objectSize ? 1 : 0; }...
6
private boolean interact(int x0, int y0, int x1, int y1) { List<Entity> entities = level.getEntities(x0, y0, x1, y1); for (int i = 0; i < entities.size(); i++) { Entity e = entities.get(i); if (e != this) if (e.interact(this, activeItem, attackDir)) return true; } return false; }
3
private static void printRLE(ArrayList<int[]> runs) { System.out.println(" Here is the correct encoding:"); for (int[] run : runs) { System.out.println(run[0] + "x[red=" + run[1] + ",green=" + run[2] + ",blue=" + run[3] + "]"); } }
1
public Integer getPrice(Chest chest,MaterialData data){ if(chest==null || data==null) return null; Object price = stores.get(chest).getPrice(data); if(price instanceof Integer) return (Integer) price; else return 0; }
3
public void accept(final MethodVisitor mv) { int[] keys = new int[this.keys.size()]; for (int i = 0; i < keys.length; ++i) { keys[i] = ((Integer) this.keys.get(i)).intValue(); } Label[] labels = new Label[this.labels.size()]; for (int i = 0; i < labels.length; ++i) { ...
2
private void endActionUpdate() { numberOfActionsAlreadyPassed++; if (numberOfActionsAlreadyPassed >= numberOfActionsToSwitchStatus) { numberOfActionsAlreadyPassed = 0; if (isActive()) deactivate(); else activate(); } }
2
private void createFromParseList(ParseList list) throws CriticalFailure { list.insertBlockIDs(blockMap); Hashtable<String,TreeNodeArea> areas = list.createAreaNodes(); Hashtable<String,Modifier> modifiers = list.createModifiers(); Hashtable<String,ModifierGroup> modifierGroups = list.createModifierGroups(); ...
7
private Color parseRGBA(String str) { int i0 = str.indexOf("["); if (i0 == -1) i0 = str.indexOf("("); int i1 = str.indexOf("]"); if (i1 == -1) i1 = str.indexOf(")"); str = str.substring(i0 + 1, i1); String[] s = str.split(REGEX_SEPARATOR + "+"); if (s.length < 3) { out(ScriptEvent.FAILED, "Cannot...
8
public void fire(ArrayList<Sprite> spriteList) { // Only fire if we're loaded. if (_ammo != null) { Vector2d fireImpulse = new Vector2d(_impulseMagnitude, 0); Vector2d initialTranslation = new Vector2d(_radius / 2, 0); fireImpulse.setAngle(getAngle()); ...
1
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Node otherNode = (Node) obj; if (edges.size() != otherNode.edges.size()) return false; /*if (suffixLink == null) { if (oth...
8
public static boolean equalsIgnoreCaseInString(String longer, int ai, String shorter, int bi) { int chkLen = shorter.length() - bi; if (longer.length() - ai < chkLen) return false; for (int c = 0; c < chkLen; ai++, bi++, c++) { char ac = longer.charAt(ai); char bc = shorter.charAt(bi); if (ac == bc |...
5
@Override public void tick() { super.tick(); if (input.escape.clicked) System.exit(0); if (input.enter.clicked) { if (selected == 0) System.exit(0); } if (input.backspace.clicked) { if (input.keyboardString.length() > 0) { input.keyboardString = input.keyboardString.substring(0, input.keyboardStrin...
6
public Item SwapWeapon(Item willBeSwappedItem) { return weaponSlot.swap(willBeSwappedItem); //return false;// swap failed }
0
public OneFlower(GameMode mode) { this.mode = mode; frame = new JFrame(); frame.setTitle("OneFlower - Playing - Score: 0"); frame.setLocationRelativeTo(null); frame.setSize(390, 410); frame.setResizable(false); frame.setLayout(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setV...
2
public void setTotalNumberOfMatches(int totalNumberOfMatches) {this.totalNumberOfMatches = totalNumberOfMatches;}
0
public static void testMethod(int led) { int number; if(led>=0 && led <8) { number = led; } else { number = 7; } for (int j = 2; j >=0 ; j--) { for (int i = number; i >=0 ; i--) { switch(j) { case 2:leds[i].setColor(LEDColor.RE...
8
public final void attrSplit(int attr, Instances inst) throws Exception { int i; int len; int part; int low = 0; int high = inst.numInstances() - 1; PairedStats full = new PairedStats(0.01); PairedStats leftSubset = new PairedStats(0.01); PairedStats rightSubset = new PairedStats(0.0...
8
public static ArrayList<Achievement> updateAchievement(User user) { ArrayList<Achievement> records = AchievementRecord.getAchievementsByUserID(user.userID, QUIZ_TAKEN_TYPE); ArrayList<Achievement> newAchievements = new ArrayList<Achievement>(); int totalTakenQuiz = QuizTakenRecord.getQuizHistoryByUserID(user.user...
5
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
@Override protected TerminalSize calculatePreferredSize() { if(preferredSizeOverride != null) return preferredSizeOverride; int maxWidth = 5; //Set it to something... for(int i = 0; i < items.size(); i++) { String itemString = createItemString(i); ...
3
public synchronized String toString(){ String stringgedField = ""; for (int i = 0; i < this.getYLength(); i++) { stringgedField = stringgedField + '\n'; for (int j = 0; j < this.getXLength(); j++) { if (field[j][i] == null) { stringgedField = s...
3
public void draw(Graphics g) { int minx = (int) (worldx / Texture.tilesize); int maxx = (int) ((worldx + Main.width) / Texture.tilesize) + 1; int miny = (int) (worldy / Texture.tilesize); int maxy = (int) ((worldy + Main.height) / Texture.tilesize) + 1; if(maxx > width) maxx = width; if(maxy > height) max...
6
public String getHtmlTr() { try { JSONObject file = new JSONObject(read()); StringBuffer output = new StringBuffer("<tr><td>"); // Datum Date d = new Date(file.getLong("datetime")); output.append(String.format("%tF %tR", d, d)); output.append("</td><td>"); // Informationen if (file.has("fi...
6
public boolean accept(File file) { if (file.isDirectory()) { return true; } else { return false; } }
1
@Test public void RandomRotatingGrid() { //Make two identical models but one parallel and one sequential AbstractModel paraModel=DataSetLoader.getRandomRotatingGrid(100, 800, 40, new ModelParallel()); AbstractModel seqModel=DataSetLoader.getRandomRotatingGrid(100, 800, 40, new Model()); //Step through each mo...
3
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); if(Analysis.imageA == null || Analysis.imageB == null) return; Graphics2D g2d = (Graphics2D)g; Image A = Analysis.imageA; Image B = Analysis.imageB; double ...
8
public synchronized void reap() { _log.trace("Running the reaper."); // DON'T FEAR THE REAPPER!!!!! long now = System.currentTimeMillis(); List<String> mapRemovalList = new LinkedList<String>(); for(List<DNSRecord> list : _Cache.values()) { List<DNSRecord> removalList = new Li...
6
public void visitSwitchStmt(final SwitchStmt stmt) { if (stmt.index == from) { stmt.index = (Expr) to; ((Expr) to).setParent(stmt); } else { stmt.visitChildren(this); } }
1
private Value runMethod(CodeBlock i) throws InterpreterException { if (method_.equals(Length)) { try { return new Value(var_.getValue().getArray().size()); } catch (Exception e) { throw new InterpreterException(e.getMessage(), getLine()); } } else if (method_.equals(Add)) { try { Value v = a...
7
private void split(Node node){ Node nodeL=new Node(ORDER); Node nodeR=new Node(ORDER); MyRecord keyUp=node.getKeys().get(HALF_KEY); //already full and one more entered to be split for(int i=0;i<HALF_KEY;i++){ nodeL.getKeys().add(node.getKeys().get(i)); } for(int i=HALF_KEY+1;i<ORDER;i++){ no...
7
private String decodePapPassword(byte[] encryptedPass, byte[] sharedSecret) throws RadiusException { if (encryptedPass == null || encryptedPass.length < 16) { // PAP passwords require at least 16 bytes logger.warn("invalid Radius packet: User-Password attribute with malformed PAP password, length = " + e...
7
public static void TakesScreenshot(WebDriver driver, String FailedAt){ try{ // driver is your WebDriver File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); // screenshot is the file we have acquired // fileName is the name of the image file FileUtils.copyFil...
1
public boolean controlErroresHorarios(Object datos) { boolean correcto=false; ArrayList<Object> entrada = (ArrayList<Object>)datos; String empleado=(String)entrada.get(0); String turno=(String)entrada.get(1); if(!turno.isEmpty() && !empleado.isEmpty()) { i...
4
public void start() throws JSchException{ Session _session=getSession(); try{ Request request; if(xforwading){ request=new RequestX11(); request.request(_session, this); } if(pty){ request=new RequestPtyReq(); request.request(_session, this); } request=new R...
7
private static void registrarTienda() { boolean salir; String nombre, cif; float deuda; Tienda tienda; do { try { System.out.print( "Introduce el nombre de la tienda: "); nombre = scanner.nextLine(); System.out.print( "Introduce el cif de la tienda: "); cif = scanner.nextLine...
2
public void addNote(String channel, String sender, String message) { String[] split = message.split(" "); if(message.equalsIgnoreCase(Config.getCommandPrefix() + "note")) { this.bot.sendMessage(channel, "No receiver specified, please try again."); return; } ...
4
public static void main ( String[] args ) { String xmldata = "<loadcell> <sensor id='loadcellid1'/> <weight>156</weight> </loadcell>"; XMLInputFactory inputFactory = XMLInputFactory.newInstance(); StringReader sr = new StringReader(xmldata); XMLEventReader eventReader = null; try { even...
7
private void writeFolder(Folder folder) throws IOException { writeNumber(folder.getCoders().size()); int i; for (i = 0; i < folder.getCoders().size(); i++) { CoderInfo coder = folder.getCoders().get(i); { int propsSize = coder.getProps().getCapacity(); ...
8
public String say(String str){ String result = ""; int count =1; for(int i=0;i< str.length();i++){ if(i==str.length() -1){//因为最后一个没有被计入,需要单独处理 result += count + str.substring(i,i+1); count = 1; } else if(str.charAt(i) ==str.cha...
3
public String processInput(String input) { stringParts = input.split(" "); try { cmdPart = stringParts[0]; } catch (NullPointerException e) { System.out.println("Error: found no Command"); } if (input.equals("SYN")) { return ack; } if (cmdPart.equals("!login")) { return logginUser(); ...
7
private static String getOS() { if (os == null) { os = System.getProperty("os.name"); } return os; }
1
public VenueRemovalFinalized(Venue venue) { this.venue = venue; }
0
public static void main(String[] args) { System.out.println("This is a binary to decimal converter."); System.out.println("Please choose your option:"); System.out.println("1. Convert binary to decimal."); System.out.println("2. Convert decimal to binary."); System.out.p...
2
private void knightTopTopRightPossibleMove(Piece piece, Position position) { int x1 = position.getPositionX(); int y1 = position.getPositionY(); if((x1 >= 0 && y1 >= 0) && (x1 < 7 && y1 <= 5)) { if(board.getChessBoardSquare(x1+1, y1+2).getPiece().getPieceType() != board.getBlankPiece().getPieceType()) ...
6
public double getSimRevenue(int s2,int s3,int s4){ int phantom_capacity = max_capacity; int phantom_rev = 0; int phantom_level = 1; for(int t=1;t<=no_weeks;t++){ if(t>=s4){ phantom_level = 4; } else if(t<s4 && t >= s3){ phantom_level = 3; } else if(t<s3 && t >= s2){ phantom_leve...
6
public boolean isCardPlayable(Card card) { return card != null && (playPile.isEmpty() || card.value == Card.EIGHT || card.value == playPile.peek().value || ((playPile.getComponent().hasCardFacade()) ? card.suite == playPile.getComponen...
5
public char skipTo(char to) throws JSONException { char c; try { long startIndex = this.index; long startCharacter = this.character; long startLine = this.line; this.reader.mark(1000000); do { c = this.next(); if...
3
@Test public void testTrafficLights() { for (TrafficLight trafficLight : TrafficLight.values()) { System.out.println(trafficLight); System.out.println(trafficLight.getDuration()); } }
1
public JLabel getjLabelNom() { return jLabelNom; }
0
public void paintComponent(Graphics g) { if(drag==true) { if(startDragX-xMouse < 0 & startDragY- yMouse < 0) { dragRect = new Rectangle(startDragX,startDragY,xMouse-startDragX,yMouse-startDragY); } else if(startDragX-xMouse < 0 & yMouse - startDragY < 0) { dragRect = new Rectangle(startDra...
5
public boolean alreadyInFile(String name) { File file = new File("Users.txt"); Scanner scanner; try { scanner = new Scanner(file); while (scanner.hasNextLine()) { String lineFromFile = scanner.nextLine(); if(lineFromFile.contains(name)) { JOptionPane.showMessageDialog(null, "Username has a...
3
public StringBuffer startTable(StringBuffer org, MutableAttributeSet attrSet) { originalBuffer = org; ret = new StringBuffer(); tblno = tblcnt++; tc = ""+(char)('a'+(tblno/(26*26)))+ (char)((tblno/26)+'a')+ (char)((tblno%26)+'a'); String val = (Strin...
8
private void loadGame(){ try{ contrlSaveLoad.load(); }catch(Exception e){ e.printStackTrace(); } //load main currentCity = contrlSaveLoad.getCity(); contrlSaveLoad.getSec(); setHandCash(contrlSaveLoad.getCash()); setBankCash(contrlSaveLoad.getBankCash()); setCurrentQuest(contrlSave...
8
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
public boolean jumpMayBeChanged() { return (thenBlock.jump != null || thenBlock.jumpMayBeChanged()) && elseBlock != null && (elseBlock.jump != null || elseBlock.jumpMayBeChanged()); }
4
private void createSocketAndSend(String msg, int flag) throws IOException{ DatagramSocket clientSocket = new DatagramSocket(); String[] ipNumbers = hostIP.split("\\."); byte[] ip = {(byte) Integer.parseInt(ipNumbers[0]), (byte) Integer.parseInt(ipNumbers[1]), ...
1
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { boolean unSpring=false; if((!sprung) &&(affected instanceof Room) &&(msg.amITarget(affected)) &&((msg.targetMinor()==CMMsg.TYP_ENTER) &&(!msg.source().isMine(affected))) &&(msg.tool() instanceof Exit)) { final Room room...
9
public boolean needShuffle() // ->brought from DeckArrayManager { if (count == 52) return true; else return false; }
1
public Bag getDiscsWithStability(Stability stability) { LOGGER.log(Level.INFO, "Getting discs with stability " + stability); Bag discBag = new Bag(); for (int i = 0; i < discs.size(); i++) { if (discs.get(i).getStability() == stability) { discBag.addDisc(discs.get(...
2
private void paivitaJaLinkitaSolu(int x, int y) { Solu solu = solut[x][y]; for (int i=x-1;i<x+2;i++){ for (int k=y-1;k<y+2;k++){ if (onKartalla(i, k) && solut[i][k]==solu){ k++; } if (onKartalla(i, k)){ ...
7
public void setSeatType(long value) { this._seatType = value; }
0
private boolean send(String mediaId, List<String> recipients, boolean story, int time) { try { // Prepare parameters Long timestamp = getTimestamp(); String requestToken = TokenLib.requestToken(authToken, timestamp); int snapTime = Math.min(10, time); ...
9
public PwdItem GetItem(int id) { PwdItem item = new PwdItem(); if (this.connection == null) { return null; } try { Statement stmt = null; stmt = this.connection.createStatement(); int count = 0; //find the max id ...
4
@Override public LinkedList<Item> getItems(String[] params) { LinkedList<Item> foundItems = new LinkedList<Item>(); for(Item item : items){ boolean addItem = true; //Test against Name if(!params[0].isEmpty() && !params[0].equals(item.getName())){ addItem = false; } //Test against Category ...
6
public void writeSrcCoor(String projN, String cycle){ ArrayList<String> srcCoor=rfa.readInputStream(GenerateInitScripts.class.getResourceAsStream("config/common/coordinator.xml"),"UTF-8"); StringBuffer content=new StringBuffer(); String cycleTag="${coord:days(1)}"; if(cycle.equalsIgnoreC...
5
public static int triangleBmax(int x[][]) { int max = x[0][0]; for (int i = 0; i < x.length; i++) { System.out.print("\n"); for (int j = 0; j < x[i].length; j++) { if (i >= j) { System.out.print(x[i][j] + " "); if (max < x[i][j]) { max = x[i][j]; } } } } System.out.println(...
4
private double gcf(double x, double a) { int i; double gold = 0, g, a0 = 1, a1 = x, b0 = 0, b1 = 1, fac = 1, anf, ana; for (i = 1; i <= ITER_MAX; i++) { ana = i - a; a0 = (a1 + a0 * ana) * fac; b0 = (b1 + b0 * ana) * fac; anf = i * fac; a1 = x * a0 + anf * a1; b1 = x * b0 + anf * b1; if (a1 ...
3
public ListNode addTwoNumbers(ListNode l1, ListNode l2) { LinkedList<ListNode> lists3 = new LinkedList<ListNode>(); int flag = 0; int sum = 0; ListNode pre = new ListNode(0); // first step sum = l1.val + l2.val; if (sum > 9) { flag = 1; } else{ flag = 0; ...
8
public static void deleteCompte(Compte compte) { Statement stat; try { stat = ConnexionDB.getConnection().createStatement(); stat.executeUpdate("delete from compte where id_compte="+ compte.getId_compte()); } catch (SQLException e) { while (e != null) { ...
2
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (args.length <= 0) { return false; } if (args[0].equalsIgnoreCase("debug-mode")) { if (args.length == 2) { boolean newDebugMode = Boole...
8
public void spawnEnemy() { int x = random.nextInt(width); int y = random.nextInt(height); if(tiles[x][y].isObstacle()) { spawnEnemy(); return; } Enemy e = new Enemy(x * Texture.tilesize, y * Texture.tilesize, 0, 0); e.setPath(graph.astar(graph.getNodeID(x, y), graph.getNodeID(getPlayerTilePosX(), g...
1
private void setDialogActionListeners() { //handles when the initial dialog is closed; kills the client dialog.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { client.kill(); } }); //handles what ...
5
public void playSound(String path) { try { in = new FileInputStream(path); as = new AudioStream(in); ap.player.start(as); } catch(Exception e) { System.out.println("Got an IOException: " + e.getMessage()); e.printStackTrace(); } }
1
public boolean isExistingProfil(String nom) { Iterator iterator = this.getAllProfils().keySet().iterator(); while (iterator.hasNext()) { if (((Profil) this.getAllProfils().get(iterator.next())).getNom().equals(nom)) { return true; } } return ...
2
@Override public void onEnter() { Bukkit.getWorlds().get(0).setDifficulty(Difficulty.PEACEFUL); for (Player player : Bukkit.getOnlinePlayers()) { player.teleport(Util.parseLocation(getGame().getPlugin().getConfig().getString("game.respawn"), true)); } for (Entity entit...
6
public List<FoodDataBean> getArticleList(int start, int end) throws Exception{ Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; List<FoodDataBean> articleList = null; String sql = ""; try{ conn = getConnection(); /*추천지수 불러오는sql*/ sql = "update food set recommand_count =...
9
public String toString(StringBuilder all, StringBuilder word) { if (this.value > 0) { all.append(word.toString()).append(" ").append(this.value).append("\n"); } if (this.nodes != null) { for (int i = 0; i < this.nodes.length; i++) { if (this.nodes[i] != nu...
5
public int[] randomTags(int L, int n) { int[] slots = new int[L]; for(int i = 0; i < n; i ++) slots[(int)(Math.random()*L)]++; int[] status = new int[3]; for(int i : slots) { if(i == 0) status[0]++; else if( i == 1) status[1]++; else status[2]++; } return status; }
4
private void updateShip(Info info) { Node nodeOne; Node nodeTwo; Set<Node> nodes; // visit every edge in the actual ship for (Edge e : info.adjacentEdges) { nodeOne = info.location; nodeTwo ...
3
@Override public void run() { try { serverSocket = new ServerSocket(SERVER_DATA_SOCKET); while (true) { // wait for a client request and when received assign it to the // client socket // when u wanna send data to that client u'll use ...
6
public Collection<T> readAll() { SQLStrings.INSTANCE.getReadAllElementsString(); Collection<T> result = null; Connection conn = hsqlh.createConnection(); try { /* PreparedStatement prep_stmt = conn.prepareStatement(SQLStrings.INSTANCE.getReadAllElementsString()); prep_stmt.clearPar...
9
public boolean addWord(String word){ CharNode temporary_node; CharNode temporary_child; int i=1; if(word.length() <= 0) return false; if(this.head.getChar() != word.charAt(0)) return false; temporary_node = this.head; for(i=1; i < word.length(); ++i){ if((temporary_child = temporary_...
5
public void fulfillOrder() { try { PreparedStatement stmt = connection.prepareStatement("select sum(i.price * c.amount * d.percent) as total " + " from martitem i " + "join cartitem c on i.stock_number = c.stock_number " + "join discount d on d.status = ? " + "where trim(c.cid) = ? "); s...
3
public synchronized void handle(String userID, int ID, String input) { StringTokenizer in = new StringTokenizer(input, " "); String command = in.nextToken(); System.out.println(command); if (command.equals(".bye")) { clients[findClient(ID)].send(".bye"); remove(ID); } else if (command.equals(".create"))...
9
public ArrayList<String> theatricalsToList(){ ArrayList<String> temp = new ArrayList<>(); for (Theatrical theatrical : theatricals) { temp.add(theatrical.getName()); } return temp; }
1
public int readInput() { System.out.println("Vad vill du göra? "); System.out .println("1) Visa alla journaler \n 2) Visa en journal \n 3) ändra journal(er) \n 4) Skapa ny journal \n 5) Ta bort "); String input = scan.nextLine(); String addText = ""; if (input.equals( "1")) { System.out.println(s...
5
final boolean isValidHost() { anInt40++; String string = getDocumentBase().getHost().toLowerCase(); if (string.equals("jagex.com") || string.endsWith(".jagex.com")) return true; if (string.equals("runescape.com") || string.endsWith(".runescape.com")) return true; if (string.endsWith("127.0.0.1")) ...
9
public void editDataLevel(String name, double totalPoints) { path = name; File f = new File(plugin.getDataFolder() + File.separator + "Players" + File.separator + name + ".data"); try { if (!f.exists()) { saveDataFirst(name); } BufferedReader br = new BufferedReader(new FileReader(f)); FileWrite...
4
private List expandContext(List symbols) { List ne = new ArrayList(); for (int i = 0; i < symbols.size(); i++) { String s = (String) symbols.get(i); ArrayList replacementsList = new ArrayList(); for (int j = 0; j < contexts.length; j++) { List[] l = contexts[j].matches(symbols, i); for (int k = 0; ...
6
public void imc_process_call_outs() { if (call_outs.size() < 1) { return; } for (int i = 0; i < call_outs.size(); i++) { final Vector call_out = (Vector) call_outs.get(i); final String fun = (String) call_out.elementAt(0); final long hbeat = ( (Long) call_out.elementAt(1)).longValue(); final ...
8
public boolean imageUpdate(Image img, int flags, int x, int y, int width, int height) { String add = ", img: " + img + ", flags: " + flags + ", x/y: " + x + "," + y + ", width: " + width + ", height: " + height; if ((flags & ABORT) != 0) CoffeeSaint.log.add("Image aborted" + add); if ((flags & ALLBITS) != 0) ...
8
void writeRequest(OutputStream out) throws IOException { DataOutputStream data = new DataOutputStream(new BufferedOutputStream(out)); if ((doOutput) && (output == null)) { throw new IOException(Messages.getString("HttpsURLConnection.noPOSTData")); //$NON-NLS-1$ } if (ifModifi...
9
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...
7
public void changeCase(boolean upper) { for (int x = 0; x < grid.length; x++) { for (int y = 0; y < grid[x].length; y++) { String c = String.valueOf(grid[x][y]); c = upper ? c.toUpperCase() : c.toLowerCase(); grid[x][y] = c.charAt(0); } } }
3
public static void decodeFileToFile( String infile, String outfile ) throws java.io.IOException { byte[] decoded = Base64.decodeFromFile( infile ); java.io.OutputStream out = null; try{ out = new java.io.BufferedOutputStream( new java.io.FileOutputStrea...
2
public Object next() { Object o = null; // Block if the Queue is empty. synchronized(_queue) { if (_queue.size() == 0) { try { _queue.wait(); } catch (InterruptedException e) { r...
3
public void hit(GroupOfUnits target) { int no = 0; try { no = target.getNumber(); } catch (NullPointerException e) { return; } if (humanPlaying()) { if (currentUnit.type.shooting) { gui.Sound.play("sound/shot.wav"); } else { gui.Sound.play("sound/attk.wav"); } } QApplication...
5