Class HelpingUtility

java.lang.Object
  extended by HelpingUtility

public class HelpingUtility
extends java.lang.Object

HelpingUtility class defines the methods for generating random values with uniform distribution using Random.

HelpingUtility class also reads the input parameters and their associated values from the input configuration file.

Conversion of the clock speed to appropriate speed by a factor is also performed in this class.


Field Summary
private  java.util.Vector allParamSet
          list of input parameters
private  java.util.Random rand
          a member of the java.Util.Random class
 
Constructor Summary
HelpingUtility()
          Constructor method.
 
Method Summary
 int getConvertedCycle(int cycle, double factor)
          Returns a converted cycle for the factor specified in the arguement.
 double getNextRandomNumber()
          Returns a random number from 0 to 1 using Uniform Distribution.
 java.util.Vector getParamSet(int index)
          Returns a set of input parameters for a particular network speicied by the arguement of the method.
 void readParameterFromFile(java.lang.String parameterFile)
          Reads the input configuration file.
 void setRandomSeed()
          Instantiates the rand variable.
 void setRandSeed(int seed)
          Sets the seed for the randomizer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rand

private java.util.Random rand
a member of the java.Util.Random class


allParamSet

private java.util.Vector allParamSet
list of input parameters

Constructor Detail

HelpingUtility

public HelpingUtility()
Constructor method. Performs initialization of the class variables.

Method Detail

setRandSeed

public void setRandSeed(int seed)
Sets the seed for the randomizer

Parameters:
seed - seed value

setRandomSeed

public void setRandomSeed()
Instantiates the rand variable.


getNextRandomNumber

public double getNextRandomNumber()
Returns a random number from 0 to 1 using Uniform Distribution.

Returns:
random value from 0 to 1

getParamSet

public java.util.Vector getParamSet(int index)
Returns a set of input parameters for a particular network speicied by the arguement of the method.

Parameters:
index - Index of the Network to be tested
Returns:
a set of input parameters

readParameterFromFile

public void readParameterFromFile(java.lang.String parameterFile)
Reads the input configuration file. Each empty line defines a new set of input parameters. Typically a set of input parameters correspond to the simulation for a particular topology or configuration.

A typical line of the file is of the format =. The parameter name and its value is stored in the ParamDTO object.

Parameters:
parameterFile - the name of the input configuration file
See Also:
BufferedReader, StringTokenizer

getConvertedCycle

public int getConvertedCycle(int cycle,
                             double factor)
Returns a converted cycle for the factor specified in the arguement.

Parameters:
cycle - cycle value of an entity, for example a resource
factor - ratio of the speed between an entity, for example a resource and the switch
Returns:
value the cycle with respect to the switch