public static interface TreeDef.Parented<T> extends TreeDef<T>
A pair of functions which define a doubly-linked tree, where nodes know about both their parent and their children.
It is critical that the TreeDef.Parented
is consistent - if Vader claims that Luke and Leia are his children, then both Luke and Leia must say that Vader is their parent.
If Luke or Leia don’t agree that Vader is their father, then the algorithms that use this TreeDef.Parented
are likely to fail in unexpected ways.
TreeDef.Parented<T>
Modifier and Type | Method and Description |
---|---|
default TreeDef.Parented<T> |
filter(Predicate<T> predicate)
Creates a new
TreeDef.Parented whose childrenOf and parentOf methods are filtered by predicate . |
static <T> TreeDef.Parented<T> |
of(Function<T,List<T>> childFunc,
Function<T,T> parentFunc)
Creates a new
TreeDef.Parented which is implemented by the two given functions. |
T |
parentOf(T node)
Returns the parent of the given node.
|
childrenOf, forFile, forPath, of
default TreeDef.Parented<T> filter(Predicate<T> predicate)
Creates a new TreeDef.Parented
whose childrenOf
and parentOf
methods are filtered by predicate
.
static <T> TreeDef.Parented<T> of(Function<T,List<T>> childFunc, Function<T,T> parentFunc)
Creates a new TreeDef.Parented
which is implemented by the two given functions.