crowdmodel.utils
Class MiscSingleton

java.lang.Object
  extended by crowdmodel.utils.MiscSingleton

public class MiscSingleton
extends java.lang.Object

This is a singleton class to make sure that there are unique ID's for the objects in the crowd model A singleton class is a construction in which one is sure that there is only one unique instantiation of that class. Furthermore, it can be called by any class only via a getInstance. - ID number generator - Random number generators (normal, beta and uniform distributions)

Author:
Nanda Wijermans

Field Summary
private static MiscSingleton d_instance
           
private  cern.jet.random.Beta d_myBetaLeft
           
private  cern.jet.random.Beta d_myBetaNormal
           
private  cern.jet.random.Beta d_myBetaRight
           
private  cern.jet.random.Normal d_myNormal
           
private  cern.jet.random.Uniform d_myUniform
           
private  int d_nextID
           
 
Constructor Summary
private MiscSingleton()
          A private constructor as this is a singleton class can only be called by getInstance, which makes sure that this class is only instantiated once
 
Method Summary
static MiscSingleton getInstance()
          This function returns the instantiation of this class As this is a singleton, there is only one object created which is referred to by instance.
 cern.jet.random.Beta getMyBetaLeft()
          Returns the (unique) Beta distribution stream used in this simulation for the initial settings of the safety goal.
 cern.jet.random.Beta getMyBetaNormal()
          Returns the (unique) Beta distribution stream used in this simulation for the initial settings of the identity, social and safety goal.
 cern.jet.random.Beta getMyBetaRight()
          Returns the (unique) Beta distribution stream used in this simulation for the initial settings of the safety goal.
 cern.jet.random.Normal getMyNormal()
          Returns the (unique) normal distribution stream used in this simulation mean = 0.5 st. dev = 0.1
 cern.jet.random.Uniform getMyUniform()
          Returns the (unique) uniform distribution stream used in this simulation
 int nextID()
          Returns an unique ID value used to give each created object a fixed number for identification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

d_instance

private static MiscSingleton d_instance

d_nextID

private int d_nextID

d_myNormal

private cern.jet.random.Normal d_myNormal

d_myUniform

private cern.jet.random.Uniform d_myUniform

d_myBetaNormal

private cern.jet.random.Beta d_myBetaNormal

d_myBetaLeft

private cern.jet.random.Beta d_myBetaLeft

d_myBetaRight

private cern.jet.random.Beta d_myBetaRight
Constructor Detail

MiscSingleton

private MiscSingleton()
A private constructor as this is a singleton class can only be called by getInstance, which makes sure that this class is only instantiated once

Method Detail

getInstance

public static MiscSingleton getInstance()
This function returns the instantiation of this class As this is a singleton, there is only one object created which is referred to by instance.


nextID

public int nextID()
Returns an unique ID value used to give each created object a fixed number for identification


getMyNormal

public cern.jet.random.Normal getMyNormal()
Returns the (unique) normal distribution stream used in this simulation mean = 0.5 st. dev = 0.1


getMyUniform

public cern.jet.random.Uniform getMyUniform()
Returns the (unique) uniform distribution stream used in this simulation


getMyBetaLeft

public cern.jet.random.Beta getMyBetaLeft()
Returns the (unique) Beta distribution stream used in this simulation for the initial settings of the safety goal. Shaped as a left-skewed distribution (positive skew)


getMyBetaRight

public cern.jet.random.Beta getMyBetaRight()
Returns the (unique) Beta distribution stream used in this simulation for the initial settings of the safety goal. Shaped as a right-skewed distribution (negative skew)


getMyBetaNormal

public cern.jet.random.Beta getMyBetaNormal()
Returns the (unique) Beta distribution stream used in this simulation for the initial settings of the identity, social and safety goal. Shaped as a approximation of the normal distribution.