net.jqwik.engine.properties.stateful.ActionSequenceGenerator Maven / Gradle / Ivy
package net.jqwik.engine.properties.stateful;
import java.util.*;
import net.jqwik.api.*;
import net.jqwik.api.stateful.*;
import org.jspecify.annotations.*;
class ActionSequenceGenerator implements RandomGenerator> {
private final int genSize;
private final int maxSize;
private final Arbitrary> actionArbitrary;
ActionSequenceGenerator(Arbitrary> actionArbitrary, int genSize, int maxSize) {
this.actionArbitrary = actionArbitrary;
this.genSize = genSize;
this.maxSize = maxSize;
}
@Override
public Shrinkable> next(Random random) {
ActionGenerator actionGenerator = new RandomActionGenerator<>(actionArbitrary, genSize, random);
return new ShrinkableActionSequence<>(actionGenerator, maxSize, ShrinkingDistance.of(maxSize));
}
}