|
SSJ V. labo. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.stat.matrix.MatrixOfStatProbes<E>
public class MatrixOfStatProbes<E extends StatProbe>
Represents a matrix of statistical probes that
can be managed simultaneously.
Each element of this matrix is a 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 ``Waiting times'' while the first cell has local name ``type 1, period 1''.
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.
Constructor Summary | |
---|---|
MatrixOfStatProbes(int numRows,
int numColumns)
Constructs a new unnamed matrix of statistical probes with numRows rows, and numColumns columns, and filled with null references. |
|
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. |
Method Summary | |
---|---|
void |
addMatrixOfObservationListener(MatrixOfObservationListener l)
Adds the observation listener l to the list of observers of this matrix of statistical probes. |
void |
average(DoubleMatrix2D m)
For each statistical probe in the matrix, computes the average by calling average ,
and stores it into the given matrix m. |
void |
clearMatrixOfObservationListeners()
Removes all observation listeners from the list of observers of this matrix of statistical probes. |
MatrixOfStatProbes<E> |
clone()
Clones this object. |
String |
columnReport(int c)
Formats a report for the column c of the statistical probe matrix. |
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. |
String |
getName()
Returns the global name of this matrix of statistical probes. |
void |
init()
Initializes this matrix of statistical probes by calling StatProbe.init on each element. |
boolean |
isBroadcasting()
Determines if this matrix of statistical probes is broadcasting values to registered observers. |
boolean |
isCollecting()
Determines if this matrix of statistical probes is collecting values. |
Iterator<E> |
iterator()
|
void |
notifyListeners(DoubleMatrix2D x)
Notifies the observation x to all registered observers if broadcasting is ON. |
void |
removeMatrixOfObservationListener(MatrixOfObservationListener l)
Removes the observation listener l from the list of observers of this matrix of statistical probes. |
String |
rowReport(int r)
Formats a report for the row r of the statistical probe matrix. |
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. |
void |
setBroadcasting(boolean b)
Sets the status of the observation broadcasting mechanism to b. |
void |
setCollecting(boolean c)
Sets the status of the statistical collecting mechanism to c. |
void |
setColumns(int newColumns)
Similar to setRows , for setting the number of columns. |
void |
setName(String name)
Sets the global name of this matrix to name. |
void |
setRows(int newRows)
Sets the number of rows of this matrix of statistical probes to newRows, adding or removing cells as necessary. |
void |
sum(DoubleMatrix2D m)
For each probe in the matrix, computes the sum by calling sum , and stores
it into the given matrix m. |
List<E> |
viewColumn(int c)
Returns a list representing a view on column c of this matrix of statistical probe. |
List<E> |
viewRow(int r)
Returns a list representing a view on row r of this matrix of statistical probe. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MatrixOfStatProbes(int numRows, int numColumns)
numRows
- the number of rows in the matrix.numColumns
- the number of columns in the matrix.
NegativeArraySizeException
- if
numRows or numColumns are negative.public MatrixOfStatProbes(String name, int numRows, int numColumns)
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.Method Detail |
---|
public String getName()
public void setName(String name)
name
- the new global name of the matrix.public int rows()
public int columns()
public void setRows(int newRows)
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.public void setColumns(int newColumns)
setRows
, 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.public E get(int r, int c)
r
- the row to look at.c
- the column to look at.
ArrayIndexOutOfBoundsException
- if r or
c are negative, if r is greater than or equal to
rows
, or if c is greater than or equal to columns
.public void set(int r, int c, E probe)
r
- the row to modify.c
- the column to modify.probe
- t
he new probe.
ArrayIndexOutOfBoundsException
- if r or
c are negative, if r is greater than or equal to
rows
, or if c is greater than or equal to columns
.public void init()
public void sum(DoubleMatrix2D m)
sum
, and stores
it into the given matrix m.
m
- the matrix to be filled with sums.
NullPointerException
- if m is null.
IllegalArgumentException
- if m.rows()
does not correspond to rows
, or
m.columns() does not correspond to columns
.public void average(DoubleMatrix2D m)
average
,
and stores it into the given matrix m.
m
- the matrix to be filled with averages.
NullPointerException
- if m is null.
IllegalArgumentException
- if m.rows()
does not correspond to rows
, or
m.columns() does not correspond to columns
.public boolean isCollecting()
public void setCollecting(boolean c)
c
- the status of statistical collecting.public boolean isBroadcasting()
public void setBroadcasting(boolean b)
b
- the status of broadcasting.public void addMatrixOfObservationListener(MatrixOfObservationListener l)
l
- the new observation listener.
NullPointerException
- if l is null.public void removeMatrixOfObservationListener(MatrixOfObservationListener l)
l
- the observation listener to be deleted.public void clearMatrixOfObservationListeners()
public void notifyListeners(DoubleMatrix2D x)
public List<E> viewRow(int r)
r
- the row to look at.
public List<E> viewColumn(int c)
c
- the column to look at.
public String rowReport(int r)
r
- the row being reported.
public String columnReport(int c)
c
- the column being reported.
public MatrixOfStatProbes<E> clone()
clone
in class Object
public Iterator<E> iterator()
iterator
in interface Iterable<E extends StatProbe>
|
SSJ V. labo. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |