net.sourceforge.pmd.symboltable
Class AbstractScope

java.lang.Object
  |
  +--net.sourceforge.pmd.symboltable.AbstractScope
All Implemented Interfaces:
Scope
Direct Known Subclasses:
ClassScope, GlobalScope, LocalScope, MethodScope

public abstract class AbstractScope
extends java.lang.Object
implements Scope

Provides behavior common to all Scopes


Field Summary
protected  java.util.Map methodNames
           
protected  java.util.Map variableNames
           
 
Constructor Summary
AbstractScope()
           
 
Method Summary
 void addDeclaration(MethodNameDeclaration methodDecl)
          Add a method declaration to this scope
 void addDeclaration(VariableNameDeclaration variableDecl)
          Add a variable declaration to this scope
 NameDeclaration addVariableNameOccurrence(NameOccurrence occurrence)
          Adds a NameOccurrence to this scope - only call this after getting a true back from contains()
 boolean contains(NameOccurrence occurrence)
          Tests whether or not a NameOccurrence is directly contained in the scope Note that if this search is just in this scope - it doesn't go diving into any contained scopes.
protected abstract  NameDeclaration findVariableHere(NameOccurrence occurrence)
           
 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.
 Scope getParent()
          Retrieves this scope's parent
 java.util.Map getVariableDeclarations(boolean lookingForUsed)
          Returns a Map (VariableNameDeclaration->List(NameOccurrence,NameOccurrence)) of declarations that exist and are either used or not used at this scope
protected  java.lang.String glomNames()
           
 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
 

Field Detail

variableNames

protected java.util.Map variableNames

methodNames

protected java.util.Map methodNames
Constructor Detail

AbstractScope

public AbstractScope()
Method Detail

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

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(VariableNameDeclaration variableDecl)
Description copied from interface: Scope
Add a variable declaration to this scope

Specified by:
addDeclaration 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

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 if this search is just in this scope - it doesn't go diving into any contained scopes.

Specified by:
contains in interface Scope

getVariableDeclarations

public java.util.Map getVariableDeclarations(boolean lookingForUsed)
Description copied from interface: Scope
Returns a Map (VariableNameDeclaration->List(NameOccurrence,NameOccurrence)) of declarations that exist and are either used or not used at this scope

Specified by:
getVariableDeclarations in interface Scope

addVariableNameOccurrence

public NameDeclaration addVariableNameOccurrence(NameOccurrence occurrence)
Description copied from interface: Scope
Adds a NameOccurrence to this scope - only call this after getting a true back from contains()

Specified by:
addVariableNameOccurrence in interface Scope

findVariableHere

protected abstract NameDeclaration findVariableHere(NameOccurrence occurrence)

glomNames

protected java.lang.String glomNames()


Copyright © 2002-2003 Project Ultra*Log @ DARPA. All Rights Reserved.