T
- The type of state to be transformed in a chain@API(status=EXPERIMENTAL,
since="1.7.0")
public interface Chain<T>
extends java.lang.Iterable<T>
T
in which the previous state
is somehow transformed into the next state. Transformers are
used to transform a state into the next state.
The term chain is used in relation to mathematical concepts like Markov chains.
State instances can be mutable or immutable.
Chains can be generated through startWith(Supplier).
Transformer
Modifier and Type | Interface and Description |
---|---|
static class |
Chain.ChainFacade |
Modifier and Type | Method and Description |
---|---|
default java.util.Iterator<T> |
iterator() |
int |
maxTransformations()
The maximum number of transformations that a chain can go through.
|
java.util.Iterator<T> |
start()
The Iterator will iterate through elements representing states in order,
i.e. their number is one higher than the number of transformations applied to the initial state.
|
static <T> ChainArbitrary<T> |
startWith(java.util.function.Supplier<? extends T> initialSupplier)
Create arbitrary for chains with a certain initial state.
|
java.util.List<java.lang.String> |
transformations()
Return list of all applied transformations as far as iterators have been used.
|
java.util.List<Transformer<T>> |
transformers()
Return list of all used transformer instances.
|
static <T> ChainArbitrary<T> startWith(java.util.function.Supplier<? extends T> initialSupplier)
T
- The type of state to be transformed through the chain.initialSupplier
- function to create the initial state objectjava.util.Iterator<T> start()
Mind that the next state element can depend on both the previous state and (pseudo-)randomness. Several iterators must always produce the same "chain" of states. Each iterator will start with a new instance of the initial state.
default java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
java.util.List<java.lang.String> transformations()
For a chain that has not been iterated through this list is empty.
@API(status=EXPERIMENTAL, since="1.7.1") java.util.List<Transformer<T>> transformers()
Checking transformer instances - e.g. if they are of a certain implementation type - only makes sense if the transformer's description string is NOT set explicitly.
For a chain that has not been run this list is always empty.
int maxTransformations()