Documentation of 'umontreal.iro.lecuyer.stat.list.ListOfStatProbes' Java class
ListOfStatProbes
umontreal.iro.lecuyer.stat.list

Class ListOfStatProbes<E extends StatProbe>

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.RandomAccess
    Direct Known Subclasses:
    ListOfTallies


    public class ListOfStatProbes<E extends StatProbe>
    extends java.lang.Object
    implements java.lang.Cloneable, java.util.List<E>, java.util.RandomAccess
    Represents a list of statistical probes that can be managed simultaneously. Each element of this list is a 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 Summary

      Constructors 
      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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      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) 
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.List

        replaceAll, sort, spliterator
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Constructor Detail

      • ListOfStatProbes

        public ListOfStatProbes()
        Constructs an empty list of statistical probes.
      • ListOfStatProbes

        public ListOfStatProbes(java.lang.String name)
        Constructs an empty list of statistical probes with name name.
        Parameters:
        name - the name of the new list.
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns the global name of this list of statistical probes.
        Returns:
        the global name of the list.
      • setName

        public void setName(java.lang.String name)
        Sets the global name of this list to name.
        Parameters:
        name - the new global name of the list.
      • isModifiable

        public 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.
      • setUnmodifiable

        public 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.
      • init

        public void init()
        Initializes this list of statistical probes by calling init on each element.
      • sum

        public void sum(double[] s)
        For each probe in the list, computes the sum by calling 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.
        Parameters:
        s - the array to be filled with sums.
        Throws:
        java.lang.NullPointerException - if s is null.
        java.lang.IllegalArgumentException - if s.length does not correspond to size.
      • average

        public void average(double[] a)
        For each probe in this list, computes the average by calling 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.
        Parameters:
        a - the array to be filled with averages.
        Throws:
        java.lang.NullPointerException - if a is null.
        java.lang.IllegalArgumentException - if a.length does not correspond to size.
      • isCollecting

        public 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.
        Returns:
        the status of statistical collecting.
      • setCollecting

        public 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.
        Parameters:
        c - the status of statistical collecting.
      • isBroadcasting

        public boolean isBroadcasting()
        Determines if this list of statistical probes is broadcasting observations to registered observers. The default is false.
        Returns:
        the status of broadcasting.
      • setBroadcasting

        public 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.
        Parameters:
        b - the status of broadcasting.
      • addArrayOfObservationListener

        public void addArrayOfObservationListener(ArrayOfObservationListener l)
        Adds the observation listener l to the list of observers of this list of statistical probes.
        Parameters:
        l - the new observation listener.
        Throws:
        java.lang.NullPointerException - if l is null.
      • removeArrayOfObservationListener

        public void removeArrayOfObservationListener(ArrayOfObservationListener l)
        Removes the observation listener l from the list of observers of this list of statistical probes.
        Parameters:
        l - the observation listener to be deleted.
      • clearArrayOfObservationListeners

        public void clearArrayOfObservationListeners()
        Removes all observation listeners from the list of observers of this list of statistical probes.
      • notifyListeners

        public void notifyListeners(double[] x)
        Notifies the observation x to all registered observers if broadcasting is ON. Otherwise, does nothing.
      • report

        public java.lang.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).
        Returns:
        the report formatted as a string.
      • clone

        public 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.
        Overrides:
        clone in class java.lang.Object
      • add

        public boolean add(E o)
        Specified by:
        add in interface java.util.Collection<E extends StatProbe>
        Specified by:
        add in interface java.util.List<E extends StatProbe>
      • add

        public void add(int index,
                        E o)
        Specified by:
        add in interface java.util.List<E extends StatProbe>
      • addAll

        public boolean addAll(java.util.Collection<? extends E> c)
        Specified by:
        addAll in interface java.util.Collection<E extends StatProbe>
        Specified by:
        addAll in interface java.util.List<E extends StatProbe>
      • addAll

        public boolean addAll(int index,
                              java.util.Collection<? extends E> c)
        Specified by:
        addAll in interface java.util.List<E extends StatProbe>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<E extends StatProbe>
        Specified by:
        clear in interface java.util.List<E extends StatProbe>
      • contains

        public boolean contains(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<E extends StatProbe>
        Specified by:
        contains in interface java.util.List<E extends StatProbe>
      • containsAll

        public boolean containsAll(java.util.Collection<?> c)
        Specified by:
        containsAll in interface java.util.Collection<E extends StatProbe>
        Specified by:
        containsAll in interface java.util.List<E extends StatProbe>
      • equals

        public boolean equals(java.lang.Object o)
        Specified by:
        equals in interface java.util.Collection<E extends StatProbe>
        Specified by:
        equals in interface java.util.List<E extends StatProbe>
        Overrides:
        equals in class java.lang.Object
      • get

        public E get(int index)
        Specified by:
        get in interface java.util.List<E extends StatProbe>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<E extends StatProbe>
        Specified by:
        hashCode in interface java.util.List<E extends StatProbe>
        Overrides:
        hashCode in class java.lang.Object
      • indexOf

        public int indexOf(java.lang.Object o)
        Specified by:
        indexOf in interface java.util.List<E extends StatProbe>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<E extends StatProbe>
        Specified by:
        isEmpty in interface java.util.List<E extends StatProbe>
      • iterator

        public java.util.Iterator<E> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<E extends StatProbe>
        Specified by:
        iterator in interface java.util.Collection<E extends StatProbe>
        Specified by:
        iterator in interface java.util.List<E extends StatProbe>
      • lastIndexOf

        public int lastIndexOf(java.lang.Object o)
        Specified by:
        lastIndexOf in interface java.util.List<E extends StatProbe>
      • listIterator

        public java.util.ListIterator<E> listIterator()
        Specified by:
        listIterator in interface java.util.List<E extends StatProbe>
      • listIterator

        public java.util.ListIterator<E> listIterator(int index)
        Specified by:
        listIterator in interface java.util.List<E extends StatProbe>
      • remove

        public E remove(int index)
        Specified by:
        remove in interface java.util.List<E extends StatProbe>
      • remove

        public boolean remove(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<E extends StatProbe>
        Specified by:
        remove in interface java.util.List<E extends StatProbe>
      • removeAll

        public boolean removeAll(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<E extends StatProbe>
        Specified by:
        removeAll in interface java.util.List<E extends StatProbe>
      • retainAll

        public boolean retainAll(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<E extends StatProbe>
        Specified by:
        retainAll in interface java.util.List<E extends StatProbe>
      • set

        public E set(int index,
                     E element)
        Specified by:
        set in interface java.util.List<E extends StatProbe>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<E extends StatProbe>
        Specified by:
        size in interface java.util.List<E extends StatProbe>
      • subList

        public java.util.List<E> subList(int fromIndex,
                                         int toIndex)
        Specified by:
        subList in interface java.util.List<E extends StatProbe>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<E extends StatProbe>
        Specified by:
        toArray in interface java.util.List<E extends StatProbe>
      • toArray

        public <T> T[] toArray(T[] a)
        Specified by:
        toArray in interface java.util.Collection<E extends StatProbe>
        Specified by:
        toArray in interface java.util.List<E extends StatProbe>

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.