Package uk.ac.starlink.vo
Class Tree.Branch<T>
java.lang.Object
uk.ac.starlink.vo.Tree<T>
uk.ac.starlink.vo.Tree.Branch<T>
Tree instance that contains a list of children and no referenced item.
-
Nested Class Summary
Nested classes/interfaces inherited from class uk.ac.starlink.vo.Tree
Tree.Branch<T>, Tree.Leaf<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasBranch()
Returns this instance as a Branch if it's a branch, or null if it's a leaf.asLeaf()
Returns this instance as a Leaf if it's a leaf, or null if it's a branch.Returns this branch's children.getLabel()
Returns this branch's label.boolean
isLeaf()
Returns true if this instance is a Leaf, false if it's a Branch.<R> Tree.Branch<R>
Recursively converts this Tree to one with the same structure, but with the leaf items mapped from their existing values to new values determined by a supplied mapping function.
-
Constructor Details
-
Branch
Constructor.- Parameters:
children
- list of child treeslabel
- label for this branch, may be null
-
-
Method Details
-
getChildren
Returns this branch's children.- Returns:
- list of child trees
-
getLabel
Returns this branch's label.- Returns:
- label, may be null
-
isLeaf
public boolean isLeaf()Description copied from class:Tree
Returns true if this instance is a Leaf, false if it's a Branch. -
asLeaf
Description copied from class:Tree
Returns this instance as a Leaf if it's a leaf, or null if it's a branch. -
asBranch
Description copied from class:Tree
Returns this instance as a Branch if it's a branch, or null if it's a leaf. -
map
Description copied from class:Tree
Recursively converts this Tree to one with the same structure, but with the leaf items mapped from their existing values to new values determined by a supplied mapping function.
-