S
- Superscript typeT
- Annotation typepublic abstract class AbstractPersistedTree<S,T> extends AbstractProtelisAST<T>
Modifier | Constructor and Description |
---|---|
protected |
AbstractPersistedTree(Metadata metadata,
java.util.List<ProtelisAST<?>> branches) |
protected |
AbstractPersistedTree(Metadata metadata,
ProtelisAST<?>... branches) |
Modifier and Type | Method and Description |
---|---|
protected S |
loadState(ExecutionContext context,
java.util.function.Supplier<S> ifAbsent)
Retrieves the function state from last round, or produces a new state otherwise.
|
protected void |
saveState(ExecutionContext context,
S obj)
Stores the function state for the next round.
|
java.lang.String |
toString() |
branchesToString, branchesToString, eval, evaluate, forEach, forEachWithIndex, getBranch, getBranches, getBranchesNumber, getMetadata, getName, isNullable, stringFor
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBytecode
protected AbstractPersistedTree(Metadata metadata, ProtelisAST<?>... branches)
metadata
- A Metadata
object containing information about the code that generated this AST node.branches
- branches of this AbstractPersistedTree
protected AbstractPersistedTree(Metadata metadata, java.util.List<ProtelisAST<?>> branches)
metadata
- A Metadata
object containing information about the code that generated this AST node.branches
- branches of this AbstractPersistedTree
protected final S loadState(ExecutionContext context, java.util.function.Supplier<S> ifAbsent)
context
- the ExecutionContext
ifAbsent
- a 0-ary function producing the value if none is storedprotected final void saveState(ExecutionContext context, S obj)
context
- the ExecutionContext
obj
- the statepublic java.lang.String toString()
toString
in class AbstractProtelisAST<T>