edu.usc.bg.base.generator
Class IntegerGenerator

java.lang.Object
  extended by edu.usc.bg.base.generator.Generator
      extended by edu.usc.bg.base.generator.IntegerGenerator
Direct Known Subclasses:
ConstantIntegerGenerator, CounterGenerator, ScrambledZipfianGenerator, SkewedLatestGenerator, UniformIntegerGenerator, ZipfianGenerator

public abstract class IntegerGenerator
extends Generator

A generator that is capable of generating ints as well as strings

Author:
cooperb

Constructor Summary
IntegerGenerator()
           
 
Method Summary
 int lastInt()
          Return the previous int generated by the distribution.
 java.lang.String lastString()
          Return the previous string generated by the distribution; e.g., returned from the last nextString() call.
abstract  double mean()
          Return the expected value (mean) of the values this generator will return.
abstract  int nextInt()
          Return the next value as an int.
 java.lang.String nextString()
          Generate the next string in the distribution.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegerGenerator

public IntegerGenerator()
Method Detail

nextInt

public abstract int nextInt()
Return the next value as an int. When overriding this method, be sure to call setLastString() properly, or the lastString() call won't work.


nextString

public java.lang.String nextString()
Generate the next string in the distribution.

Specified by:
nextString in class Generator

lastString

public java.lang.String lastString()
Return the previous string generated by the distribution; e.g., returned from the last nextString() call. Calling lastString() should not advance the distribution or have any side effects. If nextString() has not yet been called, lastString() should return something reasonable.

Specified by:
lastString in class Generator

lastInt

public int lastInt()
Return the previous int generated by the distribution. This call is unique to IntegerGenerator subclasses, and assumes IntegerGenerator subclasses always return ints for nextInt() (e.g. not arbitrary strings).


mean

public abstract double mean()
Return the expected value (mean) of the values this generator will return.