edu.ucsb.nmsl.tools
Class StatisticsPackage

java.lang.Object
  extended by edu.ucsb.nmsl.tools.StatisticsPackage

public class StatisticsPackage
extends java.lang.Object

The responsibility of the StatisticsPackage is to keep the information collected during a specific running of AutoCap and allow access and print out that information as needed during research. The information collected by this class is for the purposes of research only and are not necessary for the normal operation of AutoCap.

The Statistics class works by keeping a map of Statistic instances. This relationship names each statistic and allows for access to the information based on the name give when a Statistics instance is storeed. Also, the name is used when the StatisticsPackage is converted to a string. Each statistic's value is printed out along with the name used to store it in the map.

Version:
1.0

Field Summary
protected  java.util.HashMap Statistics
          The container that maps each Statistics object with its name.
 
Constructor Summary
StatisticsPackage()
          This default constructor creates a default instance of the class.
StatisticsPackage(java.util.Collection stats)
          This contructor creates an instance of the StatisticsPackage and fills in the map with each element of the Container instance passed to the constructor.
 
Method Summary
 void add(BaseStatistic o)
          This function adds a BaseStatistic object to the map and expands the information stored in the package.
 BaseStatistic getStatistic(java.lang.String name)
          This accessor method allows the retrieval of individual BaseStatistics instances from the package.
 java.util.Iterator iterator()
          This method allows the user to iterator through each BaseStatistic instance in the package.
 java.util.ListIterator listIterator(int idx)
          This method allows the user to iterator through each BaseStatistic instance in the package.
 void remove(BaseStatistic o)
          This function removes a BaseStatistic object from the map and contracts the information stored in the package.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Statistics

protected java.util.HashMap Statistics
The container that maps each Statistics object with its name. Each element of this container is a Statistics object and makes up the StatisticsPackage

Constructor Detail

StatisticsPackage

public StatisticsPackage()
This default constructor creates a default instance of the class.


StatisticsPackage

public StatisticsPackage(java.util.Collection stats)
                  throws java.lang.ClassCastException
This contructor creates an instance of the StatisticsPackage and fills in the map with each element of the Container instance passed to the constructor. Each object is assumbed to be a child of the BaseStatistics class and the name associated with the statistic is used to store it in the map.

Parameters:
stats - - A collection of BaseStatistics objects that make up the StatisticsPackage
Throws:
java.lang.ClassCastException
Method Detail

add

public void add(BaseStatistic o)
This function adds a BaseStatistic object to the map and expands the information stored in the package.

Parameters:
o - - The BaseStatistic instance that is being added to the package.

remove

public void remove(BaseStatistic o)
This function removes a BaseStatistic object from the map and contracts the information stored in the package.

Parameters:
o - - The BaseStatistic instance that is being removed from the package.

getStatistic

public BaseStatistic getStatistic(java.lang.String name)
This accessor method allows the retrieval of individual BaseStatistics instances from the package.

Parameters:
name - - The name of the BaseStatistic stored in the package.
Returns:
The instance of BaseStatistic associated with the string "name".

iterator

public java.util.Iterator iterator()
This method allows the user to iterator through each BaseStatistic instance in the package.

Returns:
An Iterator instance that allows for sequential access to each BaseStatistic within the package.

listIterator

public java.util.ListIterator listIterator(int idx)
This method allows the user to iterator through each BaseStatistic instance in the package. It also allows for bidirectional access to each element.

Returns:
An Iterator instance that allows for sequential access to each BaseStatistic within the package.