visidia.stats
Class Statistics

java.lang.Object
  extended by visidia.stats.Statistics

public class Statistics
extends java.lang.Object

This class consists in a collection of objects associated with their occurrence.


Constructor Summary
Statistics()
          Instantiates a new statistics.
 
Method Summary
 void add(java.lang.Object o)
          Increments the current value of the Bag corresponding to the object 'o'.
 void add(java.lang.Object o, long occurrences)
          Add the current value of the Bag corresponding to the object 'o' with the value 'occurrences'.
 void addStatListener(StatListener listener)
          Adds a stat listener.
 java.util.Hashtable<java.lang.Object,java.lang.Long> asHashTable()
          As hash table.
 long getOccurrencesOf(java.lang.Object o)
          Gets the occurrences of object.
 StatListener[] getStatListeners()
          Gets the stat listeners.
 java.util.Set<java.lang.Object> keySet()
          Key set.
 void max(java.lang.Object o, long occurrences)
          Compare the current value of the Bag corresponding to the object 'o' with the value 'occurrences' and replace the value of the Bag with the maximum of both values.
 void min(java.lang.Object o, long occurrences)
          Compare the current value of the Bag corresponding to the object 'o' with the value 'occurrences' and replace the value of the Bag with the minimum of both values.
 void removeStatListener(StatListener listener)
          Removes a stat listener.
 void replace(java.lang.Object o, long occurrences)
          Replace the current value of the Bag corresponding to the object 'o' with the value 'occurrences'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Statistics

public Statistics()
Instantiates a new statistics.

Method Detail

getOccurrencesOf

public long getOccurrencesOf(java.lang.Object o)
Gets the occurrences of object.

Parameters:
o - the object
Returns:
the occurrences of

add

public void add(java.lang.Object o,
                long occurrences)
Add the current value of the Bag corresponding to the object 'o' with the value 'occurrences'.

Parameters:
o - the object
occurrences - the occurrences

add

public void add(java.lang.Object o)
Increments the current value of the Bag corresponding to the object 'o'. If there is no object, create one.

Parameters:
o - the object

min

public void min(java.lang.Object o,
                long occurrences)
Compare the current value of the Bag corresponding to the object 'o' with the value 'occurrences' and replace the value of the Bag with the minimum of both values.

Parameters:
o - the object
occurrences - the occurrences

max

public void max(java.lang.Object o,
                long occurrences)
Compare the current value of the Bag corresponding to the object 'o' with the value 'occurrences' and replace the value of the Bag with the maximum of both values.

Parameters:
o - the object
occurrences - the occurrences

replace

public void replace(java.lang.Object o,
                    long occurrences)
Replace the current value of the Bag corresponding to the object 'o' with the value 'occurrences'.

Parameters:
o - the object
occurrences - the occurrences

asHashTable

public java.util.Hashtable<java.lang.Object,java.lang.Long> asHashTable()
As hash table.

Returns:
the hashtable< object, long>

keySet

public java.util.Set<java.lang.Object> keySet()
Key set.

Returns:
the set< object>

addStatListener

public void addStatListener(StatListener listener)
Adds a stat listener.

Parameters:
listener - the listener

removeStatListener

public void removeStatListener(StatListener listener)
Removes a stat listener.

Parameters:
listener - the listener

getStatListeners

public StatListener[] getStatListeners()
Gets the stat listeners.

Returns:
the stat listeners