Package org.lsst.ccs.description
Class ComponentLookup
java.lang.Object
org.lsst.ccs.description.ComponentLookup
This class helps find component of the subsystem as they are defined in
the description "tree".
- Author:
- The LSST CCS Team. TO-DO: Allow to add components programmatically with a path TO-DO: Should be possible to close this lookup, preventing further nodes from being added. Or add listeners. Once a component lookup is added to a subsystem it should not be possible to add more components.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponentNodeToLookup(ComponentNode parent, ComponentNode node) booleancontainsComponent(Object obj) getChildren(ComponentNode node, Class<N> classFilter) gets the children of a Component in the ComponentNode and filters by Class.getComponentByPath(String path) return any object registered by the componentNodeDictionaries of the service.getNameOfComponent(Object obj) getNodeByPath(String path) return any object registered by the componentNodeDictionaries of the service.Get the top ComponentNode, ie the tip of the tree structure.<Q> List<Q>listChildren(ComponentNode node, Class<Q> klass) lists the children of a component.<N> List<N>listDescendants(ComponentNode node, Class<N> classFilter) Finds all the children of the given class in the sub-tree starting at the node namedparentNamevoidsetComponentNodeName(ComponentNode node, String name)
-
Constructor Details
-
ComponentLookup
-
-
Method Details
-
getTopComponentNode
Get the top ComponentNode, ie the tip of the tree structure.- Returns:
- The top ComponentNode.
-
setComponentNodeName
-
addComponentNodeToLookup
- Parameters:
parent- the parent component to which the node is added.node-
-
getComponentByPath
return any object registered by the componentNodeDictionaries of the service. The path is first used as an absolute path to the node component. If not found in the node component dictionary, then the path is considered as a component name and checked against the leaf of all the paths in the dictionary.- Parameters:
path- the absolute path to the node component OR the name of the node component- Returns:
- Throws:
RuntimeException- when the path matches multiple components
-
getNodeByPath
return any object registered by the componentNodeDictionaries of the service.- Parameters:
path-- Returns:
-
getNameOfComponent
-
getComponentNodeForObject
-
getChildren
gets the children of a Component in the ComponentNode and filters by Class.- Type Parameters:
N- the type of node- Parameters:
node-classFilter- the class filter. Any class if set to null- Returns:
- the children of
parentName, mapped by their name. The returned map preserves the order in which nodes were inserted in the component node
-
listDescendants
Finds all the children of the given class in the sub-tree starting at the node namedparentName- Type Parameters:
N-- Parameters:
node- the node to start getting the children from. If set to null, the whole component tree is tested against the filter, even the top node.classFilter- the class filter. Any class if set to null- Returns:
-
listChildren
lists the children of a component.- Type Parameters:
Q- the type of node- Parameters:
parentName-klass-- Returns:
- an empty list if there are no children
-
containsComponent
-