package uk.co.jezuk.mango.generators;

import uk.co.jezuk.mango.Generator;

/**
 * Returns seed, seed+1, seed+2 ... on successive calls to fn()
 * Sequence begins at 0 if no seed value is given.
 * @author Jez Higgins, jez@jezuk.co.uk
 */
public class IntegerSequence implements Generator<Integer>
{
  public IntegerSequence()
  {
    seed_ = 0;
  } // IntegerSequence

  public IntegerSequence(int seed)
  {
    seed_ = seed;
  } // IntegerSequence

  public IntegerSequence(Integer seed)
  {
    seed_ = seed.intValue();
  } // IntegerSequence

  public Integer fn()
  {
    return new Integer(seed_++);
  } // fn

  private int seed_;
} // Generator


@@ -581,19 +581,23 @@
 urn 
-new 
 Integer
+.valueOf
 (see

use valueOf instead of Integer constructor