org.progeeks.tool.gen
Class SeriesGenerator
java.lang.Object
org.progeeks.tool.gen.BaseDataGenerator
org.progeeks.tool.gen.NumberGenerator
org.progeeks.tool.gen.SeriesGenerator
- All Implemented Interfaces:
- DataGenerator
public class SeriesGenerator
- extends NumberGenerator
Generates a series of numbers, starting with min and incrementing by
increment if it is set, or 1.0 if no increment is set. If max
is set, if the next number to be returned is >= max, then the counter will loop
back around to min. If increment is negative, the counter will move from
max to min.
- Version:
- $Revision: 1.2 $
- Author:
- esword
|
Field Summary |
protected static Log |
log
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
log
protected static final Log log
SeriesGenerator
public SeriesGenerator()
init
protected boolean init()
- Description copied from class:
NumberGenerator
- Returns true if init has already been called. False if this was the first time to call it.
Useful for any sub-classes that call this so they can tell if they need to do any of their
initialization stuff.
- Overrides:
init in class NumberGenerator
generateRealData
protected java.lang.Object generateRealData(DataGeneratorContext context)
- Description copied from class:
NumberGenerator
- Return a random number in the proper range. If either min or max is not specified, the
min and max value for
dataClass are used.
- Overrides:
generateRealData in class NumberGenerator
- Returns:
- The returned object will be of the same type as
dataClass
testData
protected boolean testData(java.lang.Object testItem,
DataGeneratorContext context)
- Checks that the item is within the specified range and that it could be hit with the set
increment amount. This is actually pretty hard to do accurately for decimals. Thus, we just
make sure the testItem is very close.
- Overrides:
testData in class NumberGenerator
getIncrement
public double getIncrement()
- Returns:
- Returns the increment.
setIncrement
public void setIncrement(double increment)
- Parameters:
increment - The increment to set.
Copyright © 2002-2003 Paul Speed. All Rights Reserved.