CFEngine API

org.recommender.server
Class Stats

java.lang.Object
  |
  +--org.recommender.server.Stats

public class Stats
extends java.lang.Object

Calculates Mean or Standard Deviation for a set of numbers. To use this class, add each number of the set separately. Then call calcMean or calcSD.

Author:
Irwin Yoon

Constructor Summary
Stats()
          Default constructor.
 
Method Summary
 void addNum(float val)
          Adds the value to the existing set of numbers.
 float calcMean()
          Returns the mean for the numbers in the set.
 float calcSD()
          Returns the standard deviation for the numbers in the set.
 int size()
          Returns the number of numbers in the set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stats

public Stats()
Default constructor. Does nothing

Method Detail

addNum

public void addNum(float val)
Adds the value to the existing set of numbers.

Parameters:
val -

calcSD

public float calcSD()
Returns the standard deviation for the numbers in the set.

Returns:
SD

calcMean

public float calcMean()
Returns the mean for the numbers in the set.

Returns:
mean

size

public int size()
Returns the number of numbers in the set.

Returns:
num

CFEngine API

Copyright © 2003 - Oregon State University www.orst.edu