ca.uwaterloo.cs.ql.interp
Class ScopedNode

java.lang.Object
  extended by ca.uwaterloo.cs.ql.interp.SyntaxTreeNode
      extended by ca.uwaterloo.cs.ql.interp.ScopedNode
All Implemented Interfaces:
Scope
Direct Known Subclasses:
ScriptUnitNode

public abstract class ScopedNode
extends SyntaxTreeNode
implements Scope


Constructor Summary
ScopedNode(Scope parent)
          Construct a new ScopedNode.
 
Method Summary
 void addVariable(Variable v)
          Adds a variable into this scope.
 java.util.Enumeration allVariables()
          Enumerates all variables in this scope.
 void clear()
          Clears this scope.
 Scope getParent()
          Gets the parent scope.
 boolean hasVariable(java.lang.String name)
          Tests if this scope has a variable with the specified name.
abstract  Variable lookup(java.lang.String name)
          Looks up a variable from this scope.
 void removeVariable(Variable v)
          Removes a variable from this scope.
 
Methods inherited from class ca.uwaterloo.cs.ql.interp.SyntaxTreeNode
evaluate, getLocation, propagate, setLocation, strLocation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScopedNode

public ScopedNode(Scope parent)
Construct a new ScopedNode.

Method Detail

clear

public void clear()
Clears this scope.

Specified by:
clear in interface Scope

getParent

public Scope getParent()
Gets the parent scope.

Specified by:
getParent in interface Scope

allVariables

public java.util.Enumeration allVariables()
Enumerates all variables in this scope.

Specified by:
allVariables in interface Scope

addVariable

public void addVariable(Variable v)
Adds a variable into this scope.

Specified by:
addVariable in interface Scope
Parameters:
v - the variable to add.

removeVariable

public void removeVariable(Variable v)
Removes a variable from this scope.

Specified by:
removeVariable in interface Scope
Parameters:
v - the variable to remove.

hasVariable

public boolean hasVariable(java.lang.String name)
Tests if this scope has a variable with the specified name.

Specified by:
hasVariable in interface Scope
Parameters:
name - the variable's name.

lookup

public abstract Variable lookup(java.lang.String name)
                         throws LookupException
Looks up a variable from this scope.

Specified by:
lookup in interface Scope
Parameters:
name - the name of the variable to look up.
Throws:
LookupException - if no variable was found.