org.databene.benerator.sample
Class StateTransitionGenerator<E>

java.lang.Object
  extended by org.databene.benerator.util.AbstractGenerator<P>
      extended by org.databene.benerator.wrapper.GeneratorWrapper<E,org.databene.script.Transition>
          extended by org.databene.benerator.sample.StateTransitionGenerator<E>
All Implemented Interfaces:
java.io.Closeable, Generator<org.databene.script.Transition>, org.databene.commons.Resettable, org.databene.commons.ThreadAware

public class StateTransitionGenerator<E>
extends GeneratorWrapper<E,org.databene.script.Transition>

Generates state transitions of a state machine.

Created at 17.07.2009 08:04:12

Since:
0.6.0
Author:
Volker Bergmann

Field Summary
 
Fields inherited from class org.databene.benerator.util.AbstractGenerator
context, logger, state
 
Constructor Summary
StateTransitionGenerator(java.lang.Class<E> stateType)
           
StateTransitionGenerator(java.lang.Class<E> stateType, java.lang.String transitionSpec)
           
 
Method Summary
 void addTransition(E from, E to, double weight)
           
 void close()
          Closes the generator.
 ProductWrapper<org.databene.script.Transition> generate(ProductWrapper<org.databene.script.Transition> wrapper)
          Returns an instance of the generic type E, using the ProductWrapper instance provided as argument.
 java.lang.Class<org.databene.script.Transition> getGeneratedType()
          Declares the type of the objects returned by the generate() method.
 void reset()
           
 
Methods inherited from class org.databene.benerator.wrapper.GeneratorWrapper
equals, generateFromSource, getSource, getSourceWrapper, hashCode, init, isParallelizable, isThreadSafe, setSource, toString
 
Methods inherited from class org.databene.benerator.util.AbstractGenerator
assertInitialized, assertNotInitialized, getResultWrapper, wasInitialized
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StateTransitionGenerator

public StateTransitionGenerator(java.lang.Class<E> stateType)

StateTransitionGenerator

public StateTransitionGenerator(java.lang.Class<E> stateType,
                                java.lang.String transitionSpec)
Method Detail

addTransition

public void addTransition(E from,
                          E to,
                          double weight)

getGeneratedType

public java.lang.Class<org.databene.script.Transition> getGeneratedType()
Description copied from interface: Generator
Declares the type of the objects returned by the generate() method.


generate

public ProductWrapper<org.databene.script.Transition> generate(ProductWrapper<org.databene.script.Transition> wrapper)
Description copied from interface: Generator
Returns an instance of the generic type E, using the 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.


reset

public void reset()
Specified by:
reset in interface org.databene.commons.Resettable
Overrides:
reset in class GeneratorWrapper<E,org.databene.script.Transition>

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<org.databene.script.Transition>
Overrides:
close in class GeneratorWrapper<E,org.databene.script.Transition>


Copyright © 2013. All Rights Reserved.