Class Scope

    • Constructor Detail

      • Scope

        public Scope()
    • Method Detail

      • getAvailableElements

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

        public boolean contains​(SNode node)
        Returns true if this scope contains the specified element. Invariant: contains(node) == getAvailableElements(null).contains(node)
        Parameters:
        node - element to check presence for
        Returns:
        true if this scope contains the specified element
      • resolve

        @Nullable
        public abstract SNode resolve​(SNode contextNode,
                                      @NotNull
                                      String refText)
        Resolves element by reference text. Invariant: getReferenceText(contextNode, resolve(contextNode, refText)) == refText
        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
      • getReferenceText

        @Nullable
        public abstract String getReferenceText​(SNode contextNode,
                                                @NotNull
                                                SNode node)
        Creates textual reference for scope element. If element has no textual representation for the reference, returns null. Invariant: resolve(contextNode, getReferenceText(contextNode, node)) == node
        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
      • parent

        public static SNode parent​(SNode n)
        Scope-friendly traversal of an ancestor hierarchy with respect to attribute nodes