text
stringlengths
14
410k
label
int32
0
9
public static String toEnumName(String s) { StringBuilder b = new StringBuilder(s); while (b.length() > 0 && !Character.isLetter(b.charAt(0))) b.deleteCharAt(0); while (b.length() > 0 && !Character.isLetter(b.charAt(b.length() - 1))) b.deleteCharAt(b.length() - 1); for (int i = 0; i < b.length(); i++) { ...
7
public static boolean isValidXML(String path) throws IOException { File f = new File(path); if (f.exists() && !f.isDirectory()) { // check if XML String extension = ""; int i = path.lastIndexOf('.'); if (i > 0) { extension = path.substring(i + 1); if (extension.equalsIgnoreCase("XML")) { ...
4
public mjDate Djcl(double djm) throws palError { double f, d; long jd, n4, nd10; Status = 0; TRACE("Djcl"); /* Check if date is acceptable */ if ((djm <= -2395520.0) || (djm >= 1e9)) { Status = -1; throw new palError(Status, "Djcl: unacceptable da...
4
public static boolean checkCurrentPresentation(String presentationLocation){ //get an identifier for the file long hash = hash(presentationLocation); try { File conFile = new File(CONFIG_PATH); if(conFile.exists()){ FileInputStream fileStream = new FileInputStream(conFile); DataInputStream dataStre...
7
private void retrieveElements(NodeList nodeList) throws IOException, ParserConfigurationException, SAXException{ // Retrieve every element from the list for (int count = 0; count < nodeList.getLength(); count++) { Node tempNode = nodeList.item(count); // make sure it's element no...
7
public void fillList() { BufferedReader reader; try { reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/variables")); String line; while((line = reader.readLine()) != null) { listModel.addElement(line); } listModel.addElement(null); reader.close...
3
private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed // TODO add your handling code here: String str; DefaultListModel wq = new DefaultListModel(); str = (String) this.jComboBox5.getSelectedItem(); //Juego q =new Juego(...
3
public List<CreativeMaterial> getCreativeMaterialList() { return creativeMaterialList; }
0
public ListNode reverseK(ListNode head, int k) { if (head == null || head.next == null) return head; ListNode tmp = head; int i = 0; while (i < k) { if (tmp == null) // not enough node to reverse, return null return tmp; tmp = tmp.next; i++; } i = 0; while (i < k) { tmp = tmp.next; i...
8
private boolean isDragOk(final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt) { boolean ok = false; // Get data flavors being dragged java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors(); // See if any of the flavors are a file list int i = 0; while (!ok && i < fl...
7
dxVertexLayout(D3DToolkit d3dtoolkit, Class207[] class207s) { VertexElementCollection vertexelementcollection = new VertexElementCollection(d3dtoolkit.aTi9201); int i = 0; for (int i_0_ = 0; class207s.length > i_0_; i_0_++) { int i_1_ = 0; Class207 class207 = class207s[i_0_]; for (int i_2_ = 0; i_2_ < cl...
9
public static Productos sqlLeer(Productos prod){ String sql="SELECT prod.*, " + "ca.nombre as nombreCat" + ", sc.nombre as nombreSub" + ", ti.nombre as nombreTitulo" + " FROM cat_subcat_tit_attr_descr prod " + "INNER JOIN categorias...
2
private void init() throws ClusterException { int i= 0; for(i= 0; i< this.clusterNumber; ++i) { Song s= this.songList.get(i); Cluster c= this.clusterList.get(i); c.assignSong(s); c.resetCentroid(); } for(; i<this.songList.size(); ++i) { Song s= this.songList.get(i); int clust= this.f...
2
public void updateDeps(){ for (GameComponent component:components){ component.init(); } }
1
public void save(){ if(this.getId() != null){ String sql = "DELETE FROM crew_log " + "WHERE crew_log.crew = ?"; try { PreparedStatement preparedStatement = Crew.getConnection().prepareStatement(sql); preparedStatement.setInt(1, this.get...
6
public void setMinuto(int minuto) { this.minuto = (minuto >= 0 && minuto < 60) ? minuto : 0; }
2
@Override public void run() { try { if(RealWeather.isGlobalyEnable() & !player.getGameMode().equals(GameMode.CREATIVE)) { double temperature = plugin.checkCenter.getTemperature(player.getLocation(), player); if(plugin.playerHeatShow.get(player.getEntityId()).equal...
7
public void verificaAcertos(JLabel lbAcerto,JButton botao, String operacaoAtual) { if (operacaoAtual == "+") { if (fabrica.getResultadoSoma() == Integer.parseInt(botao.getText())) { lbAcerto.setText( String.valueOf(Integer.parseInt( ...
8
public void storeCredit() throws IOException { int totalInputs = Integer.parseInt(fileReader.nextLine()); Map<String, ArrayList<Integer>> keyValue = new HashMap<String, ArrayList<Integer>>(); int i = 1; while (fileReader.hasNext()) { int credit = Integer.parseInt(fileReade...
8
@Test public void LongName() throws Exception { LoginCheck logCh = new LoginCheck(); name = "ValentinaTemofeevnaReznicova88888888888"; if (kesh.containsKey(name)) { assertFalse(kesh.get(name)); } else { boolean result = logCh.validate(name); kesh.p...
1
public JSONObject accumulate(String key, Object value) throws JSONException { testValidity(value); Object object = this.opt(key); if (object == null) { this.put(key, value instanceof JSONArray ? new JSONArray().put(value) : value); ...
3
public boolean actionReassemble(Actor actor, Venue site) { final Item sample = Item.withReference(SAMPLES, ARTIFACTS) ; final Structure s = site.structure() ; final float AAU = s.upgradeLevel(ExcavationSite.ARTIFACT_ASSEMBLY), SPU = s.upgradeLevel(ExcavationSite.SAFETY_PROTOCOL) ; ...
5
public boolean segmentActive(boolean timeT, boolean activeState) { int count = 0; if(activeState == true){ for(Synapse s : synapses){ if(s.isConnected() && s.destRegion.columns[s.destCoor[0]][s.destCoor[1]].cells[s.destCoor[2]].getActiveState(timeT)==true){ count++; } } if(count>this.synapses....
9
public void save(){ try{ // Create file FileWriter fstream = new FileWriter("save.txt"); BufferedWriter out = new BufferedWriter(fstream); out.write( pelaajat.get(0).getNimi() + "\n" + pelaajat.get(1).getNimi() + "\n"); if(currentPelaaja==0){ out.write(1+"\n"); } else{ out.writ...
6
public Command newInstance(byte[] b, int start, int len) throws CRCException { if(len<8) { return null; } if(b[start]!=AbstractCommand.CMD_START){ return null; } switch (b[start+7]&0xff) { case Ping.CMD_PING: return new Ping(b,start,len); case Reset.CMD_RESET: return new Reset(b,start,len)...
8
public void addXp(int skill, double exp) { if (player.xpLock == true) { return; } exp *= 90; player.getControlerManager().trackXP(skill, (int) exp); int oldLevel = getLevelForXp(skill); xp[skill] += exp; xpCounter += exp; refreshXpCounter(); if (xp[skill] > MAXIMUM_EXP) { xp[skill] = MAXIMUM_...
9
private static void saveAndGet() { try { // connect to mongoDB, ip and port number Mongo mongo = new Mongo("localhost", 27017); // get database from MongoDB, // if database doesn't exists, mongoDB will create it automatically DB db = mongo.getDB("paldb"); // Get collection from MongoDB, database n...
3
public void cellError() { List<OpenCellIdCell> cells = parseCells( "/Users/Johan/Documents/CellTowers/cells_exact_samples67-120_2036.json", 150, 100, 50000); for(OpenCellIdCell cell : cells) { if(cell.getMcc() == 262 && cell.getNet() == 7 && cell.getArea() == 30605 && cell.getCell() == 342) { ...
5
public boolean setDestination(Vector3D dest) { if (getBrain().isDebugging()) getBrain().println("Navigator asked to plot path from " + getBrain().getLocation() + " to " + dest); uk.ac.derby.GameEngine2D.Map map = getBrain().getBlurredMap(mapScale, mapBlur); // Get start of A* (which is where we want to go) loc...
7
public static boolean createTable(String tableName, String[] columns, String[] dims) { String query = ""; try { if (conn == null || conn.isClosed()) open(); statement = conn.createStatement(); query = "CREATE TABLE " + tableName + " ("; for (int i = 0; i < columns.length; i++) { if (i != 0) {...
5
public AddBasicIngredientDialog(java.awt.Frame parent, boolean modal, AddBasicIngredientDelegate delegate) { super(parent, modal); initComponents(); this.delegate = delegate; this.model = new BasicIngredientModel(); setLocationRelativeTo(null); setTitle("Ingrediënt toevoegen"); // supplierOutlet.setModel(Combo...
7
private boolean horizontalAligned(int i, int j) { int height = grid.getHeight(); int width = grid.getWidth(); if (i < 0 || j < 0 || i >= height-2 || j >= width) return false; if (grid.casesEqual(grid.getCase(i, j), grid.getCase(i + 1, j), grid.getCase(i + 2, j))) return true; return false; }
5
public String getToolTip() { return "Expand Group on Terminal"; }
0
@Override public LRInterface handle(){ if("LR".equals(this.type)){ LRResponse lrr = LRResponse.createLRResponse(message); if ("register".equals(lrr.getType()) && "error".equals(lrr.getStatus())){ return new LRClientSideResponse("register", lrr.getMessage(), lrr.getComponent()); } if ("register".equal...
9
@Override public Block next() throws InterpreterException { boolean b = false; try { Value v = condition_.run(this); b = v.getBoolean(); } catch (Exception e) { throw new InterpreterException(e.getMessage(), getLine()); } if (b) { try { return parseForRun(); } catch (InterpreterException e...
4
public double getFastValue(double x) { // Fast check to see if previous index is still valid if (storageIndex > -1 && storageIndex < len.length-1 && x > len[storageIndex] && x < len[storageIndex + 1]) { } else { int index = Arrays.binarySearch(len, x); if (index > 0) { return pos1D[index]; ...
6
private double readDouble() { long value = 0; for (int i = 0; i < 8; i++) value = (value << 8) + readByteAsInt(); return Double.longBitsToDouble(value); }
1
public synchronized void editar(int i) { try { new AreaConhecimentoView(this, list.get(i)); } catch (Exception e) { } }
1
public void curReservations() { cur_reservations.removeAll(cur_reservations); try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { System.out.println("Where is your MySQL JDBC Driver?"); e.printStackTrace(); } Pre...
6
private void placeBlock(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_placeBlock // TODO add your handling code here: Point p = evt.getPoint(); int column = (int) (p.x / fieldPanel.getBlocksize()); int row = (int) (p.y / fieldPanel.getBlocksize()); String name = getSelectedButtonName(blocks); ...
3
@Override public List<Implique> getImpliques() throws BadResponseException { List<Implique> impliques = new ArrayList<Implique>(); JsonRepresentation representation = null; // R�cup�ration de la liste des messages Representation repr = serv.getResource("intervention/" + interId + "/implique", null); try { ...
4
@Override @ForceInline public Stream<T> peek(Consumer<? super T> action) { int op = OP_PEEK; Object lambda = action; int op0 = this.op0; Object lambda0 = this.lambda0; int op1 = this.op1; Object lambda1 = this.lambda1; int op2 = this.op2; Object lambda2 = this.lambda2; int op3 = ...
9
private void addParam(String paramName, Integer index, Map<String, Integer> paramIndexes) { if (paramIndexes == null) { return; } Integer annotationIndex = paramIndexes.get(paramName); if (annotationIndex != null) { LOGGER.info("已经存在@Param注(\"" + paramName + "\")解"); return; } paramIndexes.put(para...
2
public float blendValAt(float x, float y, float stepFade) { x = Visit.clamp(x, 0.5f, size - 0.5f) ; y = Visit.clamp(y, 0.5f, size - 0.5f) ; if (stepFade < 0) stepFade = 0 ; float sum = 0, weight = 1, sumWeights = 0 ; int minX, minY, maxX, maxY, range ; float pX, pY, aX, aY ; for (int h ...
4
public Vector<Customer> filter(Customer customer) { Vector<Customer> cV = new Vector<Customer>(); try { Connection conn = Database.getConnection(); String sql = "SELECT * FROM Customer"; String where = ""; if (customer.getCustomerName() != null) { ...
7
public void callEvent(Event event) { EventList events = event.getEvents(); RegisteredListener[] listeners = events.getRegisteredListeners(); for (RegisteredListener listen : listeners) { try { listen.execute(event); } catch (Exception e) { server.Log("==!EVENT ERROR!=="); e.printStackTrace();...
2
public boolean hitTest( int index , int xOff , int yOff , int x , int y ) { if( !ready ) return( false ); int px = BasicEngine2D.getDisplay().xHalf+xOff-xHalf; // как некрасиво... Возможно я зря начал все эти попытки приведения систем координат и их следует убрать? int py = BasicEngine2D.getDisplay().yHalf-y...
6
public VariableStack mapStackToLocal(VariableStack stack) { VariableStack newStack; int params = instr.getFreeOperandCount(); if (params > 0) { this.stack = stack.peek(params); newStack = stack.pop(params); } else newStack = stack; trueBlock.jump.stackMap = newStack; if (jump != null) { jump.st...
2
@Override public void setValue(int row, int col, double value) throws MatrixIndexOutOfBoundsException { if ((row < 0) || (col < 0) || (row >= mas.length) || (col >= mas[0].length)) { throw new MatrixIndexOutOfBoundsException("Inadmissible value of an index."); } mas[row][col] = (...
4
private Image getImageForFigure(int color, int type) { String filename = ""; filename += (color == Figure.COLOR_WHITE ? "w" : "b"); switch (type) { case Figure.TYPE_BISHOP: filename += "b"; break; case Figure.TYPE_KING: ...
8
public static int[][] updateTilesValue(int[][] tiles, int x, int y){ int[][] result = new int[tiles.length][tiles[0].length]; for(int i=0; i<tiles.length; i++){ for(int j=0; j<tiles[i].length; j++){ result[i][j] = tiles[i][j]; } } if(x >= 0 && y >= 0 && x < tiles.lengt...
6
private void setSelectedCellContents (int availabilityCode) { int cols[] = rosterTable.getSelectedColumns(); int rows[] = rosterTable.getSelectedRows(); for (int column: cols) { for (int row: rows) { rosterTableModel.setValueAt(availabilityCode, row, column); } } }
2
@Override public void setDirectory(String directory) { this.directory = directory; }
0
public void render(int mx, int my, boolean[] buttonsPressed) { super.render(mx, my, buttonsPressed); for(int i = 0 ; i < this.slots.length ; i++) { this.slots[i].render(mx, my, buttonsPressed); } if(player.selectedStack != null) { player.selectedStack.item.renderInventory(mx, my, 20, 20); ...
6
public void handleInput(String input) { if (input.equalsIgnoreCase("exit")) { //exit exit = true; } else if (input.equalsIgnoreCase("search")) { //search handleSearch(); } else if (input.equalsIgnoreCase("display...
3
public MinuetoRectangle(int sizeX, int sizeY, MinuetoColor color, boolean fill) { /* When subclassing to a class with multiple constructor,it's * important to specify which constructor to use. */ super(); if (sizeX < 1) throw new MinuetoZeroNegativeException("Cannot create rectangle of width " + siz...
4
public AdjacencyList getMinBranching(Node root, AdjacencyList list){ AdjacencyList reverse = list.getReversedList(); // remove all edges entering the root if(reverse.getAdjacent(root) != null){ reverse.getAdjacent(root).clear(); } AdjacencyList outEdges = new AdjacencyList(); // for each node, select the...
8
private double backwardPropagateDelta(double[] output) { double error = 0.0; for(int i = 0; i < delta[n - 1].length - 1; i++) { double o = x[n - 1][i]; delta[n - 1][i] = o * (1.0 - o) * (output[i] - o); error += Math.pow(output[i] - o, 2.0); } delta[n - 1][delta[n - 1].length - 1] = 0....
4
private void create() { this.settingsPanel = new JPanel(); this.settingsPanel.setBackground(GUIConstants.DEFAULT_BACKGROUND); this.settingsPanel.setLayout(new BorderLayout()); this.basePanel.add(this.settingsPanel, BorderLayout.CENTER); { JPanel leftPanel = new JPane...
8
@Override public void Insertar(Object value) { Session session = null; try { Equipo equipo = (Equipo) value; session = NewHibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.save(equipo); } catch (HibernateExce...
2
private void setSala(String codigo, TipoSala tipo, int capacidade) { setCodigo(codigo); setTipo(tipo); setCapacidade(capacidade); }
0
public static Condition getConditionsRecursive(String schemaName, WhereConditionGroup whereConditionGroup, Boolean useSchemaName, Boolean useAlias) { Condition...
9
public static double logisticInverseCDF(double mu, double beta, double prob) { if (prob < 0.0 || prob > 1.0) throw new IllegalArgumentException("Entered cdf value, " + prob + ", must lie between 0 and 1 inclusive"); double icdf = 0.0D; if (prob == 0.0) { icdf = Double.NEGATIVE_INFINITY; } else { if (prob...
4
public void cases(int i){ if(i==0){h=h+1;w=w-1;} if(i==1){h=h+1;} if(i==2){h=h+1;w=w+1;} if(i==3){w=w-1;} if(i==4){w=w+1;} if(i==5){h=h-1;w=w-1;} if(i==6){h=h-1;} if(i==7){h=h-1;w=w+1;} }
8
@Override protected List<Cluster<?>> cluster() { if (this.clusters == null) { this.clusters = new ArrayList<Cluster<?>>(); } for (Object r : this.sourceData) { if (!this.sourceData.isVisited(r)) { this.sourceData.setVisited(r,true); Cluster<?> c = this.rangeQuery(r); if (c.getRecords()...
8
private boolean isPossibleToPlaceDiagLeftAbove(int position, int dimension, int positionLeftAbove) { return elementDiagonallyLeftAbove(dimension, position, positionLeftAbove) >= 0 && (elementDiagonallyLeftAbove(dimension, position, positionLeftAbove)) % dimension >= 0; }
1
private void init(GL2 gl){ BufferedImage image; try{ image = ImageIO.read(new File(PATH_TO_TEXTURES+name)); } catch(IOException ie){ try { image = ImageIO.read(new File(name)); } catch (IOException ie2) { ie.printStackTr...
2
@Test public void test_removeMolecule_shouldReturnResourcesToWorldOnlyAfterAnUpdate() { // Create a fresh world. Tell it not to create seed molecules as this complicates our tests. world = new World(VALID_WIDTH, VALID_HEIGHT); world.shouldCreateSeed = false; // Create a "dead" molecule with a well-known co...
8
private int whichIsFirst(int... pos) { int minPos = -1; for (int i = 0 ; i < pos.length ; i++) { if (pos[i] < 0) { continue; } if (minPos < 0) { minPos = i; } else { if (pos[i] < pos[minPos]) { ...
4
public TSettingContainer(T[] values, List<?> list, String error) { if (list == null) return; container = new HashSet<T>(); for (Object obj : list) { if (obj == null || obj instanceof String == false) continue; boolean valid = false; for (T val : values) { if (val.toString()...
9
public Integer layerName(String layerName) { Integer layer; switch (layerName) { case "lobby": layer = 2; break; case "matchSetup": case "matchInplay": layer = 4; break; case "login": layer = 18; break; case "register": layer = 20; break; case "verify": layer = 22; break; ...
8
private boolean adjust(boolean condition) { if (length != -1) { totalLength -= length; // subtract old length } if (condition) { length = end() - start(); totalLength += length; // add new length if (max == null || doc() > max.doc() || (doc() == max.doc()...
6
private void startProcessDistribute(){ while(noStopRequested){ try{ workers.take().processResponse(this.readPool.take()); }catch(Exception e){ e.printStackTrace(); } } }
2
@Override public OreLookup lookup(String player, Integer time, List<Integer> restrict) { OreLookup ore = new OreLookup(player); List<String[]> blocks = this.coreprotect.performLookup(player, time, 0, null, restrict, null); for (String[] value : blocks){ ParseResult result = this.coreprotect.parseResult(value...
3
public static void main(String[] args) { System.out.println("Starting " + ARExample01.class.getSimpleName()); try { // First step: Initialises the GridSim package. int num_user = 1; // number of user entities boolean trace_flag = false; // true means trace GridSim...
5
@Override public void actionPerformed(ActionEvent e) { if(e.getSource() == openButton){ int returnVal = fc.showOpenDialog(PlayPanel.this); if(returnVal == JFileChooser.APPROVE_OPTION){ file = fc.getSelectedFile(); player = new Playback(file.getName()); currentFile.setText(file.getName()); } ...
5
public GrilleAbs (EnvironnementAbs env){ this.env = env; pan = new JPanel(); pan.setLayout(new GridLayout (env.taille_envi,env.taille_envi)); this.setPreferredSize(new Dimension(env.taille_case*env.taille_envi, env.taille_case*env.taille_envi)); this.setLocationRelativeTo(null); this.setLocation(100, 100);...
2
public void initiateCandidateSolutions(){ int columns = objectiveFunction.getVariables(); positions = new double[numberOfParticles][columns]; velocities = new double[numberOfParticles * 2][columns]; for(int i = 0; i < numberOfParticles * 2; i++){ for(int k = 0; k < columns; k++){ velocities[i][k] = 0; ...
4
public static String escape(String string) { StringBuffer sb = new StringBuffer(); for (int i = 0, length = string.length(); i < length; i++) { char c = string.charAt(i); switch (c) { case '&': sb.append("&amp;"); break; cas...
6
public String colorToString(){ switch (this.color){ case KARO: return "Karo"; case HERZ: return "Herz"; case PIK: return "Pik"; case KREUZ: return "Kreuz"; default: System.out.println("Farbe ist falsch! : "+this.color); return "-1"; } }
4
public void setComment(FileObject f,Picture picture){ if(picture != null){ try{ if(!(f.getComment().equals("")) && f.getComment() != null){ Comment comment = commentDao.findById(f.getComment()); if(comment != null){ beginTransaction(); List<Picture> pics = comment.getPictures(); pic...
6
@Override public String toString() {return String.valueOf(cur);}
0
void run(){ Scanner sc = new Scanner(System.in); for(;;){ a = new int[3][3]; for(int i=0;i<3;i++)for(int j=0;j<3;j++)a[i][j]=sc.nextInt(); M = sc.nextInt(); if(M<0)break; res = 0; u = new boolean[11]; for(int i=0;i<3;i++)for(int j=0;j<3;j++)u[a[i][j]] = true; u[M] = true; if(M>0)f(0, 0); ...
9
private void getRandomGUID(boolean secure) { MessageDigest md5 = null; StringBuffer sbValueBeforeMD5 = new StringBuffer(); try { md5 = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { System.err.println("Error: " + e); } t...
5
public static Stella_Object clTranslateSqlParameterTypeSpecifier(Stella_Object stellatype) { { Stella_Object result = null; if ((stellatype == null) || (stellatype == Sdbc.SYM_STELLA_NULL)) { } else { { GeneralizedSymbol testValue000 = ((GeneralizedSymbol)(stellatype)); ...
7
public int GetX() { return this.x; }
0
public static void Online() { List<String> onlineusers = new ArrayList(); for (ClientHandler clienthandler : clients) { onlineusers.add(clienthandler.getclients()); } for (ClientHandler clienthandler : clients) { clienthandler.sendOnlineUsers(onlineusers); ...
2
public static void saveProperties(Properties props, File propertyFile, String headerText) { OutputStream out = null; try { out = new FileOutputStream(propertyFile); if (StringUtils.isNotBlank(headerText)) { props.store(out, headerText); } } ca...
5
public static int findNumDays(String fileName) { int lineNumber = 0; String line; try { BufferedReader br = new BufferedReader( new FileReader(fileName)); while( (line = br.readLine()) != null) { lineNumber++; ...
3
public int getIndexOfChild(Row row) { if (canHaveChildren()) { return mChildren.indexOf(row); } return -1; }
1
public T2 getFoo2() { return foo2; }
0
public List<Message> page(final int index) { if (this.pageSize < 1) { if (index != 0) throw new IllegalArgumentException("page index not available: " + index); return this.contents; } final int last = ((index + 1) * this.pageSize) - 1; ret...
3
private static void assignRuntimeArgs(String[] a) { // error checks number of commands if (a.length != 5) { System.out .println("ERROR:\tMissing runtime commands. " + "You must enter a search term, min duration, max duration, quantity to download, and file type (eg: \"wav\", \"mp3\", \"ogg\")."); ...
3
public static void writeFile(String fileName) { if (fileName == null) // Go back to reading standard output writeStandardOutput(); else { PrintWriter newout; try { newout = new PrintWriter(new FileWriter(fileName)); } catch (Exception e) { ...
4
private void loadTiles() { int[] tileColours = this.image.getRGB(0, 0, width, height, null, 0, width); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { tileCheck: for (Tile t : Tile.tiles) { if (t != null && t.getLevelColour() == tileColours[x + y * width]) { this.ti...
5
public void spawnZerglings(Set<Unit> larvae, Set<Unit> completedSpawingPools) { if (completedSpawingPools==null || completedSpawingPools.isEmpty() || larvae==null || larvae.isEmpty()){ return; } for (Unit completedSpawningPool : completedSpawingPools) { for (Unit larva : larvae) { bwapi.morph(larva.g...
6
public int atoi(String str) { if (str == null || "".equals(str.trim())) return 0; str = filter(str); if (str.length() == 0) return 0; boolean negtive = (str.charAt(0) == '-'); str = str.substring(1); if (overfloor(str, negtive)) { if (negtive) return Integer.MIN_VALUE; el...
7
private static void bloquearCliente( Tienda tienda) { boolean salir; Integer idCliente; boolean bloqueo; char caracter; do { try { System.out.print( "Introduce el Id del cliente: "); idCliente = Integer.parseInt( scanner.nextLine()); bloqueo = tienda.getBloqueoCliente( idCliente); ...
3
static public List<GenericInputDevice> populateDeviceList() { List<GenericInputDevice> inputDeviceList = new ArrayList<GenericInputDevice>(); File inputDeviceDir = new File("InputDevices"); // if the directory does not exist, create it if (!inputDeviceDir.exists()) { System.out.println( "creating Datab...
6
public int getSelection() { if(selectionOvalY == 3) return 1; else if(selectionOvalY == 27) return 2; else if(selectionOvalY == 51) return 3; else if(selectionOvalY == 75) return 4; else if(selectionOvalY == 99) return 5; else if(selectionOvalY == 123) return 6; else if(se...
8