SSJ
3.3.1
Stochastic Simulation in Java
|
Represents a list of statistical probes that can be managed simultaneously. More...
Public Member Functions | |
ListOfStatProbes () | |
Constructs an empty list of statistical probes. | |
ListOfStatProbes (String name) | |
Constructs an empty list of statistical probes with name name . More... | |
String | getName () |
Returns the global name of this list of statistical probes. More... | |
void | setName (String name) |
Sets the global name of this list to name . More... | |
boolean | isModifiable () |
Determines if this list of statistical probes is modifiable, i.e., if probes can be added or removed. More... | |
void | setUnmodifiable () |
Forbids any future modification to this list of statistical probes. More... | |
void | init () |
Initializes this list of statistical probes by calling umontreal.ssj.stat.StatProbe.init on each element. | |
void | sum (double[] s) |
For each probe in the list, computes the sum by calling umontreal.ssj.stat.StatProbe.sum, and stores the results into the array s . More... | |
void | average (double[] a) |
For each probe in this list, computes the average by calling umontreal.ssj.stat.StatProbe.average, and stores the results into the array a . More... | |
boolean | isCollecting () |
Determines if this list of statistical probes is collecting values. More... | |
void | setCollecting (boolean c) |
Sets the status of the statistical collecting mechanism to c . More... | |
boolean | isBroadcasting () |
Determines if this list of statistical probes is broadcasting observations to registered observers. More... | |
void | setBroadcasting (boolean b) |
Sets the status of the observation broadcasting mechanism to b . More... | |
void | addArrayOfObservationListener (ArrayOfObservationListener l) |
Adds the observation listener l to the list of observers of this list of statistical probes. More... | |
void | removeArrayOfObservationListener (ArrayOfObservationListener l) |
Removes the observation listener l from the list of observers of this list of statistical probes. More... | |
void | clearArrayOfObservationListeners () |
Removes all observation listeners from the list of observers of this list of statistical probes. | |
void | notifyListeners (double[] x) |
Notifies the observation x to all registered observers if broadcasting is ON. More... | |
String | report () |
Formats a report for each probe in the list of statistical probes. More... | |
ListOfStatProbes< E > | clone () |
Clones this object. More... | |
boolean | add (E o) |
void | add (int index, E o) |
boolean | addAll (Collection<? extends E > c) |
boolean | addAll (int index, Collection<? extends E > c) |
void | clear () |
boolean | contains (Object o) |
boolean | containsAll (Collection<?> c) |
boolean | equals (Object o) |
E | get (int index) |
int | hashCode () |
int | indexOf (Object o) |
boolean | isEmpty () |
Iterator< E > | iterator () |
int | lastIndexOf (Object o) |
ListIterator< E > | listIterator () |
ListIterator< E > | listIterator (int index) |
E | remove (int index) |
boolean | remove (Object o) |
boolean | removeAll (Collection<?> c) |
boolean | retainAll (Collection<?> c) |
E | set (int index, E element) |
int | size () |
List< E > | subList (int fromIndex, int toIndex) |
Object [] | toArray () |
Protected Attributes | |
boolean | collect = true |
boolean | broadcast = false |
String | name |
Package Functions | |
public< T > T [] | toArray (T[] a) |
Represents a list of statistical probes that can be managed simultaneously.
Each element of this list is a umontreal.ssj.stat.StatProbe instance which can be obtained and manipulated.
When constructing a list of statistical probes, one specifies the concrete subclass of the umontreal.ssj.stat.StatProbe objects in it. One then creates an empty list of probes, and fills it with statistical probes. If the list is not intended to be modified, one can then use the setUnmodifiable to prevent any change in the contents of the list.
Each list of statistical probes can have a global name describing the contents of its elements, and local names associated with each individual probe. For example, a list of statistical probes for the waiting times can have the global name Waiting times
while the individual probes have local names type 1
, type 2
, etc. These names are used for formatting reports.
Facilities are provided to fill arrays with sums, averages, etc. obtained from the individual statistical probes. Methods are also provided to manipulate the contents of the list. However, one should always call init
immediately after adding or removing statistical probes in the list.
ListOfStatProbes | ( | String | name | ) |
Constructs an empty list of statistical probes with name name
.
name | the name of the new list. |
void addArrayOfObservationListener | ( | ArrayOfObservationListener | l | ) |
Adds the observation listener l
to the list of observers of this list of statistical probes.
l | the new observation listener. |
NullPointerException | if l is null . |
void average | ( | double [] | a | ) |
For each probe in this list, computes the average by calling umontreal.ssj.stat.StatProbe.average, and stores the results into the array a
.
This method throws an exception if the size of s
mismatches with the size of the list.
a | the array to be filled with averages. |
NullPointerException | if a is null . |
IllegalArgumentException | if a.length does not correspond to #size. |
ListOfStatProbes<E> clone | ( | ) |
Clones this object.
This makes a shallow copy of this list, i.e., this does not clone all the probes in the list. The created clone is modifiable, even if the original list is unmodifiable.
String getName | ( | ) |
Returns the global name of this list of statistical probes.
boolean isBroadcasting | ( | ) |
Determines if this list of statistical probes is broadcasting observations to registered observers.
The default is false
.
boolean isCollecting | ( | ) |
Determines if this list of statistical probes is collecting values.
Each probe of the list could or could not be collecting values. The default is true
.
boolean isModifiable | ( | ) |
Determines if this list of statistical probes is modifiable, i.e., if probes can be added or removed.
Any list of statistical probes is modifiable by default, until one calls the setUnmodifiable method.
void notifyListeners | ( | double [] | x | ) |
Notifies the observation x
to all registered observers if broadcasting is ON.
Otherwise, does nothing.
void removeArrayOfObservationListener | ( | ArrayOfObservationListener | l | ) |
Removes the observation listener l
from the list of observers of this list of statistical probes.
l | the observation listener to be deleted. |
String report | ( | ) |
Formats a report for each probe in the list of statistical probes.
The returned string is constructed by using StatProbe.report (getName(), this)
.
void setBroadcasting | ( | boolean | b | ) |
Sets the status of the observation broadcasting mechanism to b
.
A true
value turns broadcasting ON, a false
value turns it OFF.
b | the status of broadcasting. |
void setCollecting | ( | boolean | c | ) |
Sets the status of the statistical collecting mechanism to c
.
A true
value turns statistical collecting ON, a false
value turns it OFF.
c | the status of statistical collecting. |
void setName | ( | String | name | ) |
Sets the global name of this list to name
.
name | the new global name of the list. |
void setUnmodifiable | ( | ) |
Forbids any future modification to this list of statistical probes.
After this method is called, any attempt to modify the list results in an exception. Setting a list unmodifiable can be useful if some data structures are defined depending on the probes in the list.
void sum | ( | double [] | s | ) |
For each probe in the list, computes the sum by calling umontreal.ssj.stat.StatProbe.sum, and stores the results into the array s
.
This method throws an exception if the size of s
mismatches with the size of the list.
s | the array to be filled with sums. |
NullPointerException | if s is null . |
IllegalArgumentException | if s.length does not correspond to #size. |