Interface SScope


  • public interface SScope
    Scope provides a set of nodes, visible in the particular context. It may also associate a unique textual representation with each node and is capable of resolving nodes by these strings.
    • Method Detail

      • getAvailableElements

        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

        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
        SNode resolve​(@NotNull
                      String refText)
        Resolves element by reference text.

        Invariant: getReferenceText(contextNode, resolve(contextNode, refText)) == refText

        Parameters:
        refText - reference text
        Returns:
        resolved element when reference text unambiguously identifies element, null otherwise
      • getReferenceText

        @Nullable
        String getReferenceText​(@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:
        node - element from the current scope (contains(node) == true)
        Returns:
        reference text for the node element in the current scope