org.jscience.architecture.traffic.simulation.statistics
Class StatisticsModel

java.lang.Object
  extended by java.util.Observable
      extended by org.jscience.architecture.traffic.simulation.statistics.StatisticsModel

public class StatisticsModel
extends java.util.Observable

Class to maintain statistics as shown in extensions of StatisticsView.


Field Summary
protected  boolean allTimeAvg
          Determines whether to use all time averages or 'last averages'
protected  float allTimeJunctionWT
           
protected  float allTimeTripWT
           
protected  int cycle
           
protected  java.lang.String infraAuthor
           
protected  java.lang.String infraName
           
protected  int junctionCrossings
           
protected  int lastXJunctionCount
           
protected  float lastXJunctionWT
           
protected  int lastXTripCount
           
protected  float lastXTripWT
           
protected  SimModel model
          The SimModel to get the statistical data from.
protected  Node.NodeStatistics[][] nodeStats
           
protected  int numJunctions
           
protected  int numNodes
           
protected  int numSpecial
           
protected  int roadusersArrived
           
static java.lang.String SEP
          Separator used when saving data.
protected  java.lang.String simName
           
protected static int statNumData
          The length of the delay tables maintained in each Node.
 
Constructor Summary
StatisticsModel(SimModel _model)
          Creates a StatisticsModel.
 
Method Summary
 boolean getAllTimeAvg()
          Returns whether all time averages should be used or not.
 float getAllTimeJunctionWT()
           
 float getAllTimeTripWT()
           
 int getCycle()
           
 java.lang.String getInfraAuthor()
           
 java.lang.String getInfraName()
           
 int getJunctionCrossings()
           
 int getLastXJunctionCount()
           
 float getLastXJunctionWT()
           
 int getLastXTripCount()
           
 float getLastXTripWT()
           
 Node.NodeStatistics[][] getNodeStatistics()
           
 int getNumJunctions()
           
 int getNumNodes()
           
 int getNumSpecialNodes()
           
 int getRoadusersArrived()
           
 SimModel getSimModel()
          Returns the SimModel to be shown.
 java.lang.String getSimName()
           
 void refresh()
          Refresh the statistical data from the model and repaint.
protected  void saveData(java.lang.String filename)
          Save data to a CSV file.
 void setAllTimeAvg(boolean b)
          Sets whether all time averages should be used or not.
 void setSimModel(SimModel _model)
          Sets the SimModel to be used.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEP

public static java.lang.String SEP
Separator used when saving data.


statNumData

protected static final int statNumData
The length of the delay tables maintained in each Node.


allTimeAvg

protected boolean allTimeAvg
Determines whether to use all time averages or 'last averages'


model

protected SimModel model
The SimModel to get the statistical data from.


infraName

protected java.lang.String infraName

infraAuthor

protected java.lang.String infraAuthor

simName

protected java.lang.String simName

numNodes

protected int numNodes

numSpecial

protected int numSpecial

numJunctions

protected int numJunctions

cycle

protected int cycle

nodeStats

protected Node.NodeStatistics[][] nodeStats

allTimeTripWT

protected float allTimeTripWT

lastXTripWT

protected float lastXTripWT

allTimeJunctionWT

protected float allTimeJunctionWT

lastXJunctionWT

protected float lastXJunctionWT

roadusersArrived

protected int roadusersArrived

junctionCrossings

protected int junctionCrossings

lastXTripCount

protected int lastXTripCount

lastXJunctionCount

protected int lastXJunctionCount
Constructor Detail

StatisticsModel

public StatisticsModel(SimModel _model)
Creates a StatisticsModel.

Parameters:
_model - The SimModel statistics should be read from.
Method Detail

setSimModel

public void setSimModel(SimModel _model)
Sets the SimModel to be used.


getSimModel

public SimModel getSimModel()
Returns the SimModel to be shown.


setAllTimeAvg

public void setAllTimeAvg(boolean b)
Sets whether all time averages should be used or not.


getAllTimeAvg

public boolean getAllTimeAvg()
Returns whether all time averages should be used or not.


getInfraName

public java.lang.String getInfraName()

getInfraAuthor

public java.lang.String getInfraAuthor()

getSimName

public java.lang.String getSimName()

getNumNodes

public int getNumNodes()

getNumSpecialNodes

public int getNumSpecialNodes()

getNumJunctions

public int getNumJunctions()

getCycle

public int getCycle()

getNodeStatistics

public Node.NodeStatistics[][] getNodeStatistics()

getAllTimeTripWT

public float getAllTimeTripWT()

getLastXTripWT

public float getLastXTripWT()

getAllTimeJunctionWT

public float getAllTimeJunctionWT()

getLastXJunctionWT

public float getLastXJunctionWT()

getRoadusersArrived

public int getRoadusersArrived()

getJunctionCrossings

public int getJunctionCrossings()

getLastXTripCount

public int getLastXTripCount()

getLastXJunctionCount

public int getLastXJunctionCount()

refresh

public void refresh()
Refresh the statistical data from the model and repaint.


saveData

protected void saveData(java.lang.String filename)
                 throws java.io.IOException
Save data to a CSV file.

Throws:
java.io.IOException