|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.databene.benerator.util.AbstractGenerator<E>
org.databene.benerator.util.ThreadSafeGenerator<E>
org.databene.benerator.sample.AbstractSampleGenerator<E>
org.databene.benerator.sample.SampleGenerator<E>
public class SampleGenerator<E>
Generates values from a non-weighted list of samples, applying an explicitly defined distribution.
Created: 07.06.2006 19:04:08
| Field Summary |
|---|
| Fields inherited from class org.databene.benerator.util.AbstractGenerator |
|---|
context, state |
| Constructor Summary | |
|---|---|
SampleGenerator()
|
|
SampleGenerator(java.lang.Class<E> generatedType)
Initializes the generator to an empty sample list |
|
SampleGenerator(java.lang.Class<E> generatedType,
Distribution distribution,
boolean unique,
java.lang.Iterable<E> values)
Initializes the generator to a sample list |
|
SampleGenerator(java.lang.Class<E> generatedType,
Distribution distribution,
E... values)
Initializes the generator to a sample list |
|
SampleGenerator(java.lang.Class<E> generatedType,
E... values)
Initializes the generator to a sample list |
|
SampleGenerator(java.lang.Class<E> generatedType,
java.lang.Iterable<E> values)
Initializes the generator to a sample list |
|
| Method Summary | ||
|---|---|---|
void |
addValue(E value)
Adds a value to the sample list |
|
void |
clear()
Removes all values from the sample list |
|
void |
close()
Closes the generator. |
|
E |
generate()
Returns an instance of the generic type E. |
|
static
|
generate(java.util.List<T> samples)
Convenience utility method that chooses one sample out of a list with uniform random distribution |
|
static
|
generate(T... samples)
Convenience utility method that chooses one sample out of a list with uniform random distribution |
|
void |
init(GeneratorContext context)
Initializes all attributes |
|
boolean |
isUnique()
|
|
void |
reset()
|
|
void |
setUnique(boolean unique)
|
|
java.lang.String |
toString()
|
|
| Methods inherited from class org.databene.benerator.sample.AbstractSampleGenerator |
|---|
addValues, addValues, getGeneratedType, setValues, setValues |
| Methods inherited from class org.databene.benerator.util.ThreadSafeGenerator |
|---|
isParallelizable, isThreadSafe |
| Methods inherited from class org.databene.benerator.util.AbstractGenerator |
|---|
assertInitialized, assertNotInitialized, wasInitialized |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SampleGenerator()
public SampleGenerator(java.lang.Class<E> generatedType)
public SampleGenerator(java.lang.Class<E> generatedType,
E... values)
public SampleGenerator(java.lang.Class<E> generatedType,
Distribution distribution,
E... values)
public SampleGenerator(java.lang.Class<E> generatedType,
java.lang.Iterable<E> values)
public SampleGenerator(java.lang.Class<E> generatedType,
Distribution distribution,
boolean unique,
java.lang.Iterable<E> values)
| Method Detail |
|---|
public void addValue(E value)
addValue in class AbstractSampleGenerator<E>public boolean isUnique()
public void setUnique(boolean unique)
public void clear()
AbstractSampleGenerator
clear in class AbstractSampleGenerator<E>public void init(GeneratorContext context)
init in interface Generator<E>init in class AbstractGenerator<E>public E generate()
Generator
public void reset()
reset in interface Resettablereset in class AbstractGenerator<E>public void close()
Generator
close in interface java.io.Closeableclose in interface Generator<E>close in class AbstractGenerator<E>public static <T> T generate(T... samples)
public static <T> T generate(java.util.List<T> samples)
public java.lang.String toString()
toString in class AbstractGenerator<E>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||