Package io.jenetics.ext.util
Interface FlatTree<V,T extends FlatTree<V,T>>
- 
- All Known Subinterfaces:
 TreeGene<A,G>
- All Known Implementing Classes:
 AbstractTreeGene,FlatTreeNode
public interface FlatTree<V,T extends FlatTree<V,T>> extends Tree<V,T>
Tree specification, where the nodes of the whole tree are stored in an array. The tree0 ├── 1 │ ├── 4 │ └── 5 ├── 2 │ └── 6 └── 3 ├── 7 │ ├── 10 │ └── 11 ├── 8 └── 9will be stored in breadth-first order and will look like this:┌─┬───┐ ┌──────┬──┐ 0 1 2 3 4 5 6 7 8 9 10 11 └─│─│─┴─┘ │ │ │ └─│─────┘ │ │ └───────┴───┘The child nodes are always stored on the right side of the parent flattenedNodes. So you have to read the tree from left to right. All children of a parent node are stored continuously after thechildOffsetand are defined by the sub-array[childOffset, childOffset + childCount).- Since:
 - 3.9
 - Version:
 - 3.9
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description intchildOffset()Return the index of the first child node in the underlying node array.default ISeq<T>flattenedNodes()Return the whole flattened tree values in breadth-first order.- 
Methods inherited from interface java.lang.Iterable
forEach, spliterator 
- 
Methods inherited from interface io.jenetics.ext.util.Tree
breadthFirstIterator, breadthFirstStream, childAfter, childAt, childAtPath, childAtPath, childBefore, childCount, childIterator, childPath, childStream, depth, depthFirstIterator, depthFirstStream, firstChild, firstLeaf, identical, indexOf, isAncestor, isChild, isDescendant, isLeaf, isRelated, isRoot, isSibling, iterator, lastChild, lastLeaf, leafCount, level, nextLeaf, nextNode, nextSibling, parent, path, pathElements, pathFromAncestorIterator, postorderIterator, postorderStream, preorderIterator, preorderStream, previousLeaf, previousNode, previousSibling, root, sharedAncestor, siblingCount, size, stream, toParenthesesString, toParenthesesString, value 
 - 
 
 - 
 
- 
- 
Method Detail
- 
childOffset
int childOffset()
Return the index of the first child node in the underlying node array.-1is returned ifthisnode is a leaf.- Returns:
 - Return the index of the first child node in the underlying node
         array, or 
-1ifthisnode is a leaf 
 
- 
flattenedNodes
default ISeq<T> flattenedNodes()
Return the whole flattened tree values in breadth-first order. This is equivalent tofinal ISeq<T> seq = getRoot().breadthFirstStream() .collect(ISeq.toISeq());- Returns:
 - the flattened tree values in breadth-first order
 
 
 - 
 
 -