Package com.valhalla.sdk.tasks
Class TaskNode
java.lang.Object
com.valhalla.sdk.tasks.TaskNode
- All Implemented Interfaces:
Sleepable
One prioritized state in a
TaskScript.
On each script loop, nodes are considered from highest to lowest priority.
Only the first node whose accept(ScriptContext) returns true
executes during that loop.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanaccept(ScriptContext context) Tests whether this node currently owns the next unit of work.abstract longexecute(ScriptContext context) Performs one bounded unit of work.intpriority()Defines selection order among sibling nodes.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.valhalla.sdk.api.util.Sleepable
sleep, sleep, sleepUntil, sleepUntil, sleepUntil, sleepWhile, sleepWhile, sleepWhile
-
Constructor Details
-
TaskNode
public TaskNode()
-
-
Method Details
-
priority
public int priority()Defines selection order among sibling nodes.- Returns:
- priority value; larger values are considered first
-
accept
Tests whether this node currently owns the next unit of work.Keep this check fast and side-effect free because it may run every loop.
- Parameters:
context- current script context- Returns:
truewhenexecute(ScriptContext)should run now
-
execute
Performs one bounded unit of work.- Parameters:
context- current script context- Returns:
- requested delay before the next script loop; a negative value requests stop
-