condor.classad
Class Env

Object
  extended bycondor.classad.Env

public class Env
extends Object

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

Version:
2.2
Author:
Marvin Solomon

Constructor Summary
Env()
          Create a new "empty" Env.
Env(Env env)
          Create a "clone" of a given Env.
Env(RecordExpr recEx, Env next)
          Construct a new Env from its components.
 
Method Summary
 void clear()
          Change this Env to the "empty" env.
 RecordExpr pop(int n)
          Pops "n" records off the stack.
 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

Env

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

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

Env

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


Env

public Env(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.

pop

public RecordExpr pop(int n)
Pops "n" records off the stack.

Parameters:
n - the number of records to pop.
Returns:
the last record popped, or null if the stack had fewer than "n" records.

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.

Parameters:
name - the name to search for.
Returns:
the corresponding value, or null.

toString

public String toString()
String representation, for debugging.

Returns:
a String representation of the Env.