net.java.quickcheck.generator.support
Class VetoableGenerator<T>
java.lang.Object
net.java.quickcheck.generator.support.VetoableGenerator<T>
- All Implemented Interfaces:
- Generator<T>
- Direct Known Subclasses:
- ExcludingGenerator, UniqueComparableValuesGenerator, UniqueValuesGenerator
public abstract class VetoableGenerator<T>
- extends Object
- implements Generator<T>
Base class for generators which can reject the values generated by their
wrapped generator. This will be tried until the maximum number of tries is
reached.
Method Summary |
T |
next()
Generates the next instance. |
protected abstract boolean |
tryValue(T value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_MAX_TRIES
public static final int DEFAULT_MAX_TRIES
- See Also:
- Constant Field Values
MIN_TRIES
public static final int MIN_TRIES
- See Also:
- Constant Field Values
VetoableGenerator
public VetoableGenerator(Generator<? extends T> generator)
VetoableGenerator
public VetoableGenerator(Generator<? extends T> generator,
int maxTries)
next
public T next()
throws GeneratorException
- Description copied from interface:
Generator
- Generates the next instance.
- Specified by:
next
in interface Generator<T>
- Returns:
- a newly created instance
- Throws:
GeneratorException
tryValue
protected abstract boolean tryValue(T value)
- Returns:
- true to accept the current value.
Copyright © 2011. All Rights Reserved.