/** * Create a {@link BciiTreeIterator} exactly the same as this one. * The iterators will be backed by the same tree but maintain * separate cursors into the tree. */ public BciiTreeIterator/*[ TYPELIST_START ]*/ <T0,T1> /*[ TYPELIST_END ]*/ copy() { BciiTreeIterator/*[ TYPELIST_START ]*/ <T0,T1> /*[ TYPELIST_END ]*/ result = new BciiTreeIterator/*[ TYPELIST_START ]*/ <T0,T1> /*[ TYPELIST_END ]*/(tree); /*[ GENERATED_CODE_START forloop(`i', 0, VAR_LAST_COLOR_INDEX, `result.counti(i) = this.counti(i); ') GENERATED_CODE_END EXAMPLE_START ]*/ result.count1 = this.count1; result.count2 = this.count2; result.count4 = this.count4; /*[ EXAMPLE_END ]*/ result.node = node; result.index = index; return result; }
/** * Get the index of the node immediately following the current. Expected * values are in the range ( 1, size() ) */ public int nodeEndIndex(/*[ COLORED_START ]*/ byte colors /*[ COLORED_END ]*/) { if(node == null) throw new NoSuchElementException(); // the count of all nodes previous return nodeStartIndex(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) + nodeSize(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/); } public T0 value() {
/** * @return <code>true</code> if there's a node of the specified color in this * tree following the current node. */ public boolean hasNextNode(/*[ COLORED_START ]*/ byte colors /*[ COLORED_END ]*/) { if(node == null) { return tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) > 0; } else { return nodeEndIndex(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) < tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/); } }
/** * @return <code>true</code> if there's an element of the specified color in * this tree following the current element. */ public boolean hasNext(/*[ COLORED_START ]*/ byte colors /*[ COLORED_END ]*/) { if(node == null) { return tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) > 0; } else if(/*[ COLORED_START(true) ]*/ (colors & node.color) != 0 /*[ COLORED_END ]*/) { return index(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) < tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) - 1; } else { return index(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) < tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/); } }
if(!hasNextNode(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/)) { throw new NoSuchElementException();
if(!hasNext(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/)) { 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(/*[ COLORED_START ]*/ byte colors /*[ COLORED_END ]*/) { if(node == null) { return tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) > 0; } else { return nodeEndIndex(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) < tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/); } }
/** * @return <code>true</code> if there's an element of the specified color in * this tree following the current element. */ public boolean hasNext(/*[ COLORED_START ]*/ byte colors /*[ COLORED_END ]*/) { if(node == null) { return tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) > 0; } else if(/*[ COLORED_START(true) ]*/ (colors & node.color) != 0 /*[ COLORED_END ]*/) { return index(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) < tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) - 1; } else { return index(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) < tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/); } }
if(!hasNextNode(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/)) { throw new NoSuchElementException();
if(!hasNext(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/)) { throw new NoSuchElementException();
/** * Get the index of the node immediately following the current. Expected * values are in the range ( 1, size() ) */ public int nodeEndIndex(/*[ COLORED_START ]*/ byte colors /*[ COLORED_END ]*/) { if(node == null) throw new NoSuchElementException(); // the count of all nodes previous return nodeStartIndex(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) + nodeSize(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/); } public T0 value() {
/** * @return <code>true</code> if there's a node of the specified color in this * tree following the current node. */ public boolean hasNextNode(/*[ COLORED_START ]*/ byte colors /*[ COLORED_END ]*/) { if(node == null) { return tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) > 0; } else { return nodeEndIndex(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) < tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/); } }
/** * @return <code>true</code> if there's an element of the specified color in * this tree following the current element. */ public boolean hasNext(/*[ COLORED_START ]*/ byte colors /*[ COLORED_END ]*/) { if(node == null) { return tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) > 0; } else if(/*[ COLORED_START(true) ]*/ (colors & node.color) != 0 /*[ COLORED_END ]*/) { return index(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) < tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) - 1; } else { return index(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) < tree.size(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/); } }
/** * Create a {@link BciiTreeIterator} exactly the same as this one. * The iterators will be backed by the same tree but maintain * separate cursors into the tree. */ public BciiTreeIterator/*[ TYPELIST_START ]*/ <T0,T1> /*[ TYPELIST_END ]*/ copy() { BciiTreeIterator/*[ TYPELIST_START ]*/ <T0,T1> /*[ TYPELIST_END ]*/ result = new BciiTreeIterator/*[ TYPELIST_START ]*/ <T0,T1> /*[ TYPELIST_END ]*/(tree); /*[ GENERATED_CODE_START forloop(`i', 0, VAR_LAST_COLOR_INDEX, `result.counti(i) = this.counti(i); ') GENERATED_CODE_END EXAMPLE_START ]*/ result.count1 = this.count1; result.count2 = this.count2; result.count4 = this.count4; /*[ EXAMPLE_END ]*/ result.node = node; result.index = index; return result; }
if(!hasNextNode(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/)) { throw new NoSuchElementException();
if(!hasNext(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/)) { throw new NoSuchElementException();
/** * Get the index of the node immediately following the current. Expected * values are in the range ( 1, size() ) */ public int nodeEndIndex(/*[ COLORED_START ]*/ byte colors /*[ COLORED_END ]*/) { if(node == null) throw new NoSuchElementException(); // the count of all nodes previous return nodeStartIndex(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/) + nodeSize(/*[ COLORED_START ]*/ colors /*[ COLORED_END ]*/); } public T0 value() {
/** * Create a {@link BciiTreeIterator} exactly the same as this one. * The iterators will be backed by the same tree but maintain * separate cursors into the tree. */ public BciiTreeIterator/*[ TYPELIST_START ]*/ <T0,T1> /*[ TYPELIST_END ]*/ copy() { BciiTreeIterator/*[ TYPELIST_START ]*/ <T0,T1> /*[ TYPELIST_END ]*/ result = new BciiTreeIterator/*[ TYPELIST_START ]*/ <T0,T1> /*[ TYPELIST_END ]*/(tree); /*[ GENERATED_CODE_START forloop(`i', 0, VAR_LAST_COLOR_INDEX, `result.counti(i) = this.counti(i); ') GENERATED_CODE_END EXAMPLE_START ]*/ result.count1 = this.count1; result.count2 = this.count2; result.count4 = this.count4; /*[ EXAMPLE_END ]*/ result.node = node; result.index = index; return result; }