org.databene.benerator.wrapper
Class MultiGeneratorWrapper<S,P>

java.lang.Object
  extended by org.databene.benerator.util.AbstractGenerator<P>
      extended by org.databene.benerator.wrapper.MultiGeneratorWrapper<S,P>
All Implemented Interfaces:
java.io.Closeable, Generator<P>, org.databene.commons.Resettable, org.databene.commons.ThreadAware
Direct Known Subclasses:
AlternativeGenerator, SimpleCompositeArrayGenerator, UniqueCompositeArrayGenerator, UniqueStringGenerator

public abstract class MultiGeneratorWrapper<S,P>
extends AbstractGenerator<P>

Parent class for wrapping several other generators (in a sources property) and refining a composite state from them.

Created: 19.12.2006 07:05:29

Since:
0.1
Author:
Volker Bergmann

Field Summary
protected  java.util.List<Generator<? extends S>> availableSources
           
protected  Generator<? extends S>[] sources
           
 
Fields inherited from class org.databene.benerator.util.AbstractGenerator
context, state
 
Constructor Summary
MultiGeneratorWrapper(Generator<? extends S>... sources)
           
 
Method Summary
 void addSource(Generator<S> source)
           
 void close()
          Closes the generator.
protected  S[] generateFromAllSources(java.lang.Class<S> componentType)
           
protected  S generateFromRandomSource()
           
 Generator<? extends S> getSource(int index)
           
 Generator<? extends S>[] getSources()
           
 void init(GeneratorContext context)
           
 boolean isParallelizable()
           
 boolean isThreadSafe()
           
 void reset()
           
 void setSources(Generator<? extends S>... sources)
           
 java.lang.String toString()
           
 
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
 
Methods inherited from interface org.databene.benerator.Generator
generate, getGeneratedType
 

Field Detail

sources

protected Generator<? extends S>[] sources

availableSources

protected java.util.List<Generator<? extends S>> availableSources
Constructor Detail

MultiGeneratorWrapper

public MultiGeneratorWrapper(Generator<? extends S>... sources)
Method Detail

getSources

public Generator<? extends S>[] getSources()

setSources

public void setSources(Generator<? extends S>... sources)

getSource

public Generator<? extends S> getSource(int index)

addSource

public void addSource(Generator<S> source)

init

public void init(GeneratorContext context)
Specified by:
init in interface Generator<P>
Overrides:
init in class AbstractGenerator<P>

reset

public void reset()
Specified by:
reset in interface org.databene.commons.Resettable
Overrides:
reset in class AbstractGenerator<P>

close

public void close()
Description copied from interface: Generator
Closes the generator. After invocation the state is unavailable.

Specified by:
close in interface java.io.Closeable
Specified by:
close in interface Generator<P>
Overrides:
close in class AbstractGenerator<P>

isThreadSafe

public boolean isThreadSafe()

isParallelizable

public boolean isParallelizable()

generateFromRandomSource

protected S generateFromRandomSource()

generateFromAllSources

protected S[] generateFromAllSources(java.lang.Class<S> componentType)

toString

public java.lang.String toString()
Overrides:
toString in class AbstractGenerator<P>


Copyright © 2011. All Rights Reserved.