public class Loop
extends java.lang.Object
The resulting graph structure looks like this. "base" is the base case, provided by the user "cond" is the condition (one instance per iteration), provided by the user "iterate" is the iteration step, provided by the user "V" is the output of the loop "L" indicates if it's still looping. This is used to detect the error case in which the loop was too short to complete.
cond true base \ | | \ AND | iterate |\ | /| | \ | / | cond | IF | \ | |\ | AND | iterate |\ | /| | \ | / | cond | IF | \ | |\ | AND | iterate |\ | / | \ | / | IF | | L V
Modifier and Type | Field and Description |
---|---|
static VertexLabel |
CONDITION_LABEL |
static int |
DEFAULT_MAX_COUNT |
static VertexLabel |
STILL_LOOPING_LABEL |
static VertexLabel |
VALUE_IN_LABEL |
static VertexLabel |
VALUE_OUT_LABEL |
Modifier and Type | Method and Description |
---|---|
<V extends Vertex<?,?>> |
getOutput() |
Sequence |
getSequence() |
static LoopBuilder |
withInitialConditions(VertexDictionary initialState)
A factory method for creating a loop
|
static <V extends Vertex<?,?>> |
withInitialConditions(V first,
V... others)
A factory method for creating a loop
|
public static final VertexLabel VALUE_OUT_LABEL
public static final VertexLabel CONDITION_LABEL
public static final VertexLabel VALUE_IN_LABEL
public static final VertexLabel STILL_LOOPING_LABEL
public static final int DEFAULT_MAX_COUNT
public Sequence getSequence()
public static <V extends Vertex<?,?>> LoopBuilder withInitialConditions(V first, V... others)
V
- the input typefirst
- the first Vertex (mandatory)others
- other Vertices (optional)public static LoopBuilder withInitialConditions(VertexDictionary initialState)
initialState
- the collection of vertices that define the loop's base casepublic <V extends Vertex<?,?>> V getOutput() throws LoopDidNotTerminateException
V
- the output typeLoopDidNotTerminateException
- if the loop was too short and hit its maximum unrolled size