|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- The leaf typepublic interface StringTree<T>
An interface defining a structure with nodes, subnodes and leaves. This is a recursively defined datastructure, so each instance can be a tree or a leaf. Each is node is named with a String, and each leaf can contain a value of type T. Each non-leaf tree can have any number of subnodes, each identified by a String.
Method Summary | |
---|---|
java.util.Map<java.lang.String,StringTree<T>> |
getChildMap()
Get a map of all direct subtrees, assuming that all subtrees are uniquely named. |
java.util.Map<java.lang.String,java.util.List<StringTree<T>>> |
getChildMultimap()
Get a map of all direct children of this node. |
java.util.Map<java.lang.String,T> |
getLeafMap()
Get a map of the names and values of all subtrees, assuming that all subtrees are leafs and are uniquely named. |
java.util.Map<java.lang.String,java.util.List<T>> |
getLeafMultimap()
Get a multimap of the names and values of all direct subtrees, assuming that all subtrees are leafs. |
StringTree<T> |
getSubTree(java.lang.String name)
Get the only subtree with the given name. |
java.util.List<StringTree<T>> |
getSubTrees(java.lang.String name)
Get the named subtrees. |
T |
getValue()
Get the value of a leaf. |
T |
getValue(java.lang.String name)
Get the value of a named sub-leaf. |
boolean |
isLeaf()
Returns true if this object is a leaf, and thus if getValue is legal. |
Method Detail |
---|
boolean isLeaf()
T getValue(java.lang.String name)
name
- Name of the sub-leaf to get the value of. These are strings,
and as a shorthand may specify subtrees of subtrees by separating each
level with '.', i.e. getSubtrees("subtree.subsubtree").
IllegalState
- if this StringTree does not have exactly one
leaf sub-node with the given name.
ArgumentNotValid
- if argument is null or empty.T getValue()
IllegalState
- if this StringTree is a node.StringTree<T> getSubTree(java.lang.String name)
name
- The name of the subtree. These are strings, and as a
shorthand may specify subtrees of subtrees by separating each level with
'.', i.e. getSubtrees("subtree.subsubtree").
IllegalState
- if this object is a leaf or if there is not
exactly one subtree with the given name.
ArgumentNotValid
- if argument is null or empty.java.util.List<StringTree<T>> getSubTrees(java.lang.String name)
name
- The name of the subtrees. These are strings, and as a
shorthand may specify subtrees of subtrees by separating each level with
'.', i.e. getSubtrees("subtree.subsubtree").
IllegalState
- if this object is a leaf.
ArgumentNotValid
- if argument is null or empty.java.util.Map<java.lang.String,java.util.List<StringTree<T>>> getChildMultimap()
IllegalState
- if this object is a leaf.java.util.Map<java.lang.String,StringTree<T>> getChildMap()
IllegalState
- if this object is a leaf or if there is more
than one subtree with the same name.java.util.Map<java.lang.String,java.util.List<T>> getLeafMultimap()
IllegalState
- if this object is a leaf or if any of its children
are not leaves.java.util.Map<java.lang.String,T> getLeafMap()
IllegalState
- if this object is a leaf or if the subtrees are not
uniquely named, or if any of its children are not leaves.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |