com.atlassian.jira.project.statistics
Class StatisticCollection

java.lang.Object
  |
  +--com.atlassian.jira.project.statistics.StatisticCollection

public class StatisticCollection
extends java.lang.Object

This class is a collection of Statistic objects for a specific StatisticType


Constructor Summary
StatisticCollection(StatisticType type)
          Constructor to build a StatisticCollection object
 
Method Summary
 void addStatistic(Statistic statistic)
          Adds the Statistic to the list of values of the StatisticCollection
 boolean equals(java.lang.Object o)
           
 Statistic getStatistic(java.lang.String key)
          Gets a particlular Statistic from the list by key
 java.util.List getStatistics()
          Returns a list of Statistic objects contained in the current StatisticCollection object
 StatisticType getType()
          Returns the StatisticType for this class
 int hashCode()
           
 void merge(StatisticCollection stats)
          Adds each of the Statistic objects in the passed in StatisticCollection object to the current StatisticCollection object and sorts the statistics.
 void removeStatistic(Statistic statistic)
          Removes a Statistic from the StatisticCollection
 int size()
           
 void sort()
          This method will sort this StatisticCollection according to the comparator of the current StatisticType.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StatisticCollection

public StatisticCollection(StatisticType type)
Constructor to build a StatisticCollection object

Method Detail

addStatistic

public void addStatistic(Statistic statistic)
Adds the Statistic to the list of values of the StatisticCollection

It loops through all the Statistic objects in the current list and if the Statistic passed in does not match on that is already there then it is added to the list.

If the Statistic passed in does match one that is already there in the list then it is merged

See Also:
merge(StatisticCollection)

size

public int size()

getStatistics

public java.util.List getStatistics()
Returns a list of Statistic objects contained in the current StatisticCollection object


sort

public void sort()
This method will sort this StatisticCollection according to the comparator of the current StatisticType.


merge

public void merge(StatisticCollection stats)
Adds each of the Statistic objects in the passed in StatisticCollection object to the current StatisticCollection object and sorts the statistics.

The two StatisticCollection objects must be of the same StatisticType. The passed in StatisticCollection will not be altered.

Throws:
java.lang.IllegalArgumentException - if the passed in statistic collection has a different statistic type.

getType

public StatisticType getType()
Returns the StatisticType for this class


getStatistic

public Statistic getStatistic(java.lang.String key)
Gets a particlular Statistic from the list by key

If the Statistic doesnt exist then null is returned


removeStatistic

public void removeStatistic(Statistic statistic)
Removes a Statistic from the StatisticCollection


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2002-2003 Atlassian. All Rights Reserved.