net.sourceforge.pmd.lang.java.symboltable

## Class AbstractScope

- java.lang.Object
- - net.sourceforge.pmd.lang.java.symboltable.AbstractScope

All Implemented Interfaces:
  Scope

Direct Known Subclasses:
  ClassScope, LocalScope, MethodScope, SourceFileScope

    public abstract class AbstractScope
    extends Object
    implements Scope

### Constructor Summary

Constructors
Constructor and Description
`AbstractScope()`

### Method Summary

Methods
`void` `addDeclaration(ClassNameDeclaration classDecl)` Add a class declaration to this scope
`void` `addDeclaration(MethodNameDeclaration methodDecl)` Add a method declaration to this scope
`boolean` `contains(NameOccurrence occurrence)` Tests whether or not a NameOccurrence is directly contained in the scope Note that this search is just for this scope - it doesn't go diving into any child scopes.
`protected abstract NameDeclaration` `findVariableHere(NameOccurrence occurrence)`
`Map<ClassNameDeclaration,List<NameOccurrence>>` `getClassDeclarations()` Returns a Map (VariableNameDeclaration->List(NameOccurrence,NameOccurrence)) of declarations that exist at this scope
`ClassScope` `getEnclosingClassScope()` Goes searching up the tree for this scope's enclosing ClassScope This is handy if you're buried down in a LocalScope and need to hop up to the ClassScope to find a method name.
`MethodScope` `getEnclosingMethodScope()` Goes searching up the tree for this scope's enclosing MethodScope This is handy if you're buried down in a LocalScope and need to hop up to the MethodScope to find a method parameter.
`SourceFileScope` `getEnclosingSourceFileScope()` Goes searching up the tree for this scope's enclosing SourceFileScope This is handy if you're buried down in a LocalScope and need to hop up to the SourceFileScope to find a class name.
`Scope` `getParent()` Retrieves this scope's parent
`protected <T> String` `glomNames(Set<T> s)`
`void` `setParent(Scope parent)` Points this scope to its parent

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface net.sourceforge.pmd.lang.java.symboltable.Scope

`addDeclaration, addVariableNameOccurrence, getVariableDeclarations`

### Constructor Detail

#### AbstractScope

    public AbstractScope()

### Method Detail

#### getClassDeclarations

    public Map<ClassNameDeclaration,List<NameOccurrence>> getClassDeclarations()

Description copied from interface: `Scope`
Returns a Map (VariableNameDeclaration->List(NameOccurrence,NameOccurrence)) of declarations that exist at this scope

Specified by:
  `getClassDeclarations` in interface `Scope`

#### getEnclosingMethodScope

    public MethodScope getEnclosingMethodScope()

Description copied from interface: `Scope`
Goes searching up the tree for this scope's enclosing MethodScope This is handy if you're buried down in a LocalScope and need to hop up to the MethodScope to find a method parameter.

Specified by:
  `getEnclosingMethodScope` in interface `Scope`

#### getEnclosingClassScope

    public ClassScope getEnclosingClassScope()

Description copied from interface: `Scope`
Goes searching up the tree for this scope's enclosing ClassScope This is handy if you're buried down in a LocalScope and need to hop up to the ClassScope to find a method name.

Specified by:
  `getEnclosingClassScope` in interface `Scope`

#### getEnclosingSourceFileScope

    public SourceFileScope getEnclosingSourceFileScope()

Description copied from interface: `Scope`
Goes searching up the tree for this scope's enclosing SourceFileScope This is handy if you're buried down in a LocalScope and need to hop up to the SourceFileScope to find a class name.

Specified by:
  `getEnclosingSourceFileScope` 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`

#### getParent

    public Scope getParent()

Description copied from interface: `Scope`
Retrieves this scope's parent

Specified by:
  `getParent` in interface `Scope`

#### addDeclaration

    public void addDeclaration(MethodNameDeclaration methodDecl)

Description copied from interface: `Scope`
Add a method declaration to this scope

Specified by:
  `addDeclaration` in interface `Scope`

#### addDeclaration

    public void addDeclaration(ClassNameDeclaration classDecl)

Description copied from interface: `Scope`
Add a class declaration to this scope

Specified by:
  `addDeclaration` in interface `Scope`

#### contains

    public boolean contains(NameOccurrence occurrence)

Description copied from interface: `Scope`
Tests whether or not a NameOccurrence is directly contained in the scope Note that this search is just for this scope - it doesn't go diving into any child scopes.

Specified by:
  `contains` in interface `Scope`

#### findVariableHere

    protected abstract NameDeclaration findVariableHere(NameOccurrence occurrence)

#### glomNames

    protected <T> String glomNames(Set<T> s)