text
stringlengths
14
410k
label
int32
0
9
public ListNode mergeTwoLists(ListNode l1, ListNode l2) { if (l1 == null) return l2; if (l2 == null) return l1; ListNode head, last, p1, p2; p1 = l1; p2 = l2; if (p1.val < p2.val) { head = p1; p1 = p1.next; } else { head = p2; p2 = p2.next; } last = head; while (p1 != null && p2 !=...
7
@Override public int compareTo(Object o) { if(compareType == 0) { String name1 = this.name; String name2 = ((Term) o).name; int size = name1.length(); if (name1.length() > name2.length()) size = name2.length(); for (int i = 0; i...
7
public Grid(int width, int height, int intelligentX, int intelligentY, int targetX, int targetY) { super(); this.width = width; this.height = height; this.intelligentX = intelligentX; this.intelligentY = intelligentY; this.targetX = targetX; this.targetY = targetY; currentCells = new boolean[width *...
0
private MoveResult checkresign(HantoPieceType pieceType, HantoCoordinate from, HantoCoordinate to) { MoveResult result = MoveResult.OK; if(pieceType == null && from == null && to == null) { if(turn.equals(HantoPlayerColor.BLUE)) { result = MoveResult.RED_WINS; } else { result = MoveResult.BLU...
4
public static int triangleBmin(int x[][]) { int min = 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 (min > x[i][j]) { min = x[i][j]; } } } } System.out.println(...
4
public static BigInteger determinant(Matrix matrix) throws NoSquareException { if (!matrix.isSquare()) throw new NoSquareException("matrix need to be square."); if (matrix.size() == 1){ return matrix.getValueAt(0, 0); } if (matrix.size()==2) { return ...
4
public void drawSettingsMenu() { if (drawingSettingsMenu) setMenu.drawWindow(); }
1
public void load(int ID) { if(Consumable.loadConsumable(ID) != null) { Consumable consumable = Consumable.loadConsumable(ID); textPane.setText(consumable.getFlavorText()); for(int x = 0; x<consumable.getEffectsTotal(); x++) { listModel.addElement(consumable.getStat(x) + ";" + consumable.getEffect(x) + ";...
2
void readGenomeConfig(String genVer, Properties properties) { String genomePropsFileName = dataDir + "/" + genVer + "/snpEff.config"; try { // Read properties file "data_dir/genomeVersion/snpEff.conf" // If the file exists, read all properties and add them to the main 'properties' Properties genomeProps =...
4
public String readWord() { StringBuffer buffer = new StringBuffer(128); char ch = ' '; int count = 0; String s = null; try { while (ready() && Character.isWhitespace(ch)) ch = (char)myInFile.read(); while (ready() && !Character.isWhitespace(ch)) { count++; ...
7
public ArrayList<Upgrade> getUpgradesByType(UpgradeType type){ ArrayList<Upgrade> matching = new ArrayList<Upgrade>(); for(Upgrade u : allUpgrades){ if(u.getType() == type){ matching.add(u); } } return matching; }
2
private int parseAndSaveToAlbum(Map root, Album album, boolean firstElementCount) { int count = 0; ArrayList<Object> photosMapsTmp = (ArrayList<Object>) root.get(RESPONSE); if (firstElementCount) { count = ((Double) photosMapsTmp.get(0)).intValue(); photosMapsTmp.remove(0...
7
private void sortFields() { // Method Instances DiagramFieldPanel fieldPanel; if(isSort()) { for(int i = 0; i < fieldsPanel.getComponentCount()-1; i++) { String master = ((DiagramFieldPanel) fieldsPanel.getComponent(i)).getName(); ...
7
public static OS getPlatform() { String osName = System.getProperty("os.name").toLowerCase(); if (osName.contains("win")) return OS.windows; if (osName.contains("mac")) return OS.macos; if (osName.contains("solaris")) return OS.solaris; if (osName.contains("sunos")) return OS.solaris; if (osNa...
6
private static Status StatusObject(ResultSet rs) { Status newStatus = null; try { newStatus = new Status(rs.getInt(rs.getMetaData().getColumnName(1)), rs.getString(rs.getMetaData().getColumnName(2))); } catch (SQLException e) { E...
1
private static Float getFloat() { Boolean flag; float numFloat = 0; do { Scanner scanner = new Scanner(System.in); try { numFloat = scanner.nextFloat(); flag = true; } catch (Exception e) { flag = false; System.out.println("Input type mismach!"); System.out.print("Please input in Floa...
2
@Override public void changeCatalogUsage(Physical P, boolean toCataloged) { synchronized(getSync(P).intern()) { if((P!=null) &&(P.basePhyStats()!=null) &&(!P.amDestroyed())) { if(toCataloged) { changeCatalogFlag(P,true); final CataData data=getCatalogData(P); if(data!=null) ...
7
public void addButton(Container c, String title, ActionListener listener) { JButton button = new JButton(title); c.add(button); button.addActionListener(listener); }
0
@Override public void sell(Command cmd) { cmd.execute(); if(Storage.getInstance().getRevenue() < 10000.0) { restaurant.setState(restaurant.getBadstate()); }else if(Storage.getInstance().getRevenue() >= 10000.0 && Storage.getInstance().getRevenue() < 20000.0) { restaurant.setState(restaurant.getNormal...
3
public void moveFileFromJar(String jarFileName, String targetLocation, Boolean overwrite) { try { File targetFile = new File(targetLocation); if(overwrite || targetFile.exists() == false || targetFile.length() == 0) { InputStream inFile = getClass().getClassLoader().getResourceAsStream(j...
6
public static void handle(String[] tokens, Client client) { if(tokens.length != 3) { return; } Channel channel = Server.get().getChannel(tokens[1]); if(channel == null || !channel.getClients().contains(client)) { return; } if(client.isAway()) { client.setAway(false); } if(!client.isModera...
8
static public void zoomIn() { if(zoom<17) { zoom++; zoomIndex++; } }
1
public void visitRetStmt(final RetStmt stmt) { if (CodeGenerator.DEBUG) { System.out.println("code for " + stmt); } genPostponed(stmt); final Subroutine sub = stmt.sub(); Assert.isTrue(sub.returnAddress() != null); method.addInstruction(Opcode.opcx_ret, sub.returnAddress()); }
1
private void paint(Display display, GC gc) { Color white = colors.getWhite(); Color black = colors.getBlack(); Color grey30 = colors.getGrey30(); Color grey50 = colors.getGrey50(); Color grey80 = colors.getGrey80(); Color grey120 = colors.getGrey120(); // Calculate left margin to center the keyboard. i...
9
public void simulate() { long _time = 1000000L; if (this._labyrinthType.equals("g")) { // This behavior is applied for // graph based labyrinths. // Load the labyrinth from the .xml file this._labyrinthFactory.setFilename(this._filename); de.unihannover.sim.labysim.model.graph.Labyrinth ...
2
private final void method645(r_Sub2 var_r_Sub2, boolean bool) { anInt5601++; if (anInt5665 > aGLToolkit5692.anIntArray6747.length) { aGLToolkit5692.anIntArray6749 = new int[anInt5665]; aGLToolkit5692.anIntArray6747 = new int[anInt5665]; } int[] is = aGLToolkit5692.anIntArray6747; int[] is_108_ = aGLTool...
9
static int process(String line) { if(line == null || line.trim().length() == 0) return 0; int[] inp = giveArray(line.trim().split(" ")); int n = inp[0], b = inp[1], h = inp[2], w = inp[3]; int[][] havail = new int[h][]; int[] hcost = new int[h]; for(int i = 0; i < h; i++) { hcost[i] = Integer.parse...
8
@SuppressWarnings({ "resource" }) public ConnectionTable(String filePath) throws Exception { BufferedReader bufferedReader = null; try { bufferedReader = new BufferedReader(new FileReader(filePath)); String currentLine = bufferedReader.readLine(); while(currentLine != null) { if(!currentLine.is...
8
public void keyPressed(KeyEvent e) { char c = e.getKeyChar(); int t = Integer.parseInt(editor.getText()); if (Character.isLetter(c)) { error(); editor.setText("" + t); } else { if (e.getKeyCode() == KeyEvent.VK_UP && e.isControlDown()) { if (t < maxim - 4) { editor.setText("" + (t + 4)); ...
8
public void passWeekAll() { System.out.println("WEEK "+week+"!"); this.earnBonus(); for (int i=0; i<6; i++) { employees[i].workWeek(); System.out.println(employees[i]); } week+=1; }
1
public Outcome getOutcome(Choice c) { switch (this) { case ROCK: return c.equals(ROCK) ? Outcome.TIE : c.equals(PAPER) ? Outcome.LOSS : Outcome.WIN; case PAPER: return c.equals(PAPER) ? Outcome.TIE : c.equals(SCISSORS) ? Outcome.LOSS : Outcome.WIN; case SCISSORS: return c.equals(SCISSORS) ? O...
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...
6
public void setYAxisDeadZone(float zone) { setDeadZone(yaxis,zone); }
0
public BCAlgorithm(String name) { super(); algName = name; if (algName.equalsIgnoreCase("SkipJack")) { keyLength = 8; } else if (algName.equalsIgnoreCase("TwoFish")) { keyLength = 16; } else if (algName.equalsIgnoreCase("Salsa20")) { keyLength = 16; } }
3
public static int getTotalEnergy() { if (Debug.active) { int total = energy; for (ArrayList<Organism> orgs : organisms) { for (Organism org: orgs) { total += org.life.get(); } } return total; } return 0; }
3
ObjectiveFunction getOF() { if (of == null) { throw new IllegalArgumentException("No Objective function method defined."); } return of; }
1
public boolean isVictory(final HantoPlayerColor color){ boolean isVictory = false; HantoCell butterflyCell = null; int gridSize = occupiedCells.size(); for(int i = 0; i < gridSize - 1; i++){ HantoPiece curPiece = occupiedCells.get(i).getPiece(); if (curPiece.getType() == HantoPieceType.BUTTERFLY && cu...
4
protected static Ptg calcAsc( Ptg[] operands ) { if( (operands == null) || (operands[0] == null) ) { return new PtgErr( PtgErr.ERROR_VALUE ); } // determine if Excel's language is set up for DBCS; if not, returns normal string WorkBook bk = operands[0].getParentRec().getWorkBook(); if( bk.defaultLanguag...
5
public String getCurrentAnimationState(){ switch (currentAnimationState) { case 1: return "idle"; case 2: return "walk"; case 3: return "jump"; case 4: return "fall"; default: return "NOT DEFINED YET"; } }
4
protected void doRetrieveMatchingFiles(String fullPattern, File dir, Set<File> result) throws IOException { if (logger.isDebugEnabled()) { logger.debug("Searching directory [" + dir.getAbsolutePath() + "] for files matching pattern [" + fullPattern + "]"); } File[] dirContents = dir.listFiles(); if (dir...
9
private static LinkedList<ElementSuffixe> trad49(TreeNode tree){ // tree symbol is <element suffixe> int r = tree.getRule() ; switch (r) { case 0 : // <element suffixe> --> <element access> <element suffixe> { ElementSuffixe x0 = trad52(tree.getChild(0)) ; ...
9
public void render(Image image, Parameters params) { int width = image.getWidth(null); int height = image.getHeight(null); if (width == -1 || height == -1) { // Image is not ready yet. throw new IllegalArgumentException("image not loaded"); } Graphics g = ...
9
public boolean add(String word, int edit_distance) { // records the previous node Predecessor prev = this; // stores current node TopNode node = front; while( node != null) { if (edit_distance < node.getDistance()){ prev = node; node = node.getNext(); } else { ...
3
public List<QuadTree> getLeftNeighbors() { QuadTree sibling = this.getLeftSibling(); if ( sibling == null ) return new ArrayList<QuadTree>(); return sibling.getRightChildren(); }
1
public boolean isEmpty(){ return (top == -1); }
0
void headerOnMouseMove (Event event) { if (resizeColumn == null) { /* not currently resizing a column */ for (int i = 0; i < columns.length; i++) { CTableColumn column = columns [i]; int x = column.getX () + column.width; if (Math.abs (x - event.x) <= TOLLERANCE_COLUMNRESIZE) { if (column.resizable) ...
5
public boolean inBounds(int x, int y) { if(0 <= x && 20 >= x && 0 <= y && 20 >= y) return true; return false; }
4
public void showScores(SnakeServerMessage SSM) { for (int i = 0 ; i < SSM.Players.length; i++){ playerScores[i].setVisible(true); playerScores[i].setEditable(false); } }
1
@Override public void run() { PlainSentence ps = null; try { while (true) { ps = in.take(); if ((ps = plainTextProcessor.doProcess(ps)) != null) { out.add(ps); } while (plainTextProcessor.hasRemainingData()) { if ((ps = plainTextProcessor.doProcess(null)) != null) { ...
6
public static void quickSorting(int array[], int left, int right) { if (left < right) { int i = left, j = right, x = array[left]; while (i < j) { while (i < j && array[j] >= x) { j--; } if (i < j) { array[i++] = array[j]; } while (i < j && array[i] < x) { i++; } if (i < j) { array[j--] = array[i...
8
String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){ try { Object o1 = session.getAttribute("UserID"); Object o2 = session.getAttribute("UserRights"); boolean bRedirect = false; ...
7
public void loadFiles() throws IOException { for (int i = 0; i < 16; ++i) { for (int j = 0; j < 16; ++j) { DirFile node = new DirFile(i, j); DataBaseFile file = new DataBaseFile(getFullName(node), node.nDir, node.nFile, this, provider); files[node.getI...
2
public gameState state() { if (_gameModel.isGameOver()) { return gameState.GAME_OVER; } else if (_gameModel.isEndGame()) { return gameState.END_GAME; } else { return gameState.GAME_CONTINUED; } }
2
int doIO(ByteBuffer buf, int ops) throws IOException { /* * For now only one thread is allowed. If user want to read or write * from multiple threads, multiple streams could be created. In that * case multiple threads work as well as underlying channel supports it. */ if (!buf.hasRemaining()) { thro...
8
public static boolean resolveOneSlotReferenceP(Proposition proposition, KeyValueList variabletypestable) { { Stella_Object firstargument = (proposition.arguments.theArray)[0]; Stella_Object predicate = null; { Surrogate testValue000 = Stella_Object.safePrimaryType(firstargument); if (Surrogate...
8
public int getDepth() { return depth; }
0
public void drawItems() { itemList.removeAll(); OrderedItem orders[] = commande.getOrders(); for (int i = 0;i<orders.length;i++) { GridBagConstraints constraintLeft = new GridBagConstraints(),constraintRight = new GridBagConstraints(); constraintLeft.gridx = 0; constraintLeft.gridy = GridBagConstraints.R...
6
public TaskRunner(TaskSupplier<T> taskSupplier, TaskExecutor<T> taskExecutor) { this.taskSupplier = taskSupplier; this.taskExecutor = taskExecutor; }
0
private void parseStartLevel(Node node) throws TemplateException { try { XPath xPath = XPathFactory.newInstance().newXPath(); NodeList nodeList = (NodeList) xPath.evaluate("element/interleave/ref", node, XPathConstants.NODESET); for (int i = 0, len = nodeList.getLength(); i <...
3
public static void main(String[] args ) { TextNavigator tn = new TextNavigator(); tn.text = "forbidden treasures. The common folk of the neigh-\n" + "borhood, peons of the estancias, vaqueros of the sea-\n" + "board plains, tame Indians coming miles to market\n" + "with a bun...
3
private JSONObject readObject() throws JSONException { JSONObject jsonobject = new JSONObject(); while (true) { if (probe) { log("\n"); } String name = readName(); jsonobject.put(name, !bit() ? readString() : readValue()); if (!...
4
@Override public void documentAdded(DocumentRepositoryEvent e) {}
0
private String _toString(String delim) { String ret = Integer.toString(this.getId()) + delim + this.getDate() + delim; // inefficient but perhaps acceptable here for(Contact contact : this.getContacts()) { ret += delim + contact.getId(); } return ret; }
1
void scoreMatrix() { score = new int[a.length + 1][b.length + 1]; // Initialize for (int i = 0; i <= a.length; i++) setScore(i, 0, deletion * i); for (int j = 0; j <= b.length; j++) setScore(0, j, deletion * j); // Calculate bestScore = Integer.MIN_VALUE; for (int i = 1; i <= a.length; i++) fo...
4
public MusicObject getSongByPath(String folder, String fileName) { try { if (connection == null) { connection = getConnection(); } if (getSongByNameStmt == null) { getSongByNameStmt = connection.prepareStatement("select "+getColumnNames("music")+" from org.music music where folder_hash = ? and file...
6
@Override public void compute(Vertex<Text, Text, NullWritable> vertex, Iterable<Text> messages) throws IOException { if (getSuperstep() == MAX_SIZE.get(getConf())) { vertex.voteToHalt(); return; } if (getSuperstep() == 0) { doFirstStep(vertex); } ...
2
public static Resource getLatest(RepositoryConnection con, RepositoryResult<Statement> statementIterator, URI timeProperty) throws RepositoryException { Resource latestResource = null; SimpleDateFormat sdf = D2S_Utils.getSimpleDateFormat(); while (statementIterator.hasNext()) { Statement s = statementI...
5
private void songsnewfromRTFdir() { // jetzt Dateiauswahl anzeigen: JFileChooser pChooser = new JFileChooser(); pChooser.setDialogTitle(Messages.getString("GUI.15")); //$NON-NLS-1$ org.zephyrsoft.util.CustomFileFilter filter = new org.zephyrsoft.util.CustomFileFilter("", new String[] {".rtf"}); //$NON-NLS-1$...
9
public HTMLInput getInputByName(String regex) { Pattern patt = Pattern.compile(regex); for (HTMLInput i : inputs) { final String linksName = i.getName(); if (linksName == null) continue; if (regex.equals(linksName) || (patt.matcher(linksName).find())) { return i; } } return null; }
4
private void checkReturnType(Method method) throws DaoGenerateException { Class<?> returnType = method.getReturnType(); isReturnId = (method.getAnnotation(ReturnId.class) != null); if (isReturnId) { if (ClassHelper.isTypePrimitive(returnType)) { returnType = ClassHelper.primitiveToWrapper(returnType); ...
7
public void beginScope() { marks = new Binder(null, top, marks); top = null; }
0
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); ...
7
public boolean equals(Object o) { if (o == null) return false; if (o == this) return true; else { Position temp = (Position) o; return ((this.getX() == temp.getX()) && (this.getY() == temp.getY())); } }
3
private int getDownElementIndex(int n) { if (n >= 80 && n < getMaxElementIndex()) return n; if (n >= 39 && n < 81) return n + 32; if (n >= 12 && n < 39) return n + 18; if (n >= 1 && n < 12) return n + 8; if (n == 0) return n + 2; return n; }
9
public ByteVector putInt(final int i) { int length = this.length; if (length + 4 > data.length) { enlarge(4); } byte[] data = this.data; data[length++] = (byte) (i >>> 24); data[length++] = (byte) (i >>> 16); data[length++] = (byte) (i >>> 8); ...
1
@EventHandler public void WolfWaterBreathing(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getWolfConfig().getDouble("Wolf.WaterB...
6
public void addConstant(String con, Object value){ if(value instanceof Integer) intConstantMap.put(con,(Integer)value); else if(value instanceof Float) floatConstantMap.put(con,(Float)value); else if(value instanceof Short) shortConstantMap.put(con,(Short)value); }
3
public static void main(String[] args) { MyLogger myLogger1 = MyLogger.getMyLogger(); MyLogger myLogger2 = MyLogger.getMyLogger(); MyLogger myLogger3 = MyLogger.getMyLogger(); MyLogger myLogger4 = MyLogger.getMyLogger(); MyLogger myLogger5 = MyLogger.getMyLogger(); myLogger1.info("Leaning Singlton design...
1
public ArrayList selectSingleList(String query) throws SQLException { ArrayList resultList = new ArrayList(); Connection connection = null; Statement statement = null; ResultSet result = null; String value = ""; try { Class.forName(driver); connection = DriverManager.getConnection(url, username, ...
8
@Override public boolean accept(File f) { return f.isDirectory() || f.getName().toLowerCase().endsWith(".jpg") || f.getName().toLowerCase().endsWith(".gif") || f.getName().toLowerCase().endsWith(".bmp") || f.getName().toLowerCase().endsWith(".png"); }
4
public int getij(int i,int j){ assert (i<n) && (j<m); return A[i][j]; }
1
private String buildheader(int codeIn, int fileextIn) { int code = codeIn; int fileext = fileextIn; String header = ""; if (code == 200) { header = "HTTP/1.1 200 OK"; } if (code == 404) { header = "HTTP/1.1 404 Not Found"; } hea...
9
private void endArguments() { if (argumentStack % 2 != 0) { buf.append('>'); } argumentStack /= 2; }
1
public void die(){ }
0
public static String getCardString(Card card) { String string = ""; switch (card.value) { case (0) : string += 'A'; break; case (10) : string += 'J'; break; case (11) : string += 'Q'; break; case (12) : string += 'K'; break; default : string +...
8
public GraphRect(String tid, int twhichOne, int x, int y, int w, int h) { super(x,y,w,h); whichOne=twhichOne; id=tid; }
0
private void setObject() { if (this.isString || this.isArray) { throw new RuntimeException(JSON__STATUS__ERROR); } this.isObject = true; }
2
@Override public boolean canBeLearnedBy(MOB teacherM, MOB studentM) { if(!super.canBeLearnedBy(teacherM,studentM)) return false; if(studentM==null) return true; final CharClass C=studentM.charStats().getCurrentClass(); if(CMLib.ableMapper().getQualifyingLevel(C.ID(), false, ID())>=0) return true; f...
8
public static void saveToPng(Maze m, Path to, boolean withShortestPath) throws IOException { Logger logger = Logger.getLogger("fr.upem.algoproject"); int width = m.getWidth(); int bi_w = Math.max(100, width); int bi_h = Math.max(100, m.getHeight()); BufferedImage bi = new BufferedImage(bi_w, bi_h, Buff...
6
@Override public boolean checkVersion(Player player, ReplicatedPermissionsContainer data) { if (data.modName.equals("all")) return true; for (ReplicatedPermissionsMappingProvider provider : this.mappingProviders) { if (!provider.checkVersion(this.parent, player, data) && !player.hasPermission(ReplicatedPe...
4
private boolean validTarget(Sprite s){ boolean returnVal = false; if(validTargetDistance(s) && validTargetNotParent(s)) returnVal = true; return returnVal; }
2
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int[] MN = readInts(line); m = new char[MN[0]][MN[...
6
@Basic @Column(name = "CTR_FORMA_PAGO") public String getCtrFormaPago() { return ctrFormaPago; }
0
public static int canCompleteCircuit(int[] gas, int[] cost) { assert gas.length == cost.length; int len = gas.length; for (int i = 0; i < len; i++) { int tank = 0; int start = i; boolean done = true; int step = start; for (int j = 0; j < len; j++) { tank = tank + g...
4
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 static void main(String[] args) { new House(); }
0
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (cmd.getName().equalsIgnoreCase("sellhead")) { if (sender instanceof Player) { Player player = (Player) sender; ItemStack item = player.getItemInHand(); if (item.getType() == Material.SKULL_ITEM) { ...
3
private boolean jj_3R_81() { if (jj_scan_token(END)) return true; if (jj_scan_token(CLASS)) return true; return false; }
2
private void byWidth(BinaryTree[] mas, int counter, int counterMas) { System.out.print(mas[counter].getValue() + " "); if (mas[counter].left != null) { counterMas++; mas[counterMas] = mas[counter].left; } if (mas[counter].right != null) { counterMas++; mas[counterMas] = mas[counter].right; } cou...
3
public Person getPrevPerson(final Person person) { if (person != null) { logger.debug("(getPrevPerson) Looking for Person with ID < " + person.getId()); for (int i = personStorage.entrySet().size() - 1; i >= 0; i--) { @SuppressWarnings("unchecked") final Map.Entry<Long, Person> map = (Entry<Long, Perso...
5