text
stringlengths
14
410k
label
int32
0
9
private void initialiseConnection() throws IOException, InterruptedException { try { incoming = bindSocket(DEFAULT_PORT); } catch (BindException e1) { log.debug("Master already runninng!"); incoming = bindSocket(0); } alreadyRunning = true; log.debug("Listener started as [" + name + "]"); ...
2
private void loadChi2() throws FileNotFoundException { chi2 = new HashMap<Integer, Double>(); Scanner s = new Scanner(new File(CHI2_FILE)); s.nextLine(); while (s.hasNext()) { String line = s.nextLine(); Scanner row = new Scanner(line); String df = row.next(); String p = row.next(); try { ...
3
public ArrayList<PlayerLocation> getPlayersLocation() { ArrayList<PlayerLocation> list = new ArrayList<PlayerLocation>(); list.add(new PlayerLocation(pacMan.getX() - pixels, pacMan.getY() - pixels, pacMan.getImageName())); for (Phantom phantom : phantoms) { list...
1
public String getDesc() { return this.desc; }
0
public boolean testMovesForCheckMate(boolean owner, Board boardObj){ //hole Brett Piece[][] board = boardObj.getBoard(); //holt König auf dem Brett King king = boardObj.getKingOnBoard(owner); //Mögliche Züge des Königs generieren ArrayList<String> possMoves = king.getPossibleMoveDestinations(king.getPositio...
5
public void mouseClicked(MouseEvent e) { // depending on tool state propagate mouse state if (documentViewModel.getViewToolMode() == DocumentViewModel.DISPLAY_TOOL_TEXT_SELECTION) { textSelectionHandler.mouseClicked(e); } else if (documentViewModel.getViewToolMode() ...
4
public static void insertTag(String hashtag) { Connection con = null; try { Class.forName("org.sqlite.JDBC"); con = DriverManager.getConnection("jdbc:sqlite:" + Parametre.workspace + "/bdd_models"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select tag from hashTags where ...
4
public boolean isHydroCarbon() { if(elements.length == 2) if((elements[0].protons == 1 && elements[1].protons == 6) || (elements[1].protons == 1 && elements[0].protons == 6)) return true; return false; }
5
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
public T2 getFoo2() { return foo2; }
0
@Override public String toString() { StringBuilder string = new StringBuilder(); string.append("Original question: "); string.append(originalText); string.append("\n"); // string.append("QuestionType: " + questionType + "\n"); string.append("AnswerType: "...
7
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 createSQL(String s) { String filename = "bible_chinese.sql"; Path file = Paths.get(CBOL_HOME + filename); Charset charset = Charset.forName("UTF-8"); try (BufferedWriter writer = Files.newBufferedWriter(file, charset)) { writer.write(s, 0, s.length()); }...
1
public TurnOnCommand(Receiver receiver) { this.receiver = receiver; }
0
public static void drawProfitMinimap(GOut g, Coord tc, Coord hsz) { if(UI.instance.minimap == null) return; synchronized (UI.instance.minimap.profits) { for (Pair<Coord, Color> arg : UI.instance.minimap.profits) { Coord ptc = arg.fst.div(tileSize).add(tc.inv()) .add(hsz.div(2)); g.chcolor(Color.BLA...
2
public void wdgmsg(Widget sender, String msg, Object... args) { if (sender == cbtn) { close(); return; } super.wdgmsg(sender, msg, args); }
1
Class367 method3832(int i, byte i_61_) { if (i_61_ > -57) method3817(22, -65); anInt7969++; int i_62_ = i; while_231_: do { while_230_: do { do { if (i_62_ != 6) { if (i_62_ != 1) { if (i_62_ != 2) { if ((i_62_ ^ 0xffffffff) != -8) break while_231_; } else bre...
8
private static Map<String, Object>[] getParamsets(List<String> fnames, List data) { int cols = fnames.size(); if (cols<1) { throw new ComponentException("no field mapping information for test data"); } int rows = (data.size() / fnames.size()) - 1; if (rows < 1) { ...
5
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); }
0
private void getMods() { if (!prefs.get(NSLOACTION, "").equals("")) { File neoScavengerLocation = new File(prefs.get(NSLOACTION, "") + "."); List<File> folderList = new ArrayList<File>(); File[] children = neoScavengerLocation.listFiles(); if (children != null) { for (File child : children) { if ...
8
private Node pickSeed(Set<Node> nodeList, Set<Integer> sampleList){ int N = nodeList.size(); //number of proteins int setSize = (int)Math.sqrt(N); //System.out.println("required num of proteins " + setSize); HashSet<Node> eligibleFeatures = new HashSet(); //eligibleFeatures.addA...
7
protected Vector<Integer> allOkResources() { if(allResources==null) { allResources=new Vector<Integer>(); if(okResources()!=null) { for(int m=0;m<okResources().length;m++) { if(!allResources.contains(Integer.valueOf(okResources()[m]))) allResources.addElement(Integer.valueOf(okResourc...
9
public void testCompareTo() { Single test1 = new Single(21); Single test2 = new Single(22); Single test3 = new Single(23); assertEquals(true, test1.compareTo(test1) == 0); assertEquals(true, test1.compareTo(test2) < 0); assertEquals(true, test1.compareTo(test3) < 0); ...
1
private int getMinInd(int pos1, int pos2) { return heap.get(pos1).compareTo(heap.get(pos2)) >= 0 ? pos2 : pos1; }
1
public void setButtonsNumber(JToggleButton[] buttons) { if (buttons.length == MAX_NUMEROS_USADOS) { ArrayList<Integer> listaCompleta = new ArrayList<>(); for (Integer numero : NUMEROS) { listaCompleta.add(numero); } int size = listaCompleta.size...
5
public void notifyHunterListListeners() { for (final HunterListListener listener : this.listenersHunter) { listener.hunterListModelChanged(this.hunters); } }
1
private void handleScore(ScorePacket packet) { ClientPlayer player = getPlayer(packet.player); if (player != null) { player.setScore(packet.score); } }
1
@Override public void mousePressed(MouseEvent e){ SimSession session = frame.session; int mask = e.getModifiers(); int button; // note that all buttons are mapped as if we were dealing with // a two button mouse. On systems with 3 buttons (X-Windows) // the right two buttons are ma...
5
@Override public boolean puraTiedosto() throws FileNotFoundException, IOException { System.out.println("LZW purku aloitetaan"); //BufferedInputStream bis = new BufferedInputStream(new FileInputStream(lahde)); BittiInputStream bis = new BittiInputStream(new BufferedInputStream(new FileInputStream(lahde))); Buff...
8
public static StringBuffer dynImmunities(String ID, Modifiable obj, HTTPRequest httpReq, java.util.Map<String,String> parms, int borderSize, String font) { final StringBuffer str=new StringBuffer(""); final List<String> theclasses=new Vector<String>(); if(httpReq.isUrlParameter("IABLE1")) { int num=1; St...
7
private Field getField() { Class<?> propertyType = getPropertyType(); while (field == null && !fieldSearched) { Class<?> c = clazz; while (c != null && field == null) { for (Field f : c.getDeclaredFields()) { if (f.getName().equals(getPropertyDescriptor().getName()) && f.getType().equals(prop...
9
public Boolean comprarProducto(String producto, Integer unidades){ if(!this.stock.containsKey(producto)){ return false; } Integer nuevaCantidad = this.stock.get(producto) - unidades; this.stock.put(producto, nuevaCantidad); return true; }
1
public void update() { Graphics2D g = _buffer.createGraphics(); double pixX = DEFAULT_WIDTH / (double)_width; double pixY = DEFAULT_HEIGHT / (double)_height; for (int i = 0; i < _height; i++) { for (int j = 0; j < _width; j++) { //g.setColor(BACKGROUND_COLOR); int w = (int)(_wps.getMap().getWeight...
7
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof Item) { Item item = (Item)obj; if (this.name != item.name) { if (this.name == null || !this.name.equals(item.name)) { r...
5
public boolean containsAll(Collection<? extends E> c) { for (E element : c) if (!contains(element)) return false; return true; }
3
@Override public int compare(Record record1, Record record2) { if (record1.timestamp.getTime() > record2.timestamp.getTime()) return -1; else if (record1.timestamp.getTime() < record2.timestamp.getTime()) return 1; else return 0; }
2
private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed // TODO add your handling code here: if(txtNombre.getText().equals("")){ JOptionPane.showMessageDialog(null,"Deve Ingresar unn Nombre para continuar"); txtN...
9
public void playGame() { initialize(); shuffle(); boolean run = true; do { getCard(); for (User user : users) { run = play(user); if (!run) break; } } while (run); gameOver(); }
3
public int getChannel(int channel) throws Exception, IllegalArgumentException { int value = 0; checkChannel(channel); //write int wdata[] = {devAdr.getWriteAddress(), controlByte | channel}; writeI2C(wdata); //read int rdata[] = {devAdr.getReadAddress()}; ...
7
public void setOrderCount(String orderCount) { this.orderCount = orderCount; }
0
public List<Sword> getSwordPartsByDistance() { final ArrayList<Sword> list = new ArrayList<Sword>(); for (Sword swordPart : Sword.values()) { if (swordPart.getHitsNeeded(ctx) > 0) { list.add(swordPart); } } if (list.size() > 0) { Collections.sort(list, new SwordComparator(ctx)); HitType hitTy...
5
private void destroyWalls() { final int rows, columns, zombiesNeededToBreakDownAWall; final double cellWidth, cellHeight; double cellXMin, cellYMin, cellXMax, cellYMax; EnvironmentCell cell; Collection<EnvironmentWall> cellWalls; Line2D destroyedPart; row...
6
public Set<Matcher> noCacheFindSign(Block block) { for (BlockFace direction : signDirections) { Block sign = block.getRelative(direction); // If the WALL_SIGN is NORTH of the hopper and facing NORTH it must // be attached to the hopper. if (direction == getSignD...
3
public Upgrade[] getAllUpgrades(){ return this.allUpgrades; }
0
public void setImage(String image) { if (image.indexOf('\\') == -1) { this.image = image; return; } int size = image.length(); StringBuffer buf = new StringBuffer(size); for (int i = 0; i < size; i++) { char c = image.charAt(i); if ...
9
@Override public void caseAEscrevaExpLogicaDefinicaoComando(AEscrevaExpLogicaDefinicaoComando node) { inAEscrevaExpLogicaDefinicaoComando(node); if(node.getPontoVirgula() != null) { node.getPontoVirgula().apply(this); } if(node.getRPar() != null) { ...
6
public static void getRecommendation(int userId, Map<Integer, Map<Integer, Pearson>> pearsons) { List<Pearson> userList = Pearson.getPearsonsFor(userId, pearsons); Map<Integer, Double> totalPearson = new TreeMap<Integer, Double>(); Map<Integer, Double> totalWeight = new TreeMap<Integer, Double>(); for...
7
public PossibleConnection engageInsideParagraphs( int i, int j, int firstInParagraph, int positionInParagraph) { /* Inicijalizacija */ // Slucaj spoja mostProbable11.setconnectionCase(11); // Pretpostavimo da je to nemoguc spoj mostProbable11.setProbability(0.0); // Ocistimo listu elemen...
6
protected void giveOffers() { for (ItemStack item : p1inv.getOthersItems()) { if (item != null) { p1.getInventory().addItem(new ItemStack[] { item }); } } for (ItemStack item : p2inv.getOthersItems()) if (item != null) p2.getInventory().addItem(new ItemStack[] { item });...
4
public static void cutGem(final Client c, final int itemUsed, final int usedWith) { if (isSkilling[12] == true) { return; } final int itemId = (itemUsed == 1755 ? usedWith : itemUsed); for (final cutGemData g : cutGemData.values()) { if (itemId == g.getUncut()) { if (c.playerLevel[12] < g.getLevel()) ...
8
@Override public void run() { try { sleep(2000); } catch (InterruptedException ex) { } int direction = new Random().nextInt(4); Position firePosition = calculatePosition(direction); while (isAlive) { try { sleep(new ...
5
@Override public void levelUp() { this.level++; this.nextExp *= 1.1; int total = 0; while (total == 0) { if (Math.random() > 0.5) { this.maxHP += 3; this.curHP += 3; total++; if (Math.random() > 0.8) { ...
8
public int longestValidParentheses(String s) { f = new Boolean[s.length() + 1][]; this.s = s; for (int i = 0; i <= s.length(); i++) { f[i] = new Boolean[s.length() + 1]; for (int j = i + 2; j <= s.length(); j += 2) { f[i][j] = null; } } int rst = 0; for (int i = 0; i < s.length() - 1; i++) { ...
8
@Override StatementResult execute0(ScriptScope scope) throws SynsException { try { StatementResult tryResult = synTryStatement.execute(scope); return tryResult; } catch (ThrowSynsException e) { //Exception thrown by a script "throw" statement. The original excepti...
7
public void lancerAlgo(Similarite s) { this.similarite = s; System.out.println("Lancement de l'algorithme avec la similitude suivante : " + this.similarite.getClass().getSimpleName()); boolean stable=false; int compteur=0; while (!stable && compteur<100) { // Supprime tous les items des groupes p...
8
private void checkForCollisions () { for (Participant p1: participants) { Iterator<Participant> iter = participants.descendingIterator(); while (iter.hasNext()) { Participant p2 = iter.next(); if (p2 == p1) break; if (pendingRemoves.contains(p1)) break; if (pendingRemoves.contains(p2)) break; ...
7
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 Network(String server, int port) throws ServerNotFoundException, SocketBusyException, IOException { if (server != null) { Socket output; try { output = new Socket(server, port); } catch (UnknownHostException e) { throw new ServerNotFoundException(); } catch (IOException e) { throw n...
5
public RaumEigenschaftenPanel(Raum raum, EditorBeobachter beobachter) { assert raum != null : "Vorbedingung verletzt: raum != null"; Collection<Item> items = raum.getItems(); int kuchen = 0; int giftkuchen = 0; for(Item item : items) { if(item == Item.UKuchen) ++kuchen; if(item == Item.UGiftkuch...
3
int insertKeyRehash(double val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look...
9
public boolean fromElement(Element element) { boolean result = true; NodeList taskList = element.getElementsByTagName(C.task); for (int i=0; i<taskList.getLength(); i++) { Task task = new Task(); task.fromElement((Element)taskList.item(i)); taskStore.put(task.getId(), task); } retu...
1
public void paint(Graphics g) { Color bColor; if(selected) { bColor = getBackgroundSelectionColor(); } else { bColor = getBackgroundNonSelectionColor(); if(bColor == null) bColor = getBackground(); } int imageOffset = -1; ...
8
public List<OrdenDeCompra> getListaNumeroOrden(){ List<OrdenDeCompra> lnumero = new LinkedList(); Conexionbd.conexion bd = new Conexionbd.conexion(); ControladorUsuario cont = new ControladorUsuario(); try{ bd.conectarBase(); ResultSet rs = bd.sentencia.executeQuery("...
3
private JButton getBtnFind() { if (btnFind == null) { btnFind = new JButton("Find"); btnFind.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { WikiaXMLHandler xmlHandler = new WikiaXMLHandler(); String artistName = txFieldArtistName.getText(); ...
4
public void calculateNeighbours() { for(int x=0; x<xmax; x++) { for(int y=0; y<ymax; y++) { Position temp = maze.get(y).get(x); if(x==0) { temp.east = maze.get(y).get(x+1); } else if(x==xmax-1) { temp.west = maze.get(y).get(x-1); } else { temp.east = maze.get(y).get(x+1)...
6
private boolean validate(char[][] board, int x, int y) { for(int i = 0; i < board.length; i++) { for(int j = 0; j < y; j++) { /** * x==i,same row * x+y == i+j,/ diagonal * x+j == y+i,\ diagonal */ if(board[i][j] == 'Q' && ( x + j == y + i || x + y == i + j || x == i )) return false...
6
public void history(boolean isReset) { StringBuffer buffer = new StringBuffer(); String nStep = new String(); nStep =("Step: " + step + " "); for(Color color : stats.keySet()){ Counter info = stats.get(color); int stringLength = info.getName().length()...
2
public DataPoint(float lat, float lng, float amount) { this.lat = lat; this.lng = lng; this.amount = amount; }
0
public Sprite getCurrentCellSprite(int cellID) { switch (cellID) { case 1: case 2: case 3: return getTileSprite(cellID - 1); case 4: return Stairs.SPRITE; case 5: return Turret.SPRITE; case 6: return Player.sprites[0][0]; case 7: return Score.SPRITE; default: return new Sprite(tileSi...
7
public static void main(String[] args) throws InterruptedException { // 同时启动两个线程对queue进行操作! new MyThread("ta").start(); //Thread.sleep(1000); new MyThread("tb").start(); }
0
@Override public void setCalle(String calle) { super.setCalle(calle); }
0
protected void genWeaponAmmo(MOB mob, Weapon W, int showNumber, int showFlag) throws IOException { if((showFlag>0)&&(showFlag!=showNumber)) return; if(!(W instanceof AmmunitionWeapon)) return; final AmmunitionWeapon AW=(AmmunitionWeapon)W; final String defaultAmmo=(AW.requiresAmmunition())?"Y":"N"; i...
9
public double standardizedItemMaximum(int index){ if(!this.dataPreprocessed)this.preprocessData(); if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive"); if(!this.variancesCal...
4
public IVPNumber remainder(IVPNumber number, Context context, DataFactory factory, HashMap map) { IVPNumber result = factory.createIVPNumber(); map.put(result.getUniqueID(), result); if(getValueType().equals(IVPValue.INTEGER_TYPE) && number.getValueType().equals(IVPValue.INTEGER_TYPE)){ int resultInt = context...
5
public void run(ReentrantLock physicsLock) { while (!Display.isCloseRequested() && !quit){ // update 1 frame of display GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslated(0, 0, -centerDistance); GL11.glRot...
4
public void loadAllQCReports(){ try { allQCReports = null; ResultSet dbAllQCReports = null; Statement statement; statement = connection.createStatement(); dbAllQCReports = statement.executeQuery("SELECT Q...
6
public RrdExportDef getRrdExportDef() throws RrdException { // basic check if( !root.getTagName().equals("rrd_export_def") ) throw new RrdException("XML definition must start with <rrd_export_def>"); validateTagsOnlyOnce( root, new String[] {"span", "options", "datasources", "exports"} ); def = new RrdExpo...
6
public final void show() { StackPane parentRoot = (StackPane) ((Stage) stage.getOwner()) .getScene().getRoot(); parentRoot.getChildren().add(mask); stage.show(); }
0
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); if (onkoKirjautunut(request, response)) { try { asetaAsiakkaanTiedot(request); ...
4
@Temporal(TemporalType.DATE) public Date getDataRejestracji() { return dataRejestracji; }
0
private void close() { try { if (lineInputReader != null) lineInputReader.close(); } catch (IOException e) { throw new RuntimeException(e); } }
2
public static void main(String[] args){ Display display = Display.getDefault(); PairOfStrings p=new PairOfStrings(); NickWindow w=new NickWindow(display,p); w.setSize(400, 200); w.pack(); w.open(); while (!w.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } if(p.nam...
6
public void deleteAll() { try { List<UserDTO> listaUserow = getAllUsers(); List<QuestDTO> listaQuestow = getAllQuests(); for (QuestDTO quest : listaQuestow) { delete(String.valueOf(quest.getId()), "/deleteQuest"); } for (UserDTO user : listaUserow) { delete(user.getLogin(), "/deleteGame"); ...
3
public void setIgnoreColumnIndex(int[] ignoreColumnIndex) { this.ignoreColumnIndex = ignoreColumnIndex; }
0
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Point point = (Point) o; if (point.x != x) return false; if (point.y != y) return false; return true; }
5
public ConvertPane(AutomatonEnvironment environment) { this.environment = environment; automaton = (FiniteStateAutomaton) environment.getAutomaton().clone(); JFrame frame = Universe.frameForEnvironment(environment); setLayout(new BorderLayout()); JPanel labels = new JPanel(new BorderLayout()); JLabel main...
0
public void parseVisitShow(Visitor<S, T> interp, Reader reader) { FractalParser parser; ASTProgram program = null; System.out.print(PROMPT); try { parser = new FractalParser(new FractalLexer(reader)); program = (ASTProgram) parser.parse().value; } catch (...
3
public void setWeight(int x1, int y1, int x2, int y2, int weight){ if(y2>this.height-1 || y2<0 || x2>this.width-1 || x2<0 || Math.abs(x1-x2)>1 || Math.abs(y1-y2)>1){ return; } this.graph.setWeight(this.grid.get(new Coordinate(x1,y1)), this.grid.get(new Coordinate(x2,y2)), weight); ...
6
public void setDisabled() { enabled = false; }
0
private Decision makeDecision(GameInfo currentGameInfo) { int[] myDiceFrequencies = getMyDiceFrequencies(currentGameInfo); int totalDice = currentGameInfo.getTotalDice(); int othersDice = totalDice - currentGameInfo.getMyDice().size(); Bid currentBid = currentGameInfo.getCurrentBid(); int onesGuess = othersDi...
6
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509Certificate", scope = X509DataType.class) public JAXBElement<byte[]> createX509DataTypeX509Certificate(byte[] value) { return new JAXBElement<byte[]>(_X509DataTypeX509Certificate_QNAME, byte[].class, X509DataType.class, ((byte[]) ...
0
void removeListener(Listener l) { if (log.isLoggable(Level.CONFIG)) { log.config("Removing Notification Listener " + l); } ll.remove(Listener.class, l); shouldFire = ll.getListenerCount() > 0; }
1
public String getRoomDescription() { String temp = roomDescription; List<Item> noDescList = new ArrayList<>(); //List for the items with no description (dropped items) List<Item> descList = new ArrayList<>(); //List for the items that are described (set by the room) for(Item i: getRoomL...
7
private void deleteOldBackups () { try { // File backupDir = new File(pSystem.getStringProperty(STRING_BACKUP_FOLDER)); // get every zip file in the backup Dir File[] tempArray = backupDir.listFiles(); File[] array = new File[tempArray.length - 1]; ...
9
@Test public void getNextIsNotNullUntilListIsOver() { for (int i = 0; i < 1337; i++) list.add("bleep"); boolean test = true; for (int i = 0; i < 1337; i++) if (list.getNext() == null) test = false; assertTrue(test); }
3
private static String getStringFromDocument(Document doc) { try { DOMSource domSource = new DOMSource(doc); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); ...
1
@Override public List<User> load(Criteria criteria, GenericLoadQuery loadGeneric, Connection conn) throws DaoQueryException { int pageSize = 10; List paramList = new ArrayList<>(); StringBuilder sb = new StringBuilder(WHERE); String queryStr = new QueryMapper() { @Overri...
4
private TreeNode2<T> delete(TreeNode2<T> root, T value) { // first find the node that has the value TreeNode2<T> node = find(root, value); // not found if (node == null) { return null; } // search for a leaf to delete; swap values along the way while (true) { ...
8
private static void printDataResult(DataResult result) { List<SatelliteData> data = result.getData(); if (data == null || data.size() == 0) { System.out.println("No satellite data"); return; } else { System.out.println("data.length = " + data.size()); System.out.println("Satellite Data:"); } int...
3
public void insert (T i) { if(i == null) return; if(root == null) { root = new Node<T>(i, null, null); size++; return; } Node<T> cur = root; while(cur.getNext() != null) { if(i == cur.getElement() ) return; cur = cur.getNext(); } cur.setNext(new Node<T>(i, cur, null)); size+...
4