yass.modularforwarding.scoring
Class RandomScoreGenerator

java.lang.Object
  extended by yass.modularforwarding.scoring.ScoreGenerator
      extended by yass.modularforwarding.scoring.RandomScoreGenerator

public class RandomScoreGenerator
extends ScoreGenerator

Generates a random score within a specified range each time a packet is supplied. The generated score is not stable between invocations for any given packet.


Field Summary
private  double maximumScore
          The maximum score which may be produced
private  double minimumScore
          The minimum score which may be produced
private  java.util.Random random
          The random number generator
private  double scoreRange
          The size of the minimum-to-maxium range that may be produced
 
Constructor Summary
RandomScoreGenerator(double minimumScore, double maximumScore)
          Creates a new instance of RandomScoreGenerator
 
Method Summary
 double getMaximumScore()
          Obtains the maximum score that may be generated
 double getMinimumScore()
          Obtains the minimum score that may be generated
 double score(Packet packet)
          Randomly generate a score between the permitted minimum and maximum levels.
 void setRandomSeed(long seed)
          Resets the random number generator with the supplied seed
 
Methods inherited from class yass.modularforwarding.scoring.ScoreGenerator
getManager, setManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minimumScore

private double minimumScore
The minimum score which may be produced


maximumScore

private double maximumScore
The maximum score which may be produced


scoreRange

private double scoreRange
The size of the minimum-to-maxium range that may be produced


random

private java.util.Random random
The random number generator

Constructor Detail

RandomScoreGenerator

public RandomScoreGenerator(double minimumScore,
                            double maximumScore)
Creates a new instance of RandomScoreGenerator

Parameters:
minimumScore - the minimum score which may be produced
maximumScore - the maximum score which may be produced
Method Detail

score

public double score(Packet packet)
Randomly generate a score between the permitted minimum and maximum levels. The supplied packet is ignored.

Specified by:
score in class ScoreGenerator
Parameters:
packet - the packet to ignore
Returns:
a randomly selected value in the interval [minimumScore, maximumScore]

setRandomSeed

public void setRandomSeed(long seed)
Resets the random number generator with the supplied seed

Parameters:
seed - the random number generator seed

getMinimumScore

public double getMinimumScore()
Obtains the minimum score that may be generated

Returns:
the minimum score that may be generated

getMaximumScore

public double getMaximumScore()
Obtains the maximum score that may be generated

Returns:
the maximum score that may be generated