State

open class State<ID, V : Value<ID, V, S>, S : State<ID, V, S>>(transitionsFn: () -> Set<S>, invariants: List<Invariant<ID, V, S>> = emptyList())

Constructors

Link copied to clipboard
constructor(transitionsFn: () -> Set<S>, invariants: List<Invariant<ID, V, S>> = emptyList())

Properties

Link copied to clipboard

all states that are reachable from this state

Link copied to clipboard

all states that can be transitioned to directly from this state

Functions

Link copied to clipboard

Whether this state can transition to the given other state.

Link copied to clipboard

Whether this state could directly or indirectly transition to the given state.

Link copied to clipboard
fun shortestPathTo(to: S): List<S>

Finds the shortest path to a given state using a naive recursive algorithm.

Link copied to clipboard
fun validate(value: V): Result<V>

Ensure that the provided value meets all the declared invariants for this state.