public class ListWithStat<E> extends TransformingList<E,ListWithStat.Node<E>>
TransformingList
and transforms elements into nodes associating insertion times with elements.| Modifier and Type | Class and Description |
|---|---|
static class |
ListWithStat.Node<E>
Represents a node that can be part of a list with
statistical collecting.
|
| Constructor and Description |
|---|
ListWithStat(java.util.List<ListWithStat.Node<E>> nodeList)
Constructs a new list with internal data structure using the default simulator and implemented by nodeList.
|
ListWithStat(java.util.List<ListWithStat.Node<E>> nodeList,
java.util.Collection<? extends E> c)
Constructs a list containing the elements of the specified
collection, whose elements are stored into nodeList and using the default simulator.
|
ListWithStat(java.util.List<ListWithStat.Node<E>> nodeList,
java.util.Collection<? extends E> c,
java.lang.String name)
Constructs a new list containing the elements of the
specified collection c, with name name,
internal list nodeList, and using the default simulator.
|
ListWithStat(java.util.List<ListWithStat.Node<E>> nodeList,
java.lang.String name)
Constructs a new list with name name, internal
list nodeList, and using the default simulator.
|
ListWithStat(Simulator inSim,
java.util.List<ListWithStat.Node<E>> nodeList)
Constructs a new list with internal data structure implemented by
nodeList.
|
ListWithStat(Simulator inSim,
java.util.List<ListWithStat.Node<E>> nodeList,
java.util.Collection<? extends E> c)
Constructs a list containing the elements of the specified
collection, whose elements are stored into nodeList.
|
ListWithStat(Simulator inSim,
java.util.List<ListWithStat.Node<E>> nodeList,
java.util.Collection<? extends E> c,
java.lang.String name)
Constructs a new list containing the elements of the
specified collection c, with name name, and
internal list nodeList.
|
ListWithStat(Simulator inSim,
java.util.List<ListWithStat.Node<E>> nodeList,
java.lang.String name)
Constructs a new list with name name, and
internal list nodeList.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
E obj) |
void |
clear() |
E |
convertFromInnerType(ListWithStat.Node<E> node)
Converts an element in the inner list to
an element of the outer type.
|
ListWithStat.Node<E> |
convertToInnerType(E element)
Converts an element of the outer type to
an element for the inner list.
|
double |
getInitTime()
Returns the last simulation time
initStat was called. |
java.lang.String |
getName()
Returns the name associated to this list,
or null if no name was assigned.
|
boolean |
getStatCollecting()
Returns true if the list collects statistics
about its size and sojourn times of elements, and
false otherwise.
|
void |
initStat()
Reinitializes the two statistical probes created by
setStatCollecting (true) and makes an update for the
probe on the list size. |
java.util.Iterator<E> |
iterator() |
java.util.ListIterator<E> |
listIterator() |
java.util.ListIterator<E> |
listIterator(int index) |
E |
remove(int index) |
java.lang.String |
report()
Returns a string containing a statistical report on the list,
provided that
setStatCollecting (true) has been
called before for this list. |
E |
set(int index,
E element) |
void |
setSimulator(Simulator sim)
Sets the simulator associated with this list.
|
void |
setStatCollecting(boolean b)
Starts or stops collecting statistics on this list.
|
Simulator |
simulator()
Returns the simulator associated with this list.
|
Accumulate |
statSize()
Returns the statistical probe on the evolution of the size of
the list as a function of the simulation time.
|
Tally |
statSojourn()
Returns the statistical probe on the sojourn times of the objects in
the list.
|
get, getInnerList, sizeadd, addAll, equals, hashCode, indexOf, lastIndexOf, subListpublic ListWithStat(java.util.List<ListWithStat.Node<E>> nodeList)
public ListWithStat(Simulator inSim, java.util.List<ListWithStat.Node<E>> nodeList)
nodeList - the list containing the nodespublic ListWithStat(java.util.List<ListWithStat.Node<E>> nodeList, java.util.Collection<? extends E> c)
nodeList - the list containing the nodesc - collection containing elements to fill in this list withpublic ListWithStat(Simulator inSim, java.util.List<ListWithStat.Node<E>> nodeList, java.util.Collection<? extends E> c)
inSim - simulator associate to the current variablenodeList - the list containing the nodesc - collection containing elements to fill in this list withpublic ListWithStat(java.util.List<ListWithStat.Node<E>> nodeList, java.lang.String name)
nodeList - the list containing the nodesname - name for the list objectpublic ListWithStat(Simulator inSim, java.util.List<ListWithStat.Node<E>> nodeList, java.lang.String name)
inSim - simulator associate to the current variablenodeList - the list containing the nodesname - name for the list objectpublic ListWithStat(java.util.List<ListWithStat.Node<E>> nodeList, java.util.Collection<? extends E> c, java.lang.String name)
nodeList - the list containing the nodesc - collection containing elements to fill in this list withname - name for the list objectpublic ListWithStat(Simulator inSim, java.util.List<ListWithStat.Node<E>> nodeList, java.util.Collection<? extends E> c, java.lang.String name)
inSim - simulator associate to the current variablenodeList - the list containing the nodesc - collection containing elements to fill in this list withname - name for the list objectpublic E convertFromInnerType(ListWithStat.Node<E> node)
TransformingListconvertFromInnerType in class TransformingList<E,ListWithStat.Node<E>>node - the inner element.public ListWithStat.Node<E> convertToInnerType(E element)
TransformingListconvertToInnerType in class TransformingList<E,ListWithStat.Node<E>>element - the outer element.public Simulator simulator()
public void setSimulator(Simulator sim)
sim - the simulator of this listpublic void clear()
clear in interface java.util.Collection<E>clear in interface java.util.List<E>clear in class TransformingList<E,ListWithStat.Node<E>>public void add(int index,
E obj)
add in interface java.util.List<E>add in class TransformingList<E,ListWithStat.Node<E>>public E remove(int index)
remove in interface java.util.List<E>remove in class TransformingList<E,ListWithStat.Node<E>>public java.util.Iterator<E> iterator()
iterator in interface java.lang.Iterable<E>iterator in interface java.util.Collection<E>iterator in interface java.util.List<E>iterator in class TransformingList<E,ListWithStat.Node<E>>public java.util.ListIterator<E> listIterator()
listIterator in interface java.util.List<E>listIterator in class TransformingList<E,ListWithStat.Node<E>>public java.util.ListIterator<E> listIterator(int index)
listIterator in interface java.util.List<E>listIterator in class TransformingList<E,ListWithStat.Node<E>>public E set(int index, E element)
set in interface java.util.List<E>set in class TransformingList<E,ListWithStat.Node<E>>public boolean getStatCollecting()
public void setStatCollecting(boolean b)
Accumulate, measures the evolution
of the size of the list as a function of time.
It can be accessed by the method statSize.
The second one, of the class Tally and accessible via
statSojourn, samples the sojourn times in the list of the
objects removed during the observation period,
i.e., between the last initialization time of this statistical
probe and the current time.
The method automatically calls initStat to
initialize these two probes.
When this method is used, it is normally invoked immediately after
calling the constructor of the list.java.lang.IllegalStateException - if the statistical collection
is in the same state as the caller requirespublic void initStat()
setStatCollecting (true) and makes an update for the
probe on the list size.java.lang.IllegalStateException - if the statistical collection is disabledpublic double getInitTime()
initStat was called.initStat was calledpublic Accumulate statSize()
setStatCollecting (true)
has been called for this list.public Tally statSojourn()
setStatCollecting (true) has been called for this list.public java.lang.String report()
setStatCollecting (true) has been
called before for this list.
Even If setStatCollecting was called with false
afterward, the report will be made for
the collected observations.
If the probes do not exist, i.e., setStatCollecting was never called
for this object, an illegal state exception will be thrown.java.lang.IllegalStateException - if no statistical probes existpublic java.lang.String getName()
To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.