blog
Class CompiledSetSpec

java.lang.Object
  extended by blog.CompiledSetSpec

public class CompiledSetSpec
extends java.lang.Object

Data structure that facilitates iterating over the set of objects x such that a given formula phi(x) is true. A CompiledSetSpec consists of a DNF version of phi, with an ObjGenGraph for each disjunct. To iterate over the objects that satisfy phi, we create an iterator for each ObjGenGraph and get objects from these iterators in a round-robin fashion. When we get an object from an ObjGenGraph, we return it if it satisfies the corresponding disjunct and no earlier disjuncts. Thus, each object that satisfies phi is returned exactly once: when it is returned by the iterator for the first disjunct that it satisfies. The round-robin iteration over disjuncts ensures that even if the ObjGenGraph iterator for, say, the first disjunct returns infinitely many objects, we will still return objects that satisfy the other disjuncts after a finite amount of time.


Constructor Summary
CompiledSetSpec(LogicalVar var, Formula phi)
          Creates a new CompiledSetSpec for iterating over all bindings for var that satisfy phi.
 
Method Summary
 boolean dependsOnIdOrder(EvalContext context)
          Returns true if the iteration order for the set returned by elementSet is affected by the iteration order for object identifiers in the given context.
 ObjectSet elementSet(EvalContext context)
          Returns an ObjectSet representing the objects that, when bound to var, make phi true in the given context.
 java.lang.String toString()
           
 ObjectIterator unfilteredIterator(EvalContext context)
          Returns an iterator over the objects specified by the underlying ObjGenGraphs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompiledSetSpec

public CompiledSetSpec(LogicalVar var,
                       Formula phi)
Creates a new CompiledSetSpec for iterating over all bindings for var that satisfy phi.

Method Detail

elementSet

public ObjectSet elementSet(EvalContext context)
Returns an ObjectSet representing the objects that, when bound to var, make phi true in the given context.


unfilteredIterator

public ObjectIterator unfilteredIterator(EvalContext context)
Returns an iterator over the objects specified by the underlying ObjGenGraphs. This iterator will return every object that satisfies this set specification, but it may return other objects as well.


dependsOnIdOrder

public boolean dependsOnIdOrder(EvalContext context)
Returns true if the iteration order for the set returned by elementSet is affected by the iteration order for object identifiers in the given context.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object