gov.sandia.cognition.math
Class NumberAverager

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.math.NumberAverager
All Implemented Interfaces:
CloneableSerializable, Summarizer<Number,Double>, Serializable, Cloneable

@CodeReview(reviewer="Kevin R. Dixon",
            date="2008-02-26",
            changesNeeded=false,
            comments={"Made some of the javadoc more descriptive","Otherwise, looks good."})
public class NumberAverager
extends AbstractCloneableSerializable
implements Summarizer<Number,Double>

Returns an average (arithmetic mean) of a collection of Numbers

Since:
2.0
Author:
Kevin R. Dixon
See Also:
Serialized Form

Field Summary
static NumberAverager INSTANCE
          Instance of NumberAverager, since it has no state.
 
Constructor Summary
NumberAverager()
          Creates a new instance of NumberAverager
 
Method Summary
 Double summarize(Collection<? extends Number> data)
          Returns the average (arithmetic mean) of a Collection of Numbers, or null if the collection of Numbers are null
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final NumberAverager INSTANCE
Instance of NumberAverager, since it has no state.

Constructor Detail

NumberAverager

public NumberAverager()
Creates a new instance of NumberAverager

Method Detail

summarize

public Double summarize(Collection<? extends Number> data)
Returns the average (arithmetic mean) of a Collection of Numbers, or null if the collection of Numbers are null

Specified by:
summarize in interface Summarizer<Number,Double>
Parameters:
data - Collection of Number to compute the average of
Returns:
Average (arithmetic mean) of the data, null if no Numbers are given