SimJava
v2.0

eduni.simjava
Class Sim_accum

java.lang.Object
  |
  +--eduni.simjava.Sim_accum

public class Sim_accum
extends java.lang.Object

A class for collecting basic statistical data during simulations.

This class can be used to manually calculate measurements of interest for state-based, non-continuous measures (see the SimJava Tutorial for details). This is a primitive class that is still present in the API for compatibility with existing simulations. Simulations written with the SimJava version 2.0 should make use of Sim_stat instances for their entities if statistics are required.

See Also:
Sim_stat

Constructor Summary
Sim_accum()
          Allocate a new instance of the class.
 
Method Summary
 double avg()
          Calculates the average value held over the total interval recorded.
 double interval_sum()
          Sums all the intervals recorded so far.
 double max()
          Find the maximum value recorded so far
 double min()
          Find the minimum value recorded so far
 void update(double interval, double value)
          Add a new record to the statistics collected so far.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sim_accum

public Sim_accum()
Allocate a new instance of the class.
Method Detail

update

public void update(double interval,
                   double value)
Add a new record to the statistics collected so far.
Parameters:
interval - How long the value was held
value - The value to record

min

public double min()
Find the minimum value recorded so far
Returns:
The minimum value recorded so far or 0.0 if no values have been recorded

max

public double max()
Find the maximum value recorded so far
Returns:
The maximum value recorded so far or 0.0 if no values have been recorded

avg

public double avg()
Calculates the average value held over the total interval recorded. i.e. Sum_for_all_i(value[i]*interval[i])/total_interval
Returns:
The average value

interval_sum

public double interval_sum()
Sums all the intervals recorded so far.
Returns:
The sum of the intervals

SimJava
v2.0

The University of Edinburgh, 2002