condor.classad
Class Expr.Env

Object
  |
  +--condor.classad.Expr.Env
Enclosing class:
Expr

protected static class Expr.Env
extends Object

An environment for evaluating expressions. Logically, it is a stack of RecordExprs, from innermost to outermost, containing in the expression being evaluated. It is constructed in such a way that it can be updated "in place". When passed as an argument e to eval, e.next is treated as a pointer to the top of the stack and the e.recEx is ignored. Thus an argument e where e.next == null is treated as an empty stack, and if e.next != null, e.next.recEx is the top of the stack.


Constructor Summary
Expr.Env()
          Create a new "empty" Env.
Expr.Env(Expr.Env env)
          Create a "clone" of a given Env.
Expr.Env(RecordExpr recEx, Expr.Env next)
          Construct a new Env from its components.
 
Method Summary
 void clear()
          Change this Env to the "empty" env.
 void push(RecordExpr recEx)
          Push a new RecordExpr onto the stack.
 Expr search(AttrName name)
          Search for a given attribute name in the RecordExprs on the stack, from innermost to outermost.
 String toString()
          String representation, for debugging.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Expr.Env

public Expr.Env(RecordExpr recEx,
                Expr.Env next)
Construct a new Env from its components.

Parameters:
recEx - the top (innermost) RecordExpr.
next - the rest of the stack.

Expr.Env

public Expr.Env()
Create a new "empty" Env.


Expr.Env

public Expr.Env(Expr.Env env)
Create a "clone" of a given Env. The components are shared.

Parameters:
env - the Env to be copied.
Method Detail

clear

public void clear()
Change this Env to the "empty" env.


push

public void push(RecordExpr recEx)
Push a new RecordExpr onto the stack.

Parameters:
recEx - the RecordExpr to be pushed.

search

public Expr search(AttrName name)
Search for a given attribute name in the RecordExprs on the stack, from innermost to outermost. If the name is found, return the corresponding value, and pop all higher elements off the stack in this Env. If the name is not found, reset this Env to the null environment (empty stack) and return null.

Returns:
the corresponding value, or null.

toString

public String toString()
String representation, for debugging.

Overrides:
toString in class Object
Returns:
a String representation of the Env.