br.usp.ime.klava.segmentit.util
Class Statistics<T>

java.lang.Object
  extended by br.usp.ime.klava.segmentit.util.Statistics<T>
Type Parameters:
T - the type of the elements in the collection

public class Statistics<T>
extends java.lang.Object

Holds a collection of T to calculate statistical data.

Author:
Bruno Klava

Constructor Summary
Statistics()
          Constructs an empty collection.
 
Method Summary
 void addSample(T sample)
          Adds sample to the current collection.
 T mode()
          Returns the mode of the current collection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Statistics

public Statistics()
Constructs an empty collection.

Method Detail

addSample

public void addSample(T sample)
Adds sample to the current collection.

Parameters:
sample - the sample to be added

mode

public T mode()
Returns the mode of the current collection.

Returns:
the mode of the current collection. If the collection is not unimodal, an arbitrary sample of maximum frequency is returned