/** * Create a new {@link FourColorTreeAsList} adapting the specified tree. */ public FourColorTreeAsList/**/(FourColorTree tree) { this(tree, tree.getCoder().colorsToByte(tree.getCoder().getColors()), (byte)1); }
/** * @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( ); } }
/** * @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 ]*/); } }
/** * Change the color of the specified element. */ public final void setColor(Element<T0> element, byte color) { BciiNode node = (BciiNode)element; byte oldColor = node.getColor(); if(oldColor == color) return; fixCountsThruRoot(node, oldColor, -node.size); node.color = color; fixCountsThruRoot(node, color, node.size); } /*[ COLORED_END ]*/
/** * Get the value at the specified target index. * * @return the value, or {@link ListEvent#UNKNOWN_VALUE} if this index * holds a value that hasn't been buffered. In this case, the value * can be obtained from the source list. */ public E getTargetValue(int targetIndex) { return tree.get(targetIndex, TARGET_INDICES).get(); }
/** * @return <code>true</code> if the children of the node at the specified * index are visible. Nodes with no children may be expanded or not, * this is used to determine whether to show children should any be * added. */ public boolean isExpanded(int visibleIndex) { return data.get(visibleIndex, VISIBLE_NODES).get().expanded; }
/** * @return <code>true</code> if the children of the node at the specified * index are visible. Nodes with no children may be expanded or not, * this is used to determine whether to show children should any be * added. */ public boolean isExpanded(int visibleIndex) { return data.get(visibleIndex, VISIBLE_NODES).get().expanded; }