com.yahoo.ycsb
Class DiscreteGenerator

java.lang.Object
  extended by com.yahoo.ycsb.Generator
      extended by com.yahoo.ycsb.DiscreteGenerator

public class DiscreteGenerator
extends Generator

Generates a distribution by choosing from a discrete set of values.


Constructor Summary
DiscreteGenerator()
           
 
Method Summary
 void addValue(double weight, java.lang.String value)
           
 java.lang.String lastString()
          Return the previous string generated by the distribution; e.g., returned from the last nextString() call.
 int nextInt()
          If the generator returns numeric (integer) values, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscreteGenerator

public DiscreteGenerator()
Method Detail

nextString

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

Specified by:
nextString in class Generator

nextInt

public int nextInt()
            throws WorkloadException
If the generator returns numeric (integer) values, return the next value as an int. Default is to return -1, which is appropriate for generators that do not return numeric values.

Throws:
WorkloadException - if this generator does not support integer values

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

addValue

public void addValue(double weight,
                     java.lang.String value)