Class CompositeScope


  • public class CompositeScope
    extends Scope
    • Constructor Detail

      • CompositeScope

        public CompositeScope​(Scope... scopeChain)
    • Method Detail

      • addScope

        public void addScope​(Scope scope)
      • resolve

        public SNode resolve​(SNode contextNode,
                             String refText)
        Description copied from class: Scope
        Resolves element by reference text. Invariant: getReferenceText(contextNode, resolve(contextNode, refText)) == refText
        Specified by:
        resolve in class Scope
        Parameters:
        contextNode - source node for the reference, or its nearest parent node (if source node is unavailable)
        refText - reference text
        Returns:
        resolved element when reference text unambiguously identifies element, null otherwise
      • getAvailableElements

        public Iterable<SNode> getAvailableElements​(@Nullable
                                                    String prefix)
        Description copied from class: Scope
        Returns all available elements in the scope.
        Specified by:
        getAvailableElements in class Scope
        Parameters:
        prefix - (if not null) filters out elements whose reference text doesn't start with prefix
        Returns:
        list of nodes in the scope
      • getReferenceText

        public String getReferenceText​(SNode contextNode,
                                       SNode node)
        Description copied from class: Scope
        Creates textual reference for scope element. If element has no textual representation for the reference, returns null. Invariant: resolve(contextNode, getReferenceText(contextNode, node)) == node
        Specified by:
        getReferenceText in class Scope
        Parameters:
        contextNode - source node for the reference, or its nearest parent node (if source node is unavailable)
        node - element from the current scope (contains(node) == true)
        Returns:
        reference text for the node element in the current scope
      • createComposite

        public static Scope createComposite​(Scope... scopes)