com.googlecode.sarasvati
Interface ArcToken

All Superinterfaces:
Token
All Known Implementing Classes:
HibArcToken, MemArcToken

public interface ArcToken
extends Token

Arc tokens point to arcs in the graph. Arc tokens may be active only briefly, if the node at the end of the arc is ready to execute. However, if the node is a join node, and not all incoming arcs have tokens, an arc token may be active for some time.

Author:
Paul Lorenz

Method Summary
 Arc getArc()
          Returns the arc that this arc token points to.
 NodeToken getChildToken()
          Returns the node token which was generated from this arc token.
 NodeToken getParentToken()
          Returns the node token which directly preceded this arc token.
 GraphProcess getProcess()
          Returns the process that this node token belongs to.
 Set<ArcTokenSetMember> getTokenSetMemberships()
          Returns the set members for each token set that this token is tied to.
 boolean isPending()
          Return true if this arc token requires processing, false otherwise.
 void markComplete(NodeToken child)
          Marks this token as being complete, in the sense that it no longer represents an active part of the process.
 void markProcessed()
          Marks this arc token as processed.
 
Methods inherited from interface com.googlecode.sarasvati.Token
accept, getExecutionType, isComplete, markBacktracked
 

Method Detail

getArc

Arc getArc()
Returns the arc that this arc token points to.

Returns:
The associated arc

getProcess

GraphProcess getProcess()
Returns the process that this node token belongs to.

Returns:
The associated process

getParentToken

NodeToken getParentToken()
Returns the node token which directly preceded this arc token.

Returns:
The parent NodeToken

getChildToken

NodeToken getChildToken()
Returns the node token which was generated from this arc token.

Returns:
The child NodeToken

isPending

boolean isPending()
Return true if this arc token requires processing, false otherwise. Multiple arc tokens will be created at once, in the case where a node has multiple outgoing arcs. When first created, this method will return true. After the arc token has been executed, this method will return false. An executed arc token may not yet be completed. It may be waiting for other node tokens to arrive at the target node.
Whether an ArcToken has been processed may be important in the case where an earlier arc token generates a NodeToken, which while executing a Node generates and exception and processing is halted. In this case, the unprocessed arc tokens can be found and processed.

Returns:
True if this arc token has not yet been processed.

markProcessed

void markProcessed()
Marks this arc token as processed.

See Also:
isPending()

markComplete

void markComplete(NodeToken child)
Marks this token as being complete, in the sense that it no longer represents an active part of the process. Once a token is marked complete, it is generally only of historical interest.

Parameters:
child - The node token generated from this arc token

getTokenSetMemberships

Set<ArcTokenSetMember> getTokenSetMemberships()
Returns the set members for each token set that this token is tied to.

Specified by:
getTokenSetMemberships in interface Token
Returns:
the set members for each token set that this token is tied to.