SSJ
3.3.1
Stochastic Simulation in Java
|
Represents a matrix of statistical probes that can be managed simultaneously. More...
Public Member Functions | |
MatrixOfStatProbes (int numRows, int numColumns) | |
Constructs a new unnamed matrix of statistical probes with numRows rows, and numColumns columns, and filled with null references. More... | |
MatrixOfStatProbes (String name, int numRows, int numColumns) | |
Constructs a new matrix of statistical probes with name name , numRows rows, and numColumns columns, and filled with null references. More... | |
String | getName () |
Returns the global name of this matrix of statistical probes. More... | |
void | setName (String name) |
Sets the global name of this matrix to name . More... | |
int | rows () |
Returns the number of rows in this matrix. More... | |
int | columns () |
Returns the number of columns in this matrix. More... | |
void | setRows (int newRows) |
Sets the number of rows of this matrix of statistical probes to newRows , adding or removing cells as necessary. More... | |
void | setColumns (int newColumns) |
Similar to setRows(int), for setting the number of columns. More... | |
E | get (int r, int c) |
Returns the statistical probe corresponding to the row r and column c . More... | |
void | set (int r, int c, E probe) |
Sets the statistical probe corresponding to the row r and column c to probe . More... | |
void | init () |
Initializes this matrix of statistical probes by calling StatProbe.init on each element. | |
void | sum (DoubleMatrix2D m) |
For each probe in the matrix, computes the sum by calling umontreal.ssj.stat.StatProbe.sum, and stores it into the given matrix m . More... | |
void | average (DoubleMatrix2D m) |
For each statistical probe in the matrix, computes the average by calling umontreal.ssj.stat.StatProbe.average, and stores it into the given matrix m . More... | |
boolean | isCollecting () |
Determines if this matrix 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 matrix of statistical probes is broadcasting values to registered observers. More... | |
void | setBroadcasting (boolean b) |
Sets the status of the observation broadcasting mechanism to b . More... | |
void | addMatrixOfObservationListener (MatrixOfObservationListener l) |
Adds the observation listener l to the list of observers of this matrix of statistical probes. More... | |
void | removeMatrixOfObservationListener (MatrixOfObservationListener l) |
Removes the observation listener l from the list of observers of this matrix of statistical probes. More... | |
void | clearMatrixOfObservationListeners () |
Removes all observation listeners from the list of observers of this matrix of statistical probes. | |
void | notifyListeners (DoubleMatrix2D x) |
Notifies the observation x to all registered observers if broadcasting is ON. More... | |
List< E > | viewRow (int r) |
Returns a list representing a view on row r of this matrix of statistical probe. More... | |
List< E > | viewColumn (int c) |
Returns a list representing a view on column c of this matrix of statistical probe. More... | |
String | rowReport (int r) |
Formats a report for the row r of the statistical probe matrix. More... | |
String | columnReport (int c) |
Formats a report for the column c of the statistical probe matrix. More... | |
MatrixOfStatProbes< E > | clone () |
Clones this object. More... | |
Iterator< E > | iterator () |
Protected Attributes | |
boolean | collect = true |
boolean | broadcast = false |
String | name |
Represents a matrix of statistical probes that can be managed simultaneously.
Each element of this matrix is a umontreal.ssj.stat.StatProbe instance which can be obtained and manipulated. Alternatively, several methods are provided to manipulate all probes in the matrix simultaneously.
Each matrix of probes can have a global name describing the contents of its elements, and local names for each cell. For example, a matrix of statistical probes for the waiting times can have the global name "<tt>Waiting times</tt>" while the first cell has local name "<tt>type 1, period 1</tt>".
Facilities are provided to fill matrices of sums, averages, etc. obtained from the individual statistical probes. DoubleMatrix2D is used instead of 2D arrays because it more efficiently stores the values, and it supports computations on the elements.
MatrixOfStatProbes | ( | int | numRows, |
int | numColumns | ||
) |
Constructs a new unnamed matrix of statistical probes with numRows
rows, and numColumns
columns, and filled with null
references.
numRows | the number of rows in the matrix. |
numColumns | the number of columns in the matrix. |
NegativeArraySizeException | if numRows or numColumns are negative. |
MatrixOfStatProbes | ( | String | name, |
int | numRows, | ||
int | numColumns | ||
) |
Constructs a new matrix of statistical probes with name name
, numRows
rows, and numColumns
columns, and filled with null
references.
name | the global name of the matrix. |
numRows | the number of rows in the matrix. |
numColumns | the number of columns in the matrix. |
NegativeArraySizeException | if numRows or numColumns are negative. |
void addMatrixOfObservationListener | ( | MatrixOfObservationListener | l | ) |
Adds the observation listener l
to the list of observers of this matrix of statistical probes.
l | the new observation listener. |
NullPointerException | if l is null . |
void average | ( | DoubleMatrix2D | m | ) |
For each statistical probe in the matrix, computes the average by calling umontreal.ssj.stat.StatProbe.average, and stores it into the given matrix m
.
m | the matrix to be filled with averages. |
MatrixOfStatProbes<E> clone | ( | ) |
Clones this object.
This makes a shallow copy of this matrix, i.e., this does not clone all the probes in the matrix.
String columnReport | ( | int | c | ) |
Formats a report for the column c
of the statistical probe matrix.
The returned string is constructed by getting a view of column c
and using StatProbe.report
on this list.
c | the column being reported. |
int columns | ( | ) |
Returns the number of columns in this matrix.
E get | ( | int | r, |
int | c | ||
) |
Returns the statistical probe corresponding to the row r
and column c
.
r | the row to look at. |
c | the column to look at. |
String getName | ( | ) |
Returns the global name of this matrix of statistical probes.
boolean isBroadcasting | ( | ) |
Determines if this matrix of statistical probes is broadcasting values to registered observers.
The default is false
.
boolean isCollecting | ( | ) |
Determines if this matrix of statistical probes is collecting values.
The default is true
.
void notifyListeners | ( | DoubleMatrix2D | x | ) |
Notifies the observation x
to all registered observers if broadcasting is ON.
Otherwise, does nothing.
void removeMatrixOfObservationListener | ( | MatrixOfObservationListener | l | ) |
Removes the observation listener l
from the list of observers of this matrix of statistical probes.
l | the observation listener to be deleted. |
String rowReport | ( | int | r | ) |
Formats a report for the row r
of the statistical probe matrix.
The returned string is constructed by getting a view of row r
and using StatProbe.report
on this list.
r | the row being reported. |
int rows | ( | ) |
Returns the number of rows in this matrix.
void set | ( | int | r, |
int | c, | ||
E | probe | ||
) |
Sets the statistical probe corresponding to the row r
and column c
to probe
.
r | the row to modify. |
c | the column to modify. |
probe | t he new probe. |
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 setColumns | ( | int | newColumns | ) |
Similar to setRows(int), for setting the number of columns.
newColumns | the new number of columns of the matrix. |
IllegalArgumentException | if an error occurs during construction of statistical probes. |
NegativeArraySizeException | if newolumns is negative. |
void setName | ( | String | name | ) |
Sets the global name of this matrix to name
.
name | the new global name of the matrix. |
void setRows | ( | int | newRows | ) |
Sets the number of rows of this matrix of statistical probes to newRows
, adding or removing cells as necessary.
If newRows
is negative, a NegativeArraySizeException
is thrown. Otherwise, if newRows
is equal to rows, nothing happens. If the number of rows is reduced, the last rows - newRows
rows of statistical probes are lost. If the number of rows is increased, the new elements of the matrix are set to null
.
newRows | the new number of rows of the matrix. |
IllegalArgumentException | if an error occurs during construction of statistical probes. |
NegativeArraySizeException | if newRows is negative. |
void sum | ( | DoubleMatrix2D | m | ) |
For each probe in the matrix, computes the sum by calling umontreal.ssj.stat.StatProbe.sum, and stores it into the given matrix m
.
m | the matrix to be filled with sums. |
List<E> viewColumn | ( | int | c | ) |
Returns a list representing a view on column c
of this matrix of statistical probe.
The returned list cannot be modified, and becomes invalid if the number of columns in this matrix of statistical probes is changed.
c | the column to look at. |
List<E> viewRow | ( | int | r | ) |
Returns a list representing a view on row r
of this matrix of statistical probe.
The returned list cannot be modified, and becomes invalid if the number of rows in this matrix of statistical probes is changed.
r | the row to look at. |