com.yahoo.ycsb
Class IntegerGenerator

java.lang.Object
  extended by com.yahoo.ycsb.Generator
      extended by com.yahoo.ycsb.IntegerGenerator
Direct Known Subclasses:
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  int nextInt()
          Return the next value as an int.
 java.lang.String nextString()
          Generate the next string in the distribution.
 void setLastInt(int last)
          Set the last value generated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegerGenerator

public IntegerGenerator()
Method Detail

setLastInt

public void setLastInt(int last)
Set the last value generated. IntegerGenerator subclasses must use this call to properly set the last string value, or the lastString() and lastInt() calls won't work.


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).