orc.runtime.values
Class GroupCell

java.lang.Object
  extended by orc.runtime.values.GroupCell
All Implemented Interfaces:
java.io.Serializable, Future

public class GroupCell
extends java.lang.Object
implements java.io.Serializable, Future

A value container that is also a group. Groups are essential to the evaluation of where clauses: all the tokens that arise from execution of a where definition are associated with the same group. Once a value is produced for the group, all these tokens are terminated.

Author:
wcook, dkitchin
See Also:
Serialized Form

Field Summary
static GroupCell ROOT
           
 
Constructor Summary
protected GroupCell(TokenTracer.PullTrace pullTrace)
           
 
Method Summary
 void close()
           
 GroupCell createCell(TokenTracer.PullTrace pull)
          Groups are organized into a tree.
 java.lang.Object forceArg(Token t)
           
 Callable forceCall(Token t)
           
 Transaction getTransaction()
           
 boolean isAlive()
          Check if a group has been killed
 boolean isBound()
           
 void kill()
          Recursively kills all subgroups.
 java.lang.Object peekValue()
           
 void setRegion(Region region)
           
 void setTransaction(Transaction trans)
           
 void setValue(Token token)
          This call defines the fundamental behavior of groups: When the value is bound, all subgroups are killed and all waiting tokens are activated.
 java.lang.String toString()
           
 void waitForValue(Token t)
          Add a token to the waiting queue of this group
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ROOT

public static final GroupCell ROOT
Constructor Detail

GroupCell

protected GroupCell(TokenTracer.PullTrace pullTrace)
Method Detail

createCell

public GroupCell createCell(TokenTracer.PullTrace pull)
Groups are organized into a tree. In this case a new subgroup is created and returned. When we add a new child cell, we can also remove any dead children so that their memory can be recycled.

Parameters:
pullTrace - used to identify the group cell in traces (see TokenTracer.pull()).
Returns:
the new group

setValue

public void setValue(Token token)
This call defines the fundamental behavior of groups: When the value is bound, all subgroups are killed and all waiting tokens are activated.

Parameters:
token - the token with the result value for the group

kill

public void kill()
Recursively kills all subgroups. After the children are killed, set children to null so that the memory used by the killed objects can be recycled.


isAlive

public boolean isAlive()
Check if a group has been killed

Returns:
true if the group has not been killed

waitForValue

public void waitForValue(Token t)
Add a token to the waiting queue of this group

Parameters:
t -

forceArg

public java.lang.Object forceArg(Token t)
Specified by:
forceArg in interface Future

forceCall

public Callable forceCall(Token t)
                   throws UncallableValueException
Specified by:
forceCall in interface Future
Throws:
UncallableValueException

close

public void close()

setRegion

public void setRegion(Region region)

getTransaction

public Transaction getTransaction()

setTransaction

public void setTransaction(Transaction trans)

peekValue

public java.lang.Object peekValue()

isBound

public boolean isBound()

toString

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