edu.usc.bg.base.generator
Class CounterGenerator

java.lang.Object
  extended by edu.usc.bg.base.generator.Generator
      extended by edu.usc.bg.base.generator.IntegerGenerator
          extended by edu.usc.bg.base.generator.CounterGenerator

public class CounterGenerator
extends IntegerGenerator

Generates a sequence of integers 0, 1, ...


Constructor Summary
CounterGenerator(int countstart)
          Create a counter that starts at countstart
 
Method Summary
 int lastInt()
          Return the previous int generated by the distribution.
 double mean()
          Return the expected value (mean) of the values this generator will return.
 int nextInt()
          If the generator returns numeric (integer) values, return the next value as an int.
 
Methods inherited from class edu.usc.bg.base.generator.IntegerGenerator
lastString, nextString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CounterGenerator

public CounterGenerator(int countstart)
Create a counter that starts at countstart

Method Detail

nextInt

public int nextInt()
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.

Specified by:
nextInt in class IntegerGenerator

lastInt

public int lastInt()
Description copied from class: IntegerGenerator
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).

Overrides:
lastInt in class IntegerGenerator

mean

public double mean()
Description copied from class: IntegerGenerator
Return the expected value (mean) of the values this generator will return.

Specified by:
mean in class IntegerGenerator