Class ComponentLookup

java.lang.Object
org.lsst.ccs.description.ComponentLookup

public class ComponentLookup extends Object
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 Details

  • Method Details

    • getTopComponentNode

      public ComponentNode getTopComponentNode()
      Get the top ComponentNode, ie the tip of the tree structure.
      Returns:
      The top ComponentNode.
    • setComponentNodeName

      public void setComponentNodeName(ComponentNode node, String name)
    • addComponentNodeToLookup

      public void addComponentNodeToLookup(ComponentNode parent, ComponentNode node)
      Parameters:
      parent - the parent component to which the node is added.
      node -
    • getComponentByPath

      public Object getComponentByPath(String path)
      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

      public ComponentNode getNodeByPath(String path)
      return any object registered by the componentNodeDictionaries of the service.
      Parameters:
      path -
      Returns:
    • getNameOfComponent

      public String getNameOfComponent(Object obj)
    • getComponentNodeForObject

      public ComponentNode getComponentNodeForObject(Object obj)
    • getChildren

      public <N> Map<String,N> getChildren(ComponentNode node, Class<N> classFilter)
      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

      public <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 named parentName
      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

      public <Q> List<Q> listChildren(ComponentNode node, Class<Q> klass)
      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

      public boolean containsComponent(Object obj)