net.java.quickcheck.generator.support
Class VetoableGenerator<T>

java.lang.Object
  extended by 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.


Field Summary
static int DEFAULT_MAX_TRIES
           
static int MIN_TRIES
           
 
Constructor Summary
VetoableGenerator(Generator<? extends T> generator)
           
VetoableGenerator(Generator<? extends T> generator, int maxTries)
           
 
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
 

Field Detail

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
Constructor Detail

VetoableGenerator

public VetoableGenerator(Generator<? extends T> generator)

VetoableGenerator

public VetoableGenerator(Generator<? extends T> generator,
                         int maxTries)
Method Detail

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.