org.databene.benerator.primitive
Class HiLoGenerator
java.lang.Object
org.databene.benerator.util.AbstractGenerator<E>
org.databene.benerator.util.AbstractNonNullGenerator<java.lang.Long>
org.databene.benerator.primitive.HiLoGenerator
- All Implemented Interfaces:
- java.io.Closeable, Generator<java.lang.Long>, NonNullGenerator<java.lang.Long>, org.databene.commons.Resettable, org.databene.commons.ThreadAware
- Direct Known Subclasses:
- DBSeqHiLoGenerator, QueryHiLoGenerator
public class HiLoGenerator
- extends AbstractNonNullGenerator<java.lang.Long>
Combines the output of a 'slow' generator (e.g. a remote hiGenerator)
with quickly generated numbers in a range: value = hi * maxLo + local.
- Since:
- 0.3.04
- Author:
- Volker Bergmann
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
DEFAULT_MAX_LO
protected static final int DEFAULT_MAX_LO
- See Also:
- Constant Field Values
maxLo
protected int maxLo
hiGenerator
protected NonNullGenerator<java.lang.Long> hiGenerator
HiLoGenerator
public HiLoGenerator()
HiLoGenerator
public HiLoGenerator(int maxLo)
HiLoGenerator
public HiLoGenerator(NonNullGenerator<java.lang.Long> hiGenerator,
int maxLo)
setHiGenerator
public void setHiGenerator(NonNullGenerator<java.lang.Long> hiGenerator)
getMaxLo
public int getMaxLo()
- Returns:
- the maxLo
setMaxLo
public void setMaxLo(int maxLo)
- Parameters:
maxLo
- the maxLo to set
getGeneratedType
public java.lang.Class<java.lang.Long> getGeneratedType()
- Description copied from interface:
Generator
- Declares the type of the objects returned by the generate() method.
init
public void init(GeneratorContext context)
- Specified by:
init
in interface Generator<java.lang.Long>
- Overrides:
init
in class AbstractGenerator<java.lang.Long>
generate
public java.lang.Long generate()
- Specified by:
generate
in interface NonNullGenerator<java.lang.Long>
- Specified by:
generate
in class AbstractNonNullGenerator<java.lang.Long>
reset
public void reset()
- Specified by:
reset
in interface org.databene.commons.Resettable
- Overrides:
reset
in class AbstractGenerator<java.lang.Long>
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<java.lang.Long>
- Overrides:
close
in class AbstractGenerator<java.lang.Long>
isThreadSafe
public boolean isThreadSafe()
isParallelizable
public boolean isParallelizable()
toString
public java.lang.String toString()
- Overrides:
toString
in class AbstractGenerator<java.lang.Long>
Copyright © 2013. All Rights Reserved.