/** @inheritDoc */ @Override public void dispose() { super.dispose(); // iterate over all child elements and dispose them final SimpleTreeIterator<ChildElement<E>> treeIterator = new SimpleTreeIterator<ChildElement<E>>(childElements); while(treeIterator.hasNext()) { treeIterator.next(); treeIterator.value().dispose(); } }
/** * Get the index of the node immediately following the current. Expected * values are in the range ( 1, size() ) */ public int nodeEndIndex( ) { if(node == null) throw new NoSuchElementException(); // the count of all nodes previous return nodeStartIndex( ) + nodeSize( ); } public T0 value() {
/** * Create a {@link SimpleTreeIterator} exactly the same as this one. * The iterators will be backed by the same tree but maintain * separate cursors into the tree. */ public SimpleTreeIterator < T0> copy() { SimpleTreeIterator < T0> result = new SimpleTreeIterator < T0> (tree); result.count1 = this.count1; result.node = node; result.index = index; return result; }
if(!hasNext( )) { throw new NoSuchElementException();
/** * @return <code>true</code> if there's a node of the specified color in this * tree following the current node. */ public boolean hasNextNode( ) { if(node == null) { return tree.size( ) > 0; } else { return nodeEndIndex( ) < tree.size( ); } }
/** * Step to the next node. */ public void nextNode( ) { if(!hasNextNode( )) { throw new NoSuchElementException(); } // start at the first node in the tree if(node == null) { node = tree.firstNode(); index = 0; return; } // scan through the nodes, looking for the first one of the right color while(true) { count1 += 1 - index; node = SimpleTree.next(node); index = 0; // we've found a node that meet our requirements, so return break; } }
/** * Create a {@link SimpleTreeIterator} exactly the same as this one. * The iterators will be backed by the same tree but maintain * separate cursors into the tree. */ public SimpleTreeIterator < T0> copy() { SimpleTreeIterator < T0> result = new SimpleTreeIterator < T0> (tree); result.count1 = this.count1; result.node = node; result.index = index; return result; }
if(!hasNext( )) { throw new NoSuchElementException();
/** * @return <code>true</code> if there's a node of the specified color in this * tree following the current node. */ public boolean hasNextNode( ) { if(node == null) { return tree.size( ) > 0; } else { return nodeEndIndex( ) < tree.size( ); } }
/** * Step to the next node. */ public void nextNode( ) { if(!hasNextNode( )) { throw new NoSuchElementException(); } // start at the first node in the tree if(node == null) { node = tree.firstNode(); index = 0; return; } // scan through the nodes, looking for the first one of the right color while(true) { count1 += 1 - index; node = SimpleTree.next(node); index = 0; // we've found a node that meet our requirements, so return break; } }
/** @inheritDoc */ @Override public void dispose() { super.dispose(); // iterate over all child elements and dispose them final SimpleTreeIterator<ChildElement<E>> treeIterator = new SimpleTreeIterator<ChildElement<E>>(childElements); while(treeIterator.hasNext()) { treeIterator.next(); treeIterator.value().dispose(); } }
/** * Get the index of the node immediately following the current. Expected * values are in the range ( 1, size() ) */ public int nodeEndIndex( ) { if(node == null) throw new NoSuchElementException(); // the count of all nodes previous return nodeStartIndex( ) + nodeSize( ); } public T0 value() {
/** * Create a {@link SimpleTreeIterator} exactly the same as this one. * The iterators will be backed by the same tree but maintain * separate cursors into the tree. */ public SimpleTreeIterator < T0> copy() { SimpleTreeIterator < T0> result = new SimpleTreeIterator < T0> (tree); result.count1 = this.count1; result.node = node; result.index = index; return result; }
/** * Step to the next element. */ public void next( ) { if(!hasNext( )) { throw new NoSuchElementException(); } // start at the first node in the tree if(node == null) { node = tree.firstNode(); index = 0; return; // increment within the current node } else if( index < 1 - 1) { count1++; index++; return; } // scan through the nodes, looking for the first one of the right color while(true) { count1 += 1 - index; node = SimpleTree.next(node); index = 0; // we've found a node that meet our requirements, so return break; } }
/** * @return <code>true</code> if there's a node of the specified color in this * tree following the current node. */ public boolean hasNextNode( ) { if(node == null) { return tree.size( ) > 0; } else { return nodeEndIndex( ) < tree.size( ); } }
/** * Step to the next node. */ public void nextNode( ) { if(!hasNextNode( )) { throw new NoSuchElementException(); } // start at the first node in the tree if(node == null) { node = tree.firstNode(); index = 0; return; } // scan through the nodes, looking for the first one of the right color while(true) { count1 += 1 - index; node = SimpleTree.next(node); index = 0; // we've found a node that meet our requirements, so return break; } }
private void beginEvent() { updates.beginEvent(); for (SimpleTreeIterator<GroupList> i = new SimpleTreeIterator<GroupList>(groupLists); i.hasNext();) { i.next(); GroupList group = i.value(); group.getListEventAssembler().beginEvent(); } }