| Constructor and Description |
|---|
AbstractScope() |
| Modifier and Type | Method and Description |
|---|---|
void |
addDeclaration(NameDeclaration declaration)
Adds a new declaration to this scope.
|
Set<NameDeclaration> |
addNameOccurrence(NameOccurrence occurrence)
Adds a
NameOccurrence to this scope - only call this after
getting a true back from Scope.contains(NameOccurrence). |
boolean |
contains(NameOccurrence occ)
Tests whether or not a
NameOccurrence is directly contained in
the scope. |
Map<NameDeclaration,List<NameOccurrence>> |
getDeclarations()
Gets all the declaration with the occurrences in this scope.
|
<T extends NameDeclaration> |
getDeclarations(Class<T> clazz)
Helper method to get only a specific type of name declarations.
|
<T extends Scope> |
getEnclosingScope(Class<T> clazz)
Helper method that goes up the parent scopes to find a scope of the
specified type
|
Scope |
getParent()
Retrieves this scope's parent
|
void |
setParent(Scope parent)
Points this scope to its parent
|
public Scope getParent()
Scopepublic void setParent(Scope parent)
Scopepublic Map<NameDeclaration,List<NameOccurrence>> getDeclarations()
ScopegetDeclarations in interface Scopepublic <T extends NameDeclaration> Map<T,List<NameOccurrence>> getDeclarations(Class<T> clazz)
ScopeScope.getDeclarations().getDeclarations in interface Scopeclazz - the type of name declarations to usepublic boolean contains(NameOccurrence occ)
ScopeNameOccurrence 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.public void addDeclaration(NameDeclaration declaration)
ScopeScope.contains(NameOccurrence) and
Scope.addNameOccurrence(NameOccurrence) can be used correctly.addDeclaration in interface Scopedeclaration - the declaration to addpublic <T extends Scope> T getEnclosingScope(Class<T> clazz)
ScopegetEnclosingScope in interface Scopeclazz - the type of the Scope to search fornull if no
such scope was found.public Set<NameDeclaration> addNameOccurrence(NameOccurrence occurrence)
ScopeNameOccurrence to this scope - only call this after
getting a true back from Scope.contains(NameOccurrence).addNameOccurrence in interface ScopeNameDeclarations that are referenced by the given
NameOccurrence, if the NameOccurrence could be
added. Otherwise an empty set is returned.Copyright © 2002–2017 PMD. All rights reserved.