Package net.jqwik.api.state
Interface Chain<T extends @Nullable Object>
- Type Parameters:
T
- The type of state to be transformed in a chain
- All Superinterfaces:
Iterable<T>
@API(status=EXPERIMENTAL,
since="1.7.0")
public interface Chain<T extends @Nullable Object>
extends Iterable<T>
A chain represents a series of states of type
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).
- See Also:
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptioniterator()
int
The maximum number of transformations that a chain can go through.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 extends @Nullable Object>
ChainArbitrary<T>Create arbitrary for chains with a certain initial state.Return list of all applied transformations as far as iterators have been used.List<Transformer<T>>
Return list of all used transformer instances.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
startWith
static <T extends @Nullable Object> ChainArbitrary<T> startWith(Supplier<? extends T> initialSupplier) Create arbitrary for chains with a certain initial state.- Type Parameters:
T
- The type of state to be transformed through the chain.- Parameters:
initialSupplier
- function to create the initial state object- Returns:
- new arbitrary instance
-
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.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.
- Returns:
- an iterator through all states
-
iterator
-
transformations
Return list of all applied transformations as far as iterators have been used.For a chain that has not been iterated through this list is empty.
- Returns:
- list of describing strings
-
transformers
Return list of all used transformer instances.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.
- Returns:
- list of transformer instances
-
maxTransformations
int maxTransformations()The maximum number of transformations that a chain can go through.- Returns:
- a number >= 1
-