|
||||||||||
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.AttachedWeightSampleGenerator<E>
public class AttachedWeightSampleGenerator<E>
Generates values from a weighted or non-weighted set of samples.
Created: 07.06.2006 19:04:08
Field Summary |
---|
Fields inherited from class org.databene.benerator.util.AbstractGenerator |
---|
context, logger, state |
Constructor Summary | |
---|---|
AttachedWeightSampleGenerator(java.lang.Class<E> generatedType)
Initializes the generator to an empty sample list |
|
AttachedWeightSampleGenerator(java.lang.Class<E> generatedType,
E... values)
Initializes the generator to an unweighted sample list |
|
AttachedWeightSampleGenerator(java.lang.Class<E> generatedType,
java.lang.Iterable<E> values)
Initializes the generator to an unweighted sample list |
Method Summary | ||
---|---|---|
|
addSample(T value,
double weight)
Adds weighted values to the sample list |
|
void |
addSample(org.databene.script.WeightedSample<? extends E> sample)
Adds a weighted value to the sample list |
|
|
addValue(T value)
Adds an unweighted value to the sample list |
|
void |
clear()
Removes all values from the sample list |
|
boolean |
containsSample(E searchedValue)
|
|
ProductWrapper<E> |
generate(ProductWrapper<E> wrapper)
Returns an instance of the generic type E, using the ProductWrapper
instance provided as argument. |
|
java.lang.Class<E> |
getGeneratedType()
Declares the type of the objects returned by the generate() method. |
|
java.util.List<org.databene.script.WeightedSample<? extends E>> |
getSamples()
returns the sample list |
|
long |
getVariety()
|
|
double |
getWeight()
|
|
void |
init(GeneratorContext context)
Initializes all attributes |
|
void |
setSamples(java.util.Collection<org.databene.script.WeightedSample<E>> samples)
Adds weighted values to the sample list |
|
void |
setSamples(org.databene.script.WeightedSample<? extends E>... samples)
Sets the sample list to the specified weighted values |
|
java.lang.String |
toString()
|
Methods inherited from class org.databene.benerator.sample.AbstractSampleGenerator |
---|
addValues, addValues, setValues, setValues |
Methods inherited from class org.databene.benerator.util.ThreadSafeGenerator |
---|
isParallelizable, isThreadSafe |
Methods inherited from class org.databene.benerator.util.AbstractGenerator |
---|
assertInitialized, assertNotInitialized, close, getResultWrapper, reset, wasInitialized |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.databene.benerator.Generator |
---|
close, wasInitialized |
Methods inherited from interface org.databene.commons.ThreadAware |
---|
isParallelizable, isThreadSafe |
Methods inherited from interface org.databene.commons.Resettable |
---|
reset |
Constructor Detail |
---|
public AttachedWeightSampleGenerator(java.lang.Class<E> generatedType)
public AttachedWeightSampleGenerator(java.lang.Class<E> generatedType, E... values)
public AttachedWeightSampleGenerator(java.lang.Class<E> generatedType, java.lang.Iterable<E> values)
Method Detail |
---|
public java.util.List<org.databene.script.WeightedSample<? extends E>> getSamples()
public void setSamples(org.databene.script.WeightedSample<? extends E>... samples)
public void setSamples(java.util.Collection<org.databene.script.WeightedSample<E>> samples)
public <T extends E> void addSample(T value, double weight)
public void addSample(org.databene.script.WeightedSample<? extends E> sample)
public <T extends E> void addValue(T value)
addValue
in class AbstractSampleGenerator<E>
public void clear()
AbstractSampleGenerator
clear
in class AbstractSampleGenerator<E>
public java.lang.Class<E> getGeneratedType()
Generator
getGeneratedType
in interface Generator<E>
getGeneratedType
in class AbstractSampleGenerator<E>
public void init(GeneratorContext context)
init
in interface Generator<E>
init
in class AbstractGenerator<E>
public ProductWrapper<E> generate(ProductWrapper<E> wrapper)
Generator
ProductWrapper
instance provided as argument.
The wrapper may wrap a null value as a regular generator product.
If the generator is not available (any more), it returns null instead of
the ProductWrapper instance.
generate
in interface Generator<E>
public double getWeight()
getWeight
in interface org.databene.commons.Weighted
public long getVariety()
getVariety
in class AbstractSampleGenerator<E>
public boolean containsSample(E searchedValue)
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 |