org.databene.benerator.factory
Class StochasticGeneratorFactory

java.lang.Object
  extended by org.databene.benerator.factory.GeneratorFactory
      extended by org.databene.benerator.factory.StochasticGeneratorFactory

public class StochasticGeneratorFactory
extends GeneratorFactory

GeneratorFactory implementation that generates docile data in order to avoid functional failures and combines them randomly and repetitively for generating large data volumes. Its primary purpose is data generation for performance tests.

Created: 04.07.2011 09:34:34

Since:
0.7.0
Author:
Volker Bergmann

Field Summary
 
Fields inherited from class org.databene.benerator.factory.GeneratorFactory
defaultsProvider
 
Constructor Summary
StochasticGeneratorFactory()
           
 
Method Summary
 Generator<?> applyNullSettings(Generator<?> source, java.lang.Boolean nullable, java.lang.Double nullQuota)
           
<T> Generator<T>
createAlternativeGenerator(java.lang.Class<T> targetType, Generator<T>[] sources, Uniqueness uniqueness)
           
 Generator<java.lang.Boolean> createBooleanGenerator(java.lang.Double trueQuota)
          Creates a generator for boolean values with a trueQuota [0-1]
<T> Generator<T[]>
createCompositeArrayGenerator(java.lang.Class<T> componentType, Generator<T>[] sources, Uniqueness uniqueness)
          Creates a generator that reads products of an array of generators and combines them in an array.
 NonNullGenerator<java.lang.String> createCompositeStringGenerator(GeneratorProvider<?> partGeneratorProvider, int minParts, int maxParts, Uniqueness uniqueness)
           
<T> Generator<T>
createFromWeightedLiteralList(java.lang.String valueSpec, java.lang.Class<T> targetType, Distribution distribution, boolean unique)
           
<T> Generator<T>
createNullGenerator(java.lang.Class<T> generatedType)
           
<T> Generator<T>
createSampleGenerator(java.util.Collection<T> values, java.lang.Class<T> generatedType, boolean unique)
           
<T> Generator<T>
createSingleValueGenerator(T value, boolean unique)
          Creates a generator that returns a single value.
 NonNullGenerator<java.lang.String> createStringGenerator(java.util.Set<java.lang.Character> chars, java.lang.Integer minLength, java.lang.Integer maxLength, int lengthGranularity, Distribution lengthDistribution, Uniqueness uniqueness)
           
 Distribution defaultDistribution(Uniqueness uniqueness)
           
protected  Distribution defaultLengthDistribution(Uniqueness uniqueness, boolean required)
           
protected  double defaultTrueQuota()
           
protected  boolean defaultUnique()
           
 
Methods inherited from class org.databene.benerator.factory.GeneratorFactory
createCharacterGenerator, createCharacterGenerator, createDateGenerator, createNumberGenerator, createRegexStringGenerator, createStringGenerator, createWeightedSampleGenerator, defaultSubSet, getDefaultsProvider, setDefaultsProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StochasticGeneratorFactory

public StochasticGeneratorFactory()
Method Detail

createAlternativeGenerator

public <T> Generator<T> createAlternativeGenerator(java.lang.Class<T> targetType,
                                                   Generator<T>[] sources,
                                                   Uniqueness uniqueness)
Specified by:
createAlternativeGenerator in class GeneratorFactory

createCompositeArrayGenerator

public <T> Generator<T[]> createCompositeArrayGenerator(java.lang.Class<T> componentType,
                                                        Generator<T>[] sources,
                                                        Uniqueness uniqueness)
Description copied from class: GeneratorFactory
Creates a generator that reads products of an array of generators and combines them in an array.

Specified by:
createCompositeArrayGenerator in class GeneratorFactory
sources - the source generators
Returns:
a generator of the desired characteristics

createSampleGenerator

public <T> Generator<T> createSampleGenerator(java.util.Collection<T> values,
                                              java.lang.Class<T> generatedType,
                                              boolean unique)
Specified by:
createSampleGenerator in class GeneratorFactory

createFromWeightedLiteralList

public <T> Generator<T> createFromWeightedLiteralList(java.lang.String valueSpec,
                                                      java.lang.Class<T> targetType,
                                                      Distribution distribution,
                                                      boolean unique)
Specified by:
createFromWeightedLiteralList in class GeneratorFactory

createBooleanGenerator

public Generator<java.lang.Boolean> createBooleanGenerator(java.lang.Double trueQuota)
Description copied from class: GeneratorFactory
Creates a generator for boolean values with a trueQuota [0-1]

Overrides:
createBooleanGenerator in class GeneratorFactory
Parameters:
trueQuota - a value from 0 to 1, indicating the quota of true values to generate among the non-null values
Returns:
a Boolean generator of the desired characteristics

createStringGenerator

public NonNullGenerator<java.lang.String> createStringGenerator(java.util.Set<java.lang.Character> chars,
                                                                java.lang.Integer minLength,
                                                                java.lang.Integer maxLength,
                                                                int lengthGranularity,
                                                                Distribution lengthDistribution,
                                                                Uniqueness uniqueness)
Specified by:
createStringGenerator in class GeneratorFactory

applyNullSettings

public Generator<?> applyNullSettings(Generator<?> source,
                                      java.lang.Boolean nullable,
                                      java.lang.Double nullQuota)
Specified by:
applyNullSettings in class GeneratorFactory

createSingleValueGenerator

public <T> Generator<T> createSingleValueGenerator(T value,
                                                   boolean unique)
Description copied from class: GeneratorFactory
Creates a generator that returns a single value.

Specified by:
createSingleValueGenerator in class GeneratorFactory
Parameters:
value - the value to return
Returns:
a generator that returns a constant value.

defaultTrueQuota

protected double defaultTrueQuota()
Specified by:
defaultTrueQuota in class GeneratorFactory

defaultLengthDistribution

protected Distribution defaultLengthDistribution(Uniqueness uniqueness,
                                                 boolean required)
Specified by:
defaultLengthDistribution in class GeneratorFactory

defaultDistribution

public Distribution defaultDistribution(Uniqueness uniqueness)
Specified by:
defaultDistribution in class GeneratorFactory

defaultUnique

protected boolean defaultUnique()
Specified by:
defaultUnique in class GeneratorFactory

createNullGenerator

public <T> Generator<T> createNullGenerator(java.lang.Class<T> generatedType)
Specified by:
createNullGenerator in class GeneratorFactory

createCompositeStringGenerator

public NonNullGenerator<java.lang.String> createCompositeStringGenerator(GeneratorProvider<?> partGeneratorProvider,
                                                                         int minParts,
                                                                         int maxParts,
                                                                         Uniqueness uniqueness)
Specified by:
createCompositeStringGenerator in class GeneratorFactory


Copyright © 2013. All Rights Reserved.