Class AbstractScope
java.lang.Object
net.sourceforge.pmd.lang.symboltable.AbstractScope
- All Implemented Interfaces:
Scope
Deprecated.
Base class for any
Scope. Provides useful default implementations.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDeclaration(NameDeclaration declaration) Deprecated.Adds a new declaration to this scope.addNameOccurrence(NameOccurrence occurrence) Deprecated.Adds aNameOccurrenceto this scope - only call this after getting a true back fromScope.contains(NameOccurrence).booleancontains(NameOccurrence occ) Deprecated.Tests whether or not aNameOccurrenceis directly contained in the scope.Deprecated.Gets all the declaration with the occurrences in this scope.<T extends NameDeclaration>
Map<T, List<NameOccurrence>> getDeclarations(Class<T> clazz) Deprecated.Helper method to get only a specific type of name declarations.<T extends Scope>
TgetEnclosingScope(Class<T> clazz) Deprecated.Helper method that goes up the parent scopes to find a scope of the specified typeDeprecated.Retrieves this scope's parentvoidDeprecated.Points this scope to its parent
-
Constructor Details
-
AbstractScope
public AbstractScope()Deprecated.
-
-
Method Details
-
getParent
Deprecated.Description copied from interface:ScopeRetrieves this scope's parent -
setParent
Deprecated.Description copied from interface:ScopePoints this scope to its parent -
getDeclarations
Deprecated.Description copied from interface:ScopeGets all the declaration with the occurrences in this scope.- Specified by:
getDeclarationsin interfaceScope- Returns:
- map of declarations with occurrences.
-
getDeclarations
Deprecated.Description copied from interface:ScopeHelper method to get only a specific type of name declarations. The return map elements have already been casted to the correct type. This method usually returns a subset ofScope.getDeclarations().- Specified by:
getDeclarationsin interfaceScope- Parameters:
clazz- the type of name declarations to use- Returns:
- map of declarations with occurrences.
-
contains
Deprecated.Description copied from interface:ScopeTests whether or not aNameOccurrenceis directly contained in the scope. This means, whether the givenNameOccurrencereferences 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. -
addDeclaration
Deprecated.Description copied from interface:ScopeAdds a new declaration to this scope. Only after the declaration has been added,Scope.contains(NameOccurrence)andScope.addNameOccurrence(NameOccurrence)can be used correctly.- Specified by:
addDeclarationin interfaceScope- Parameters:
declaration- the declaration to add
-
getEnclosingScope
Deprecated.Description copied from interface:ScopeHelper method that goes up the parent scopes to find a scope of the specified type- Specified by:
getEnclosingScopein interfaceScope- Parameters:
clazz- the type of the Scope to search for- Returns:
- the found scope of the specified type or
nullif no such scope was found.
-
addNameOccurrence
Deprecated.Description copied from interface:ScopeAdds aNameOccurrenceto this scope - only call this after getting a true back fromScope.contains(NameOccurrence).- Specified by:
addNameOccurrencein interfaceScope- Returns:
- the
NameDeclarations that are referenced by the givenNameOccurrence, if theNameOccurrencecould be added. Otherwise an empty set is returned.
-
net.sourceforge.pmd.lang.symboltable.