blog
Class ObjGenGraph.Node

java.lang.Object
  extended by blog.ObjGenGraph.Node
Direct Known Subclasses:
ObjGenGraph.GuaranteedNode, ObjGenGraph.IntegerNode, ObjGenGraph.OrNode, ObjGenGraph.POPNode, ObjGenGraph.TermNode
Enclosing class:
ObjGenGraph

public abstract static class ObjGenGraph.Node
extends java.lang.Object


Constructor Summary
ObjGenGraph.Node()
           
 
Method Summary
abstract  boolean dependsOnIdOrder(EvalContext context)
          Returns true if the iteration order for satisfiers of this node depends on the iteration order for object identifiers in the given context.
abstract  boolean isFinite()
          Returns true if every call to this node's iterator method returns an iterator over a finite set.
abstract  ObjectIterator iterator(EvalContext context, java.util.Set externallyDistinguished, boolean returnPOPApps, java.util.Map desiredPOPParentObjs, java.util.Map otherPOPParentObjs, boolean includeGuaranteed)
          Returns an iterator over the objects that satisfy this node in the given context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjGenGraph.Node

public ObjGenGraph.Node()
Method Detail

iterator

public abstract ObjectIterator iterator(EvalContext context,
                                        java.util.Set externallyDistinguished,
                                        boolean returnPOPApps,
                                        java.util.Map desiredPOPParentObjs,
                                        java.util.Map otherPOPParentObjs,
                                        boolean includeGuaranteed)
Returns an iterator over the objects that satisfy this node in the given context.

The obvious algorithm for enumerating objects that satisfy a node is by recursion in the object generation graph. But that algorithm would get stuck in cycles. Thus, we terminate the recursion at the parents of POPNodes. A non-root node's iterator method will be called repeatedly, with larger and larger lists of satisfying objects for the parents of POP nodes.

Since we're calling iterator repeatedly, we need a way to get distinct objects each time. Thus, we specify a list of desired objects for each POP node parent. All the returned objects must satisfy a POP application involving at least one of these desired objects and possibly some of the additional objects specified in otherPOPParentObjs. The desired parent objects will always be objects that were not included in the previous calls to iterator, so the objects returned will be distinct from those returned previously.

As an exception, if includeGuaranteed is true, then the returned objects may also be guaranteed objects, objects that satisfy a POP application with an empty tuple of generating objects, or the satisfiers of TermNodes.

Parameters:
desiredPOPParentObjs - Map from Node to List
otherPOPParentObjs - Map from Node to List

isFinite

public abstract boolean isFinite()
Returns true if every call to this node's iterator method returns an iterator over a finite set.


dependsOnIdOrder

public abstract boolean dependsOnIdOrder(EvalContext context)
Returns true if the iteration order for satisfiers of this node depends on the iteration order for object identifiers in the given context.