edu.usc.bg.base.generator
Class DiscreteGenerator

java.lang.Object
  extended by edu.usc.bg.base.generator.DiscreteGenerator

public class DiscreteGenerator
extends java.lang.Object

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
equals, 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.


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.


addValue

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