net.jqwik.engine.properties.shrinking.LazyOfShrinkable Maven / Gradle / Ivy
package net.jqwik.engine.properties.shrinking;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
import net.jqwik.api.*;
import org.jspecify.annotations.*;
public class LazyOfShrinkable implements Shrinkable {
public final Shrinkable current;
public final int depth;
public final Set> parts;
private final Function, Stream>> shrinker;
public LazyOfShrinkable(
Shrinkable current,
int depth,
Set> parts,
Function, Stream>> shrinker
) {
this.current = current;
this.depth = depth;
this.parts = parts;
this.shrinker = shrinker;
}
@Override
public T value() {
return current.value();
}
@Override
public Stream> shrink() {
return shrinker.apply(this);
}
@Override
public ShrinkingDistance distance() {
return ShrinkingDistance.of(depth).append(current.distance());
}
}