GridSim 5.0 beta

gridsim
Class Accumulator

Object
  extended by Accumulator

public class Accumulator
extends Object

GridSim Accumulator provides a placeholder for maintaining statistical values of a series of data added to it. It can be queried for mean, min, max, sum, square mean, standard deviation, and the largest and smallest values in the data series.

Since:
GridSim Toolkit 1.0
Author:
Manzur Murshed and Rajkumar Buyya
Invariant:
$none

Constructor Summary
Accumulator()
          Allocates a new Accumulator object
 
Method Summary
 void add(double item)
          An overloaded method
 void add(double item, int times)
          Adds an item to the Accumulator
static int getByteSize()
          Determines the size of Accumulator object
 int getCount()
          Counts the number of items accumulated so far
 double getLast()
          Finds the last accumulated item
 double getMax()
          Finds the largest number of accumulated items
 double getMean()
          Calculates the mean of accumulated items
 double getMin()
          Finds the smallest number of accumulated items
 double getStandardDeviation()
          Calculates the standard deviation of accumulated items
 double getSum()
          Calculates the sum of accumulated items
 double getVariance()
          Calculates the variance of accumulated items
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Accumulator

public Accumulator()
Allocates a new Accumulator object

Pre Condition:
$none
Post Condition:
$none
Method Detail

add

public void add(double item,
                int times)
Adds an item to the Accumulator

Parameters:
item - an item to be added to the Accumulator
times - number of time the item value is repeated
Pre Condition:
times > 0
Post Condition:
$none

add

public void add(double item)
An overloaded method

Parameters:
item - an item to be added to the accumulator
Pre Condition:
$none
Post Condition:
$none

getMean

public double getMean()
Calculates the mean of accumulated items

Returns:
the mean of accumalated items
Pre Condition:
$none
Post Condition:
$none

getStandardDeviation

public double getStandardDeviation()
Calculates the standard deviation of accumulated items

Returns:
the Standard Deviation of accumulated items
Pre Condition:
$none
Post Condition:
$none

getVariance

public double getVariance()
Calculates the variance of accumulated items

Returns:
the Standard Deviation of accumulated items
Pre Condition:
$none
Post Condition:
$none

getMin

public double getMin()
Finds the smallest number of accumulated items

Returns:
the smallest of accumulated items
Pre Condition:
$none
Post Condition:
$none

getMax

public double getMax()
Finds the largest number of accumulated items

Returns:
the largest of accumulated items
Pre Condition:
$none
Post Condition:
$none

getLast

public double getLast()
Finds the last accumulated item

Returns:
the last accumulated item
Pre Condition:
$none
Post Condition:
$none

getCount

public int getCount()
Counts the number of items accumulated so far

Returns:
the number of items accumulated so far
Pre Condition:
$none
Post Condition:
$result >= 0

getSum

public double getSum()
Calculates the sum of accumulated items

Returns:
the sum of accumulated items
Pre Condition:
$none
Post Condition:
$none

getByteSize

public static int getByteSize()
Determines the size of Accumulator object

Returns:
the size of this object
Pre Condition:
$none
Post Condition:
$result > 0

GridSim 5.0 beta

The University of Melbourne, Australia, 2009