public class ListOfStatProbes<E extends StatProbe>
extends java.lang.Object
implements java.lang.Cloneable, java.util.List<E>, java.util.RandomAccess
StatProbe
instance which can be obtained and manipulated.
When constructing a list of statistical probes, one specifies the
concrete subclass of the 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.
| Constructor and Description |
|---|
ListOfStatProbes()
Constructs an empty list of statistical probes.
|
ListOfStatProbes(java.lang.String name)
Constructs an empty list of statistical probes with
name name.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E o) |
void |
add(int index,
E o) |
boolean |
addAll(java.util.Collection<? extends E> c) |
boolean |
addAll(int index,
java.util.Collection<? extends E> c) |
void |
addArrayOfObservationListener(ArrayOfObservationListener l)
Adds the observation listener l to the list of observers of
this list of statistical probes.
|
void |
average(double[] a)
For each probe in this list, computes
the average by calling
average, and stores
the results into the array a. |
void |
clear() |
void |
clearArrayOfObservationListeners()
Removes all observation listeners from the list of observers of
this list of statistical probes.
|
ListOfStatProbes<E> |
clone()
Clones this object.
|
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
boolean |
equals(java.lang.Object o) |
E |
get(int index) |
java.lang.String |
getName()
Returns the global name of this list of statistical probes.
|
int |
hashCode() |
int |
indexOf(java.lang.Object o) |
void |
init()
Initializes this list of statistical probes by calling
init on each element. |
boolean |
isBroadcasting()
Determines if this list of statistical probes
is broadcasting observations to registered observers.
|
boolean |
isCollecting()
Determines if this list of statistical probes
is collecting values.
|
boolean |
isEmpty() |
boolean |
isModifiable()
Determines if this list of statistical probes is
modifiable, i.e., if probes can be added or removed.
|
java.util.Iterator<E> |
iterator() |
int |
lastIndexOf(java.lang.Object o) |
java.util.ListIterator<E> |
listIterator() |
java.util.ListIterator<E> |
listIterator(int index) |
void |
notifyListeners(double[] x)
Notifies the observation x to all registered observers
if broadcasting is ON.
|
E |
remove(int index) |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
void |
removeArrayOfObservationListener(ArrayOfObservationListener l)
Removes the observation listener l from the list of observers of
this list of statistical probes.
|
java.lang.String |
report()
Formats a report for each probe in the list of
statistical probes.
|
boolean |
retainAll(java.util.Collection<?> c) |
E |
set(int index,
E element) |
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 |
setName(java.lang.String name)
Sets the global name of this list to name.
|
void |
setUnmodifiable()
Forbids any future modification to this list of
statistical probes.
|
int |
size() |
java.util.List<E> |
subList(int fromIndex,
int toIndex) |
void |
sum(double[] s)
For each probe in the list, computes
the sum by calling
sum, and stores
the results into the array s. |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
public ListOfStatProbes()
public ListOfStatProbes(java.lang.String name)
name - the name of the new list.public java.lang.String getName()
public void setName(java.lang.String name)
name - the new global name of the list.public boolean isModifiable()
setUnmodifiable method.public void setUnmodifiable()
public void init()
init on each element.public void sum(double[] s)
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.java.lang.NullPointerException - if s is null.java.lang.IllegalArgumentException - if s.length
does not correspond to size.public void average(double[] a)
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.java.lang.NullPointerException - if a is null.java.lang.IllegalArgumentException - if a.length
does not correspond to size.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 addArrayOfObservationListener(ArrayOfObservationListener l)
l - the new observation listener.java.lang.NullPointerException - if l is null.public void removeArrayOfObservationListener(ArrayOfObservationListener l)
l - the observation listener to be deleted.public void clearArrayOfObservationListeners()
public void notifyListeners(double[] x)
public java.lang.String report()
public ListOfStatProbes<E> clone()
clone in class java.lang.Objectpublic boolean add(E o)
public void add(int index,
E o)
public boolean addAll(java.util.Collection<? extends E> c)
public boolean addAll(int index,
java.util.Collection<? extends E> c)
public void clear()
public boolean contains(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public boolean equals(java.lang.Object o)
public int hashCode()
public int indexOf(java.lang.Object o)
public boolean isEmpty()
public java.util.Iterator<E> iterator()
public int lastIndexOf(java.lang.Object o)
public java.util.ListIterator<E> listIterator()
public java.util.ListIterator<E> listIterator(int index)
public E remove(int index)
public boolean remove(java.lang.Object o)
public boolean removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
public int size()
public java.util.List<E> subList(int fromIndex, int toIndex)
public java.lang.Object[] toArray()
To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.