haifa.shopsim.lab
Class StatisticsCollector

java.lang.Object
  |
  +--haifa.shopsim.lab.StatisticsCollector
All Implemented Interfaces:
java.util.EventListener, ShopChangeListener
Direct Known Subclasses:
RichStatisticsCollector

public class StatisticsCollector
extends java.lang.Object
implements ShopChangeListener


Field Summary
protected  ShopStatistics finishedStatistics
          The statistics that have been completed by the last run.
protected  boolean[] lastEventWasWillingRest
          An array of booleans that has true for each machine is the last event was a willing rest time.
protected  double[] lastTimes
          An array of time objects saying when the machine last had a started or finished event.
protected  ShopData shopData
          A refrence to the shopdata object.
protected  ShopState shopState
          A reference to the shopstate object.
protected  ShopStatistics shopStatistics
          The current shop statistics being collected.
 
Constructor Summary
StatisticsCollector(ShopData shopData_, ShopState shopState_)
          Creates new StatisticsCollector
 
Method Summary
 ShopStatistics getStats()
          Returns the statistics object collected by the last run.
 void shopChanged(ShopChangeEvent sce)
          Called by the simulation whenever a shop change event takes place.
 java.lang.String toString()
          Returns the string of the last shopStatistics object.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

shopStatistics

protected ShopStatistics shopStatistics
The current shop statistics being collected.

finishedStatistics

protected ShopStatistics finishedStatistics
The statistics that have been completed by the last run.

shopData

protected ShopData shopData
A refrence to the shopdata object.

shopState

protected ShopState shopState
A reference to the shopstate object.

lastTimes

protected double[] lastTimes
An array of time objects saying when the machine last had a started or finished event.

lastEventWasWillingRest

protected boolean[] lastEventWasWillingRest
An array of booleans that has true for each machine is the last event was a willing rest time.
Constructor Detail

StatisticsCollector

public StatisticsCollector(ShopData shopData_,
                           ShopState shopState_)
Creates new StatisticsCollector
Method Detail

shopChanged

public void shopChanged(ShopChangeEvent sce)
Called by the simulation whenever a shop change event takes place. Updates the statistics object that is being created accordingly.
Specified by:
shopChanged in interface ShopChangeListener

getStats

public ShopStatistics getStats()
Returns the statistics object collected by the last run. Returns null if the statistics aren't complete yet.

toString

public java.lang.String toString()
Returns the string of the last shopStatistics object.
Overrides:
toString in class java.lang.Object