vooga.engine.resource.random
Class SeedStatus

java.lang.Object
  extended by vooga.engine.resource.random.SeedStatus

public class SeedStatus
extends java.lang.Object

Keeps track of the value of the seed, the number of times a seed is used, and the seed string id. Used in the Randomizer class to maintain which seeds were used and how many times in order to simplify replaying a series of events with elements of randomness.


Constructor Summary
SeedStatus(long seedValue)
          Create an unnamed, unused, seed of a given value
SeedStatus(long seedValue, int timesUsed)
          Create an unnamed seed used a specified number of times
SeedStatus(long seedValue, int timesUsed, java.lang.String name)
          Create a named seed of a given value used a given number of times
SeedStatus(long seedValue, java.lang.String name)
          Create an unused seed with a given name and value
 
Method Summary
 java.lang.String getName()
          Retrieve the string identification of a seed status
 long getValue()
          Get the value of the seed for seeding a random number generator
 void incTimesUsed()
          Increment the number of times a seed was used.
 void resetTimesUsed()
          Reset the number of times a seed is used to zero.
 int timesUsed()
          Get the number of times the seed was used for resetting a generator to a the number of times used after seeding from some value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SeedStatus

public SeedStatus(long seedValue)
Create an unnamed, unused, seed of a given value

Parameters:
seedValue - value of the seed for seeding random number generators

SeedStatus

public SeedStatus(long seedValue,
                  int timesUsed)
Create an unnamed seed used a specified number of times

Parameters:
seedValue - value of the seed for seeding random number generators
timesUsed - the number of random numbers generated using this seed

SeedStatus

public SeedStatus(long seedValue,
                  java.lang.String name)
Create an unused seed with a given name and value

Parameters:
seedValue - value of the seed for seeding random number generators
name - String id of the seed

SeedStatus

public SeedStatus(long seedValue,
                  int timesUsed,
                  java.lang.String name)
Create a named seed of a given value used a given number of times

Parameters:
seedValue - value of the seed for seeding random number generators
timesUsed - the number of random numbers generated using this seed
name - String id of the seed
Method Detail

getValue

public long getValue()
Get the value of the seed for seeding a random number generator

Returns:
the seed value

timesUsed

public int timesUsed()
Get the number of times the seed was used for resetting a generator to a the number of times used after seeding from some value

Returns:
the number of times a seed was used

incTimesUsed

public void incTimesUsed()
Increment the number of times a seed was used. To insure replayability this should be called on a seed status every time the generator seeded with the corresponding seed is used


resetTimesUsed

public void resetTimesUsed()
Reset the number of times a seed is used to zero.


getName

public java.lang.String getName()
Retrieve the string identification of a seed status

Returns:
the string id