Constructor | Description |
---|---|
AbstractScope() |
Modifier and Type | Method | Description |
---|---|---|
void |
addDeclaration(NameDeclaration declaration) |
Adds a new declaration to this scope.
|
java.util.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. |
java.util.Map<NameDeclaration,java.util.List<NameOccurrence>> |
getDeclarations() |
Gets all the declaration with the occurrences in this scope.
|
<T extends NameDeclaration> |
getDeclarations(java.lang.Class<T> clazz) |
Helper method to get only a specific type of name declarations.
|
<T extends Scope> |
getEnclosingScope(java.lang.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()
Scope
public void setParent(Scope parent)
Scope
public java.util.Map<NameDeclaration,java.util.List<NameOccurrence>> getDeclarations()
Scope
getDeclarations
in interface Scope
public <T extends NameDeclaration> java.util.Map<T,java.util.List<NameOccurrence>> getDeclarations(java.lang.Class<T> clazz)
Scope
Scope.getDeclarations()
.getDeclarations
in interface Scope
clazz
- the type of name declarations to usepublic boolean contains(NameOccurrence occ)
Scope
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.public void addDeclaration(NameDeclaration declaration)
Scope
Scope.contains(NameOccurrence)
and
Scope.addNameOccurrence(NameOccurrence)
can be used correctly.addDeclaration
in interface Scope
declaration
- the declaration to addpublic <T extends Scope> T getEnclosingScope(java.lang.Class<T> clazz)
Scope
getEnclosingScope
in interface Scope
clazz
- the type of the Scope to search fornull
if no
such scope was found.public java.util.Set<NameDeclaration> addNameOccurrence(NameOccurrence occurrence)
Scope
NameOccurrence
to this scope - only call this after
getting a true back from Scope.contains(NameOccurrence)
.addNameOccurrence
in interface Scope
NameDeclaration
s that are referenced by the given
NameOccurrence
, if the NameOccurrence
could be
added. Otherwise an empty set is returned.Copyright © 2002–2018 PMD. All rights reserved.