text
stringlengths
14
410k
label
int32
0
9
@Override public void executeTask() { /* Redundant code here in the event Server and Client start diverting. */ try { /* Casting to appropriate object. */ switch (node.NODE) { case SERVER: { server = (Server) node; if (RoutingTable.getInstance().registerServer(server)) { System.out.println(...
7
public List<Strichart> getAlleStricharten() { ResultSet resultSet; List<Strichart> listeStricharten = new ArrayList<Strichart>(); try { resultSet = db .executeQueryStatement("SELECT * FROM Stricharten"); while (resultSet.next()) { listeStricharten.add(new Strichart(resultSet, db)); } resultSe...
2
@Override protected void initPrototypeId(int id) { String s; int arity; switch (id) { case Id_constructor: arity=1; s="constructor"; break; case Id_toString: arity=1; s="toString"; break; case Id_toLocaleString: arity=1; s="toLocaleString";...
8
@Override public String strip(String s) throws Exception { int length = s.length(); if (oldChars.length < length + 1) { oldChars = new char[length + 1]; } s.getChars(0, length, oldChars, 0); oldChars[length] = '\0'; // avoiding explicit bound check in while ...
5
public static boolean printText(int textId) { switch(textId) { // texts taken from http://www.mahnerfolg.de/ case 1: System.out.printf("Sehr geehrter Herr Kunde,\n" + "\n" + "in Bezug auf unsere Rechnung Nr.: %d mussten wir heute feststellen, dass Ihre Zahlung bei uns noch nicht eingegangen...
3
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MessageBus other = (MessageBus) obj; if (mapSubscriberToTopics == null) { if (other.mapSubscriberToTopics != null) return false; } else ...
9
public boolean commit(){ if(isSetForCommitting()){ session.getTransaction().commit(); return true; } return false; }
1
public byte[] toByteArray() { return cw == null ? null : cw.toByteArray(); }
1
public static Color convertStringToColor(String in) { Color out = Color.black; if (in.equals("yellow")) { out = Color.yellow; } else if (in.equals("blue")) { out = Color.blue; } else if (in.equals("red")) { out = Color.red; } else if (in.equals("green")) { out = Color.green; } return out; }
4
public void stopGame() { // Setting isRunning to false will // make the thread stop (see run()) this.isRunning = false; // Unset the game model... this.view.setModel(null); // Stop listening for events this.view.removeKeyListener(this.keyListener); // Make sure we wait until the thread has stopped......
3
public synchronized boolean deleteVar(String key) { Utils.logger.log(Level.INFO, "Deletting var " + key); List<String> oldConfiguration; oldConfiguration = this.currentConfig; FileWriter fileWriter; try { fileWriter = new FileWriter(this.configFile, false); } catch(final IOException exception) { ...
4
private static void validateAmt(char[][] vMap) { int manAmt = 0, boxAmt = 0, aimAmt = 0; for (char[] row : vMap) { for (char cell : row) { switch (cell) { case SokobanMap.AIM_CHAR: aimAmt++; break; case SokobanMap.BOX_CHAR: boxAmt++; break; case SokobanMap.MAN_CHAR: manAm...
9
public static boolean deleteFile(File file) { if (file.isDirectory()) { String[] children = file.list(); for (int i = 0; i < children.length; i++) { if (!deleteFile(new File(file, children[i]))) { return false; } } } return file.delete(); }
3
private String readInput() throws IOException { return this.keyboard.readLine(); }
0
@Override public void actionPerformed(ActionEvent e) { //System.out.println("ChangeFocusAction"); OutlinerCellRendererImpl textArea = null; boolean isIconFocused = true; Component c = (Component) e.getSource(); if (c instanceof OutlineButton) { textArea = ((OutlineButton) c).renderer; } else if (c i...
8
public void printCita(int codpac, int numcita)throws IOException{ if(pacienteExiste(codpac)){ String nompac = rpacs.readUTF(); String citapath = getCitaPath(nompac, codpac, numcita); File cita = new File(citapath); if(cita.exists()){ S...
5
public void render() { AbstractAlgorithm imgGen; /* * Now generate the appropriate image! Done separate to above so will * re-draw whenever any button is pressed. */ double scaleSize = gui.getScaleSize(); int width = (int) (gui.imageWidth() / scaleSize), height = (int) (gui .imageHeight() / scaleSi...
3
public void setBackLeftTrim(int backLeftTrim) { this.backLeftTrim = backLeftTrim; if ( ccDialog != null ) { ccDialog.getTrim3().setText( Integer.toString(backLeftTrim) ); } }
1
public byte[] gextractEncPayload() { int i, j, k = 0, n_ent; int total_size; byte[] temp; total_size = gmeasureEncPayload(); if (total_size == 0) return null; n_ent = encrypted_truth_table.size() ; // Create a result byte array with the appropriate size ...
7
public ImageIcon getImageIcon(byte imageData[], int size) throws IOException { if(imageData==null) return null; ImageIcon ico = new ImageIcon(imageData); int h=ico.getIconHeight(); int w=ico.getIconWidth(); if(size<=0)// || (h <= size && w <= size)...
3
protected void linkProgram(List<VertexAttrib> attribLocations) throws LWJGLException { if (!valid()) throw new LWJGLException("trying to link an invalid (i.e. released) program"); uniforms.clear(); // bind user-defined attribute locations if (attribLocations != null) { ...
9
public void SetOver(boolean isOver){ boolean test = false; if (test || m_test) { System.out.println("GameWindow :: SetOver() BEGIN"); } getDrawing().SetOver(isOver); if (test || m_test) { System.out.println("GameWindow :: SetOver() END"); } }
4
private boolean r_postlude() { int among_var; int v_1; // repeat, line 70 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 70 ...
8
public static Vector<String> getAllProxyIPs(String ipLibURL) throws ClientProtocolException, IOException, URISyntaxException { Vector<String> IPsPageLinks = getIPsPageLinks(ipLibURL);// "http://www.youdaili.cn/" Vector<String> onePageIPs = new Vector<String>(); Vector<String> allIPs = new Vector<String>(); f...
9
@Override public HeightMap applyTo(HeightMap... heightMaps){ double[][] finalHeights = new double[heightMaps[0].getHeights().length][heightMaps[0].getHeights()[0].length]; for(HeightMap heightMap: heightMaps) { double[][] currentHeights = heightMap.getHeights(); for (int x = ...
4
public static boolean isIsomorphic(String one, String two) { if (null == one || null == two) { return false; } if (one.length() != two.length()) { return false; } if (one.length() == 1) { return true; } Map<Character, Integer> ...
9
public boolean isValidSudoku(char[][] board) { int i ,j, k = 0; for (i = 0; i< 3; i++) { for (j =0; j<9; j++) choice[i][j] = new HashSet<Integer>(); } for (i = 0;i<9;i++) for (j = 0 ;j< 9 ; j++) { if (board[i][j] == '.') { k ++ ; }e...
6
public Object nextContent() throws JSONException { char c; StringBuffer sb; do { c = next(); } while (Character.isWhitespace(c)); if (c == 0) { return null; } if (c == '<') { return XML.LT; } sb = new Str...
7
protected void saveClusterer(String name, Clusterer clusterer, Instances trainHeader, int[] ignoredAtts) { File sFile = null; boolean saveOK = true; int returnVal = m_FileChooser.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { sFile = m_FileChooser.getSelectedFile...
7
public static ArrayList<bConsulta2> getMediaHoras(String data_in, Integer gmp, String arg_prod) throws SQLException, ClassNotFoundException { ArrayList<bConsulta2> sts = new ArrayList(); Connection conPol = conMgr.getConnection("PD"); ResultSet rs; if (conPol == null) { throw...
3
private Token matchNumber() { SourcePosition pos = new SourcePosition(lineNo, columnNo); StringBuilder sb = new StringBuilder(); boolean decimal = false; int character = lookAhead(1); while ((character >= '0' && character <= '9') || character == '.') { if (decimal && ...
6
public static void main(String[] args) { String ficPropertiesJdbc = "gsbJdbc.properties"; // nom du fichier de properties Properties propertiesJdbc; // objet de propriétés (paramètres de l'appplication) pour Jdbc FileInputStream input; ...
5
public static int RoomService(Client joueur) { int tempDette = 0; int choiceInt = -1; boolean wrong = false; System.out.println("Que voulez vous prendre?" + "\n pour de la nourriture tapez 1 (20€)" + "\n pour de la boisson tapez 2"); do { ...
6
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); AccessPerfiles accessPerfiles; try { accessPerfiles = em.getRef...
7
protected void checkForHit(){ if (ballX>=(paddleX-ballSize)) { //check for a hit if (ballY>=paddleY-ballSize+1 && ballY<=paddleY+paddleLength-1) { hits++; dx=left; dy=0; // this is a direct hit int paddleCenter = paddleY + paddleLength/2; int ballCenter = ballY + ballSize/2; double offset = ballCe...
5
private Individual tournamentSelection(Population pop) { //Create a tournament population Individual[] tournament = new Individual[GeneticAlgorithmConstants.TOURNAMENT_SIZE]; //For each place in the tournament get an individual for (int i = 0; i < tournament.length - 1; i++) { ...
7
@Override public void onEnable() { // Load config File configFile = new File(this.getDataFolder(), "config.yml"); if(!configFile.exists()) { configFile.getParentFile().mkdirs(); copy(this.getResource(configFile.getName()), configFile); } ...
6
private void managementPlanUpdate() { // TODO add your handling code here: //create an array of arrays to hold all values in chart form String tempArray[][]; if (!Stakeholders.isEmpty()){ tempArray = new String[Stakeholders.size()][10]; for (int i = 0; i < Stakeho...
6
public static double EuclideanDistance(ArrayList<Double> l1, ArrayList<Double> l2){ if(l1.size() != l2.size()){ System.err.print("erro in input size\n"); } int size = l1.size(); double sum = 0; for(int i = 0; i < size; i++){ sum += (l1.get(i) - l2.get(i)) ...
2
private static void remove(CuratorFramework client, String command, String[] args) throws Exception { if (args.length != 1) { System.err.println("syntax error (expected remove <path>): " + command); return; } String name = args[0]; if (name.contains("/")) { ...
3
@Override public TurnAction next() { // TODO Auto-generated method stub TurnAction nextPossibleAction = null; int checkedRow = currentRow; int checkedTokens = iteratedState.checkRow(checkedRow)- 1; boolean searchingForNext = !(checkedTokens >= 0); while(searchingForNext){ checkedTokens = iteratedState.c...
3
private static boolean validateStringLength(String param){ boolean isValid = false; if(param.length() > 0){ isValid = true; } return isValid; }
1
public static boolean isRequestEnd(byte[] request, int length) { if (length < 4) { return false; } return request[length - 4] == '\r' && request[length - 3] == '\n' && request[length - 2] == '\r' && request[length - 1] == '\n'; }
4
public void cargarTabla(int perfil){ System.out.println("tabla"); String[] columnas = getColumnas(); Class[] tipoDatosColumnas=getTipoColumnas(); Vector<Vector<Object>> contenidoTabla = new Vector(); contenidoTabla = getContenidoTabla(perfi...
5
public static void main(String[] args) { // TODO Auto-generated method stub try { char c = 'A'; int asc = (int) c; System.out.println(asc); String message = null; fr=new FileReader("MyTextFile.txt"); br =new BufferedReader(fr); message = br.readLine(); System.out.println(message); String ...
6
@Override public void run(int interfaceId, int componentId) { if (stage == -1) { sendDialogue(SEND_2_OPTIONS, new String[] { player.getDisplayName(), "I'd like to trade.", "Can you repair my items for me?" }); stage = 1; } else if (stage == 1) { if (componentId == 1) { sendEntityDialogue(SEN...
6
public static void main(String[] args) { int numero = 0,c = 0; for (int i = 0; i < 2; i++) { numero = Integer.parseInt(JOptionPane.showInputDialog(null, "Ingrese un Número Entero Positivo")); if (numero > 0) { i = 2; } ...
7
public double getSpeed(){ return this.speed; }
0
void requireWhitespace() throws java.lang.Exception { char c = readCh(); if (isWhitespace(c)) { skipWhitespace(); } else { error("whitespace expected", c, null); } }
1
public Widget createWidget(Composite parent, int style) { String tooltip = getTooltip(); GridData controlGD = new GridData( SWT.FILL, SWT.TOP, false, false ); // label if ( control.getLabel() != null ) { label = new Label( parent, SWT.NONE ); label.setText( control.getLabel() ); if ( tooltip != nul...
8
public static IntegrationMethods fromString(String name) { if (name != null) { for (IntegrationMethods b : IntegrationMethods.values()) { if (name.equalsIgnoreCase(b.name)) { return b; } } } return null; }
3
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
5
private void HelpInsert(IInfo<T> op){ if(op==null || !(op instanceof IInfo) ) return; CAS_CHILD(op.p, op.l, op.newInternal,op.stamps.pLeftStamp,op.stamps.pRightStamp); StateInfo<T> app = op.p.si.getReference(); if(app.isIFlag() && app.info == op){ op.p.si.compareAndSet(app, new StateInfo<T>(StateInfo.CLEA...
4
public boolean getBoolean(String key) throws JSONException { Object object = this.get(key); if(object.equals(Boolean.FALSE) || (object instanceof String && ((String) object).equalsIgnoreCase("false"))) { return false; } else if(object.equals(Boolean.TRUE) || (object instanceof String && ((Strin...
6
public double score(String dna) { if (logOdds == null) calcLogOddsWeight(); char bases[] = dna.toCharArray(); double score = 0; for (int i = 0; i < bases.length; i++) score += getLogOdds(bases[i], i); return score / length; // return ((double) score) / (length * SCALE); }
2
public CtConstructor getClassInitializer() { CtMember.Cache memCache = getMembers(); CtMember cons = memCache.consHead(); CtMember consTail = memCache.lastCons(); while (cons != consTail) { cons = cons.next(); CtConstructor cc = (CtConstructor)cons; i...
2
static String toHex4String(int pValue) { String s = Integer.toString(pValue, 16); //force length to be four characters if (s.length() == 0) {return "0000" + s;} else if (s.length() == 1) {return "000" + s;} else if (s.length() == 2) {return "00" + s;} else if (s.length() == 3) {re...
4
public Sound(String soundFile) { //soundFile is a .wav audio file from music file try { File file = new File(soundFile); if (file.exists()) { AudioInputStream sound = AudioSystem.getAudioInputStream(file); clip = AudioSystem.getClip(); clip.open(sound); } else {...
5
public boolean load() { if (!this.Valid) { return false; } int i2 = 24; try { DataInputStream localDataInputStream = new DataInputStream(this.rawdata); int i = localDataInputStream.readInt(); int j = localDataInputStream.readInt(); int k = localDataInputStream.readI...
5
public static boolean eat(final Player player, Item item, int slot) { Food food = Food.forId(item.getId()); if (food == null) return false; if (player.getFoodDelay() > Utils.currentTimeMillis()) return true; if (!player.getControlerManager().canEat(food)) return true; player.getPackets().sendGameMess...
9
public void action() { do { ACLMessage msgPerception = myAgent.blockingReceive(); // if(log.isLoggable(Logger.WARNING)) // try { // log.log(Logger.WARNING, "Nachricht empfangen: " + ((WumpusPerception) msgPerception.getContentObject()).toString()); // } catch (UnreadableException e1) { // // ...
4
public void shiftRelease() { HUD hud = null; for (int i = (huds.size() - 1); i >= 0; i--) { hud = huds.get(i); hud.shiftRelease(); } }
1
private void insertEmployeeIntoTable(Employee employee, int daysOfMonth) { if (employee.isCallWorker() || employee.isClerk() || employee.isMuseumEducator()) { Object[] fields = new Object[daysOfMonth + 3]; fields[0] = employee.getEmployeeNumber(); fields[1] = employee.getFull...
4
@Override public final void enter() { // cancel enter action if checkField caused a state change if (checkField()) { return; } menu.getContinueButton().setEnabled(true); IPlayer player = game.getCurrentPlayer(); // Only enable rolling if player has not ...
5
public boolean setItem(FieldItem item, Position position) { if (isOccupied(position)) { return false; } if (isInField(item)) { return false; } if (!item.getPosition().equals(position)) { return false; } field.put(position, item)...
3
public void startGame() { // Arrange pieces this.window.board.clearBoard(); this.window.board.arrangeWhitePieces(); this.window.board.arrangeBlackPieces(); // Game active this.isActive = true; // White and black player this.playerWhite = new Player(true); this.playerBlack = new Player(false); ...
0
private void JBSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JBSalvarActionPerformed try{ if(consultaAnt != null){ int linhaMedico = JTabelaMedico.getSelectedRow(); int linhaPaciente = JTabelaPaciente.getSelectedRow(); try{ ...
6
public GetSetPixelDemo() { MinuetoWindow window; // The Minueto window // Create a 640 by 480 window window = new MinuetoFrame(640, 480, true); // Show the game window. window.setVisible(true); MinuetoImage image = new MinuetoImage(640, 480); boolean first = true; // Game/rendering ...
5
public void setName(String name) { this.name = name; }
0
@Test public void wrap_book() { Book<Color, CopyPaper<Color>, Paper<Color>, List<CopyPaper<Color>>> book1 = new Book<Color, CopyPaper<Color>, Paper<Color>, List<CopyPaper<Color>>>(); BookBuilderSpec<?> bookBuilder = wrap(book1); assertTrue(book1 == bookBuilder.getWrappedObject()); Book<? exte...
9
public void findSignChange() { double upLim = this.upLimPlus(); double lowLim = this.lowLimNeg(); // Choosing delta for intervals double delta = (Math.abs(upLim) + Math.abs(lowLim)) / 10000; System.out.println("delta = " + delta); double point1 = lowLim; double po...
2
public static int lcs(String a, String b) { int lenA = a.length(), lenB = b.length(); int[] x = new int[lenB + 1]; int[] y = new int[lenB + 1]; int[] w = new int[lenA]; for (int i = 0; i <= lenA; i++) { for (int j = 0; j <= lenB; j++) { if (i == 0 || j...
7
@Override public GameState[] allActions(GameState state, Card card, int time) { GameState[] states = new GameState[1]; states[0] = state; if(time == Time.DAY) { GameState frenchState = new GameState(state); states = new GameState[]{frenchDay(frenchState,card,false)}; } else if(time == Time.DUSK...
3
public void blink() { if (getWorld().getObjects(Dolphin.class).size() != 0) { getXD = ((Dolphin) getWorld().getObjects(Dolphin.class).get(0)).getX(); getYD = ((Dolphin) getWorld().getObjects(Dolphin.class).get(0)).getY(); setLocation(getXD + 30, getYD + 25); } ...
6
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("Visist Handler"); HttpSession session = request.getSession(); if(session.getAttribute("user") != null && !session.getAttribute("user").equals("")){ response.sendRedirect("2....
2
@Override public void addUser(UserDTO user) throws SQLException { Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.save(user); session.getTransaction().commit(); } ...
3
@Override public boolean execute(Player player) { if(!this.hasSecondWord()) { // if there is no second word, we don't know where to go... GameEngine.gui.println("Go where?"); return false; } String direction = this.getSecondWord(); // Try to leave c...
3
private double getSautDeGeneration() { return Double.parseDouble(vTxtGeneration.getText()); }
0
public static void main(String[] args) { try { String currentPath = System.getProperty("user.dir"); System.out.println("currentPath :" + currentPath ); ComJdbc.connection( currentPath + File.separator + "configdb.properties"); ConfigGetDb getsql = new ConfigGetDb(currentPath + File.separator ...
4
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!(affected instanceof MOB)) return true; final MOB mob=(MOB)affected; if((msg.amISource(mob)) &&(msg.tool() instanceof Ability)) { if(remember.contains(msg.tool())) return true; if(forgotten.contains(msg.tool(...
7
public Core() { infoPacksByType = new HashMap<Class<? extends IInfoPack>, IInfoPack>(); systems = new ArrayList<ISystem>(); entitiesByID = new HashMap<String, IEntity>(); entitiesByPack = new HashMap<Class<? extends IInfoPack>, List<IEntity>>(); handlersByMessage = new HashMap<Cl...
4
private String makeDurationString(Duration dur) { Dur d = VEventHelper.durationToICALDur(dur); String out = ""; int days = d.getDays(); if (days > 0) out += days + " " + (days == 1 ? ApplicationSettings.getInstance().getLocalizedMessage("lvip.day") : ApplicationSettings.getInstance().getLocalizedMessage("lvi...
8
public synchronized void publishCurrentMarket(MarketDataDTO md) throws Exception { int bv = md.buyVolume; int sv = md.sellVolume; String product = md.product; String exString = "publishers.CurrentMarketPublisher#publishCurrentMarket"; if (ExceptionHandler.checkIntNegative(bv, exS...
8
public static void asm_incf(Integer akt_Befehl, Prozessor cpu) { Integer f = getOpcodeFromToBit(akt_Befehl, 0, 6); Integer result = cpu.getSpeicherzellenWert(f) + 1; // Speicherort abfragen if(getOpcodeFromToBit(akt_Befehl, 7, 7) == 1) { // in f Register speichern cpu.setSpeicherzellenWert(f, result, t...
1
public static int randomized_partiton(int[] array, int start, int end){ Random r = new Random(); int a = r.nextInt(end); while(a < start){ a = r.nextInt(end); } exchange(array,a,end); return partition(array,start,end); }
1
public static String getLibraryTitle(Class<?> libraryClass) { if (libraryClass == null) { errorMessage("Parameter 'libraryClass' null in method" + "'getLibrayTitle'"); return null; } if (!Library.class.isAssignableFrom(libraryClass)) { errorMessage("The specified class does not extend class " +...
4
@EventHandler(ignoreCancelled = true) public void onBreak(BlockBreakEvent event) { Arena arena = OITG.instance.getArenaManager().getArena(event.getPlayer()); if (arena != null && !arena.isBlockBreakingAllowed()) { event.setCancelled(true); event.getPlayer().sendMessage(OITG.p...
4
public void eliminarAntesDeX(T x){ Nodo<T> q = this.p; Nodo<T> t = new Nodo<T>(); Nodo<T> r = new Nodo<T>(); boolean bandera = true; if(this.p.getValor() == x){ System.out.println("No hay valor que proceda de que contenga X"); }else{ q = this.p; t = this.p; while(q.getValor() != x && bandera){ ...
6
@BeforeClass public static void setUpBeforeClass() throws Exception { //Prints.msg("BeforeClass <--> Passei pelo setUpBeforeClass - Antes da classe."); }
0
public void backToMenu() { int reply = JOptionPane.showConfirmDialog(null, "Would you like to return to the Main Menu?"); if(reply == JOptionPane.YES_OPTION) { timer.stop(); reply = JOptionPane.showConfirmDialog(null, "Would you like to save your progress before quiting?"); if(reply == JOptionPane.YES_O...
6
@Override public void startSetup(Attributes atts) { super.startSetup(atts); addActionListener(this); } // end method startSetup
0
public void write(String msg) { if (!isPaused) { try { fileWriter.write(msg + LINE_END); fileWriter.flush(); } catch (IOException ioe) { System.out.println("IOException: " + ioe); } } }
2
public CacheEntry[] getCacheEntries() { List<CacheEntry> result = new ArrayList<CacheEntry>(17); for(final Class<?> cacheType: caches.keySet()) { Cache cache = caches.get(cacheType); for (final Object readerKey : cache.readerCache.keySet()) { // we've now materialized a hard ref ...
6
@Override public void validateCredentials(final String consumerKey, final String consumerSecret) throws IOException { if(twitterOAuthCredentials == null) twitterOAuthCredentials = new TwitterOAuthCredentials(); twitterOAuthCredentials.setOAuthConsumerKey(consumerKey); twitterOAuthCredentials.setO...
3
private static void backward() { destination.remove(MAN); source.add(MAN); if (!isSomethingWillBeEaten(destination)) { return; } for (int i = 0; i < destination.size(); i++) { if (destination.get(i).equals(lastTransfer)) { continue; } ArrayList<String> sourceSimulator = new ArrayList<String>...
5
public void fillWithNoise(CPRect r) { CPRect rect = new CPRect(0, 0, width, height); rect.clip(r); int value; Random rnd = new Random(); for (int j = rect.top; j < rect.bottom; j++) { for (int i = rect.left; i < rect.right; i++) { value = rnd.nextInt(); value &= 0xff; value |= (value << 8) | ...
2
public void visitInsn(final int opcode) { minSize += 1; maxSize += 1; if (mv != null) { mv.visitInsn(opcode); } }
1
@Override public void run() { int sum = 0; for(int i = 1; i <= 1000; i++) { // System.out.println(" " + sum); if(i == 100) { sum += 10; continue; } if(m_numberMap.containsKey(String.valueOf(i))) { sum += m_numberMap.get(String.valueOf(i)).getLength(); // System.out.print(m_numberMa...
7
public void calcTargets(int location, int steps){ visited[location] = true; if(steps == 0){ targets.add(location); } else{ try{ if(!getAdjList(location).isEmpty()){ for(int adj : getAdjList(location)){ if(!visited[adj]){ if(getCell(adj).isDoorway()){ if( checkDoorDirection(ge...
7
@Override public int indexOf(Object o) { if (o == null) { for (int i = 0; i < array.length; i++) if (array[i] == null) return i; } else { for (int i = 0; i < array.length; i++) if (o.equals(array[i])) ret...
5