Class AbstractScope

  • All Implemented Interfaces:

    public abstract class AbstractScope
    extends Object
    implements Scope
    Base class for any Scope. Provides useful default implementations.
    • Constructor Detail

      • AbstractScope

        public AbstractScope()
    • Method Detail

      • getParent

        public Scope getParent()
        Description copied from interface: Scope
        Retrieves this scope's parent
        Specified by:
        getParent in interface Scope
      • setParent

        public void setParent​(Scope parent)
        Description copied from interface: Scope
        Points this scope to its parent
        Specified by:
        setParent in interface Scope
      • getDeclarations

        public <T extends NameDeclarationMap<T,​List<NameOccurrence>> getDeclarations​(Class<T> clazz)
        Description copied from interface: Scope
        Helper method to get only a specific type of name declarations. The return map elemens have already been casted to the correct type. This method usually returns a subset of Scope.getDeclarations().
        Specified by:
        getDeclarations in interface Scope
        clazz - the type of name declarations to use
        map of declarations with occurrences.
      • contains

        public boolean contains​(NameOccurrence occ)
        Description copied from interface: Scope
        Tests whether or not a NameOccurrence is directly contained in the scope. This means, whether the given NameOccurrence references a declaration, that has been declared within this scope. Note that this search is just for this scope - it doesn't go diving into any parent scopes.
        Specified by:
        contains in interface Scope
      • getEnclosingScope

        public <T extends Scope> T getEnclosingScope​(Class<T> clazz)
        Description copied from interface: Scope
        Helper method that goes up the parent scopes to find a scope of the specified type
        Specified by:
        getEnclosingScope in interface Scope
        clazz - the type of the Scope to search for
        the found scope of the specified type or null if no such scope was found.