|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.googlecode.sarasvati.CustomNode
public abstract class CustomNode
CustomNode provides a superclass for user defined nodes that are portable across all engines.
Constructor Summary | |
---|---|
CustomNode()
|
Method Summary | ||
---|---|---|
void |
backtrack(Engine engine,
NodeToken token)
Does nothing by default. |
|
|
getAdaptor(Class<T> clazz)
Default implementation calls CustomNodeWrapper.getDefaultAdaptor(Class) . |
|
External |
getExternal()
If the node is defined in an external, returns the external and null otherwise. |
|
ReadEnv |
getExternalEnv()
Returns a read-only environment containing all attributes defined for all associated externals. |
|
Graph |
getGraph()
Returns the graph that this node belongs to. |
|
String |
getGuard()
Every node may have a guard associated with it. |
|
Long |
getId()
Returns the node's unique id. |
|
String |
getJoinParam()
Each node may specify a parameter to be used by the join strategy. |
|
JoinStrategy |
getJoinStrategy(Arc arc)
Returns the JoinStrategy to be used when an
ArcToken arrives at this Node. |
|
JoinType |
getJoinType()
Returns the JoinType of the node. |
|
String |
getName()
Returns the node name. |
|
Node |
getNodeWrapper()
|
|
Node |
getOriginatingExternalNode()
If a node is defined in an external, this will return the node as defined in the external graph. |
|
String |
getType()
Every node has a type. |
|
GuardResult |
guard(Engine engine,
NodeToken token)
Default implementation calls CustomNodeWrapper.defaultGuard(Engine, NodeToken) . |
|
boolean |
isBacktrackable(Engine engine,
NodeToken token)
Returns true by default. |
|
boolean |
isImportedFromExternal()
Returns true if this node was imported from an external process definition, false otherwise. |
|
boolean |
isStart()
Returns true if this node is a start node. |
|
void |
setNodeWrapper(CustomNodeWrapper nodeWrapper)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.googlecode.sarasvati.Node |
---|
execute |
Constructor Detail |
---|
public CustomNode()
Method Detail |
---|
public void setNodeWrapper(CustomNodeWrapper nodeWrapper)
public Node getNodeWrapper()
public final Graph getGraph()
Node
getGraph
in interface Node
public final String getGuard()
Node
getGuard
in interface Node
public final Long getId()
Node
getId
in interface Node
public final String getName()
Node
getName
in interface Node
public final String getType()
Node
getType
in interface Node
public final boolean isImportedFromExternal()
Node
isImportedFromExternal
in interface Node
public final JoinType getJoinType()
Node
JoinType
of the node.
getJoinType
in interface Node
JoinType
of the node.public final String getJoinParam()
Node
May be null.
getJoinParam
in interface Node
public JoinStrategy getJoinStrategy(Arc arc)
Node
JoinStrategy
to be used when an
ArcToken
arrives at this Node.
getJoinStrategy
in interface Node
arc
- The arc of the incoming arc token. Allows
different join strategies for different
arcs.
JoinStrategy
to be used when an
ArcToken
arrives at this Node.public final boolean isStart()
Node
isStart
in interface Node
public final External getExternal()
Node
getExternal
in interface Node
public final ReadEnv getExternalEnv()
Node
Node.getOriginatingExternalNode()
for examples usage.
getExternalEnv
in interface Node
public Node getOriginatingExternalNode()
Node
Note: If the originating node is the original node, it will not have an external associated with it. Since this method exists to allow access to multiple levels of external, this method may return null instead of the original node.
For example, given the following three graphs, where graph II uses graph I and graph III uses graph II, you could look up different values defined in the externals.
bar world If you get node A from graph III, you can observe the following: Node nodeA = ...; nodeA.getExternalEnv().getAttribute( "foo" ) // returns "baz" nodeA.getExternalEnv().getAttribute( "hello" ) // returns "world" nodeA.getExternal().getEnv().getAttribute( "foo" ) // returns "baz" nodeA.getExternal().getEnv().getAttribute( "hello" ) // returns null nodeA.getOriginatingExternalNode().getExternal().getEnv().getAttribute( "foo" ) // returns "bar" nodeA.getOriginatingExternalNode().getExternal().getEnv().getAttribute( "hello" ) // returns "world" baz
getOriginatingExternalNode
in interface Node
public void backtrack(Engine engine, NodeToken token)
IMPORTANT NOTE: Do not call Node.backtrack(Engine,NodeToken)
as that
will just call your isBacktrackable method again, resulting in an recursive call,
which will exit when your VM runs out of stack space.
backtrack
in interface Node
engine
- The engine doing the backtrackingtoken
- The specific token being backtracked.Node.backtrack(Engine, NodeToken)
public boolean isBacktrackable(Engine engine, NodeToken token)
IMPORTANT NOTE: Do not call Node.isBacktrackable(Engine, NodeToken)
as that
will just call your isBacktrackable method again, resulting in an recursive call,
which will exit when your VM runs out of stack space.
isBacktrackable
in interface Node
engine
- The engine doing the backtrackingtoken
- The token being backtracked
Node.isBacktrackable(Engine,NodeToken)
public <T> T getAdaptor(Class<T> clazz)
CustomNodeWrapper.getDefaultAdaptor(Class)
.
May be overridden by subclasses.
IMPORTANT NOTE: Do not call Adaptable.getAdaptor(Class)
as that
will just call your getAdapter method again, resulting in an recursive call,
which will exit when your VM runs out of stack space.
getAdaptor
in interface Adaptable
clazz
- The type of adaptor requested
Adaptable.getAdaptor(Class)
public GuardResult guard(Engine engine, NodeToken token)
CustomNodeWrapper.defaultGuard(Engine, NodeToken)
.
May be overridden by subclasses.
IMPORTANT NOTE: Do not call Node.guard(Engine, NodeToken)
as that
will just call your guard method again, resulting in an recursive call,
which will exit when your VM runs out of stack space.
guard
in interface Node
engine
- The engine being used to execute the processtoken
- The node token which is currently entering a node
Node.guard(Engine, NodeToken)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |