blog
Class ParentRecEvalContext

java.lang.Object
  extended by blog.DefaultEvalContext
      extended by blog.ParentRecEvalContext
All Implemented Interfaces:
EvalContext
Direct Known Subclasses:
InstantiatingEvalContext, SimpleInstEvalContext

public class ParentRecEvalContext
extends DefaultEvalContext

Implementation of the EvalContext interface that records the basic random variables used by calls to the access methods. The getParents method returns this set of variables.


Field Summary
protected  BasicVar latestUninstParent
           
protected  java.util.Set parents
           
 
Fields inherited from class blog.DefaultEvalContext
errorIfUndet, world
 
Constructor Summary
ParentRecEvalContext(PartialWorld world)
          Creates a new ParentRecEvalContext using the given world.
ParentRecEvalContext(PartialWorld world, boolean errorIfUndet)
          Creates a new ParentRecEvalContext using the given world.
 
Method Summary
 BasicVar getLatestUninstParent()
          Returns the variable whose value was most recently needed by an access method, but which is not instantiated.
 java.util.Set getParents()
          Returns the set of basic random variables that are instantiated and whose values have been used in calls to the access methods.
 NumberVar getPOPAppSatisfied(java.lang.Object obj)
          Returns the NumberVar (i.e., POP and generating objects) such that the given object satisfies that POP applied to those generating objects in this world.
 java.lang.Object getValue(BasicVar var)
          Returns the value of the given basic random variable in this partial world, or null if the given variable is not instantiated.
 
Methods inherited from class blog.DefaultEvalContext
assign, assignTuple, getAssignmentStr, getLogicalVarValue, getLogicalVarValues, getSatisfiers, handleMissingVar, objectExists, popEvaluee, printEvalTrace, pushEvaluee, unassign, unassignTuple, usesIdentifiers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parents

protected java.util.Set parents

latestUninstParent

protected BasicVar latestUninstParent
Constructor Detail

ParentRecEvalContext

public ParentRecEvalContext(PartialWorld world)
Creates a new ParentRecEvalContext using the given world.


ParentRecEvalContext

public ParentRecEvalContext(PartialWorld world,
                            boolean errorIfUndet)
Creates a new ParentRecEvalContext using the given world. If the errorIfUndet flag is true, the access methods on this instance will print error messages and exit the program if the world is not complete enough to determine the correct return value. Otherwise they will just return null in such cases.

Method Detail

getValue

public java.lang.Object getValue(BasicVar var)
Description copied from interface: EvalContext
Returns the value of the given basic random variable in this partial world, or null if the given variable is not instantiated.

Specified by:
getValue in interface EvalContext
Overrides:
getValue in class DefaultEvalContext

getPOPAppSatisfied

public NumberVar getPOPAppSatisfied(java.lang.Object obj)
Description copied from interface: EvalContext
Returns the NumberVar (i.e., POP and generating objects) such that the given object satisfies that POP applied to those generating objects in this world. Returns null if the given object does not satisfy any POP application.

Specified by:
getPOPAppSatisfied in interface EvalContext
Overrides:
getPOPAppSatisfied in class DefaultEvalContext

getParents

public java.util.Set getParents()
Returns the set of basic random variables that are instantiated and whose values have been used in calls to the access methods. This set is backed by the ParentRecEvalContext and will change as more random variables are used.

Returns:
unmodifiable Set of BasicVar

getLatestUninstParent

public BasicVar getLatestUninstParent()
Returns the variable whose value was most recently needed by an access method, but which is not instantiated. This method returns null if no such variable exists.