fr.lifl.jedi.util
Class SimulationProperties

java.lang.Object
  extended by fr.lifl.jedi.util.SimulationProperties

public class SimulationProperties
extends java.lang.Object

Singleton class representing properties used during simulation. Those properties make possible to :

Version:
JEDI V 2.2
Created the 7 nov. 2008
Modified the 5th may 2009
Author:
Yoann Kubera
SMAC Team (Systèmes Multi-Agents et Comportement)
LIFL (Laboratoire d'Informatique Fondamentale de Lille)
University of Lille, France

Field Summary
protected  boolean displayWarning
          If the warnings are displayed on System.err or not.
protected  java.util.Random randomizer
          Random number generator of the simulation.
protected  long randomSeed
          Seed of the random number generator of the simulation.
 
Method Summary
 boolean areWarningsDisplayed()
          Returns true if the differents warnings of JEDI have to be displayed.
static SimulationProperties getInstance()
          Gets the instance of the simulation properties.
 java.util.Random getRandomizer()
          Gets the random number generator of the simulation.
 long getRandomizerSeed()
          Gets the random number generator of the simulation's seed.
static boolean loadSimulationProperties(java.lang.String file)
          Loads a property file.
static double random()
          Equivalent to a call to Math.random() using the random number generator defined by JEDI.
 void reset()
          Resets the simulation properties.
static boolean saveSimulationProperties(java.lang.String file)
          Saves the property file.
 void setRandomizerSeed(long seed)
          Sets the seed of the simulation's random number generator .
 void setWarningsDisplayed(boolean w)
          Sets if the differents warnings of JEDI have to be displayed or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

randomizer

protected java.util.Random randomizer
Random number generator of the simulation.


randomSeed

protected long randomSeed
Seed of the random number generator of the simulation.


displayWarning

protected boolean displayWarning
If the warnings are displayed on System.err or not.

Method Detail

getInstance

public static SimulationProperties getInstance()
Gets the instance of the simulation properties.


reset

public void reset()
Resets the simulation properties.


getRandomizer

public java.util.Random getRandomizer()
Gets the random number generator of the simulation.

Returns:
The random number generator of the simulation.

setRandomizerSeed

public void setRandomizerSeed(long seed)
Sets the seed of the simulation's random number generator .

This method must be called before any usage of the random number generator to ensure simulation reproducibility.

Parameters:
seed - The new seed of the random number generator of the simulation.

getRandomizerSeed

public long getRandomizerSeed()
Gets the random number generator of the simulation's seed.

This method must be called before any usage of the random number generator to ensure simulation reproducibility.

Returns:
The seed of the random number generator of the simulation.

areWarningsDisplayed

public boolean areWarningsDisplayed()
Returns true if the differents warnings of JEDI have to be displayed.

Returns:
true if the differents warnings of JEDI have to be displayed.

setWarningsDisplayed

public void setWarningsDisplayed(boolean w)
Sets if the differents warnings of JEDI have to be displayed or not.

Parameters:
w - true if the differents warnings of JEDI have to be displayed.

random

public static double random()
Equivalent to a call to Math.random() using the random number generator defined by JEDI.

Returns:
A double value picked at random.

loadSimulationProperties

public static boolean loadSimulationProperties(java.lang.String file)
Loads a property file. This method must be called first in the simulation.
This file follows the Java properties format ("key"="value"\n), and may contain the keys :

Parameters:
file - The file name the properties are loaded from.

saveSimulationProperties

public static boolean saveSimulationProperties(java.lang.String file)
Saves the property file.

Parameters:
file - The file where to save the properties.