Package uk.ac.starlink.vo
Class Tree.Leaf<T>
java.lang.Object
uk.ac.starlink.vo.Tree<T>
uk.ac.starlink.vo.Tree.Leaf<T>
Tree instance that contains a referenced item and no children.
-
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.getItem()Returns the item referenced by this leaf.booleanisLeaf()Returns true if this instance is a Leaf, false if it's a Branch.<R> Tree.Leaf<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
-
Leaf
Constructor.- Parameters:
item- item held by this leaf
-
-
Method Details
-
getItem
Returns the item referenced by this leaf.- Returns:
- item
-
isLeaf
public boolean isLeaf()Description copied from class:TreeReturns true if this instance is a Leaf, false if it's a Branch. -
asLeaf
Description copied from class:TreeReturns this instance as a Leaf if it's a leaf, or null if it's a branch. -
asBranch
Description copied from class:TreeReturns this instance as a Branch if it's a branch, or null if it's a leaf. -
map
Description copied from class:TreeRecursively 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.
-