Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

desmoj
Class QueueBased  view QueueBased download QueueBased.java

java.lang.Object
  extended bydesmoj.NamedObject
      extended bydesmoj.ModelComponent
          extended bydesmoj.Reportable
              extended bydesmoj.QueueBased
Direct Known Subclasses:
Bin, CondQueue, Entrepot, ProcessQueue, Queue, Res, Stock, WaitQueue, WorkStation

public abstract class QueueBased
extends Reportable

Provides the typical statistics common to all ModelComponents based on Queues. It is set abstract to prevent users to use it straight without deriving a class first because it only provides the functionality for statistical data extraction, not the functionality for actually queueing Entities. The statistical values provided are the queue's length and its elements' waiting times with minimum, maximum, mean and standard deviation for each. This class should be used when any type of ModelComponent using Queues is created. In combination with class QueueList an automatic insert/remove mechanism including search functionality with condition checking can be set up within a few lines of code. It also provides full automatic statistical data about the Queue used.

Version:
DESMO-J, Ver. 1.5 copyright (c) 2001 licensed under GNU GPL

Field Summary
private  int currentLength
          Displays the current number of objects waiting inside the queue.
static int FIFO
          Defining a constant for the service discipline of the underlying queue.
private  SimTime lastAcc
          The point in simulation time the queue was last accessed.
static int LIFO
          Defining a constant for the service discipline of the underlying queue.
private  int maximumLength
          Displays the maximum number of objects that have been waiting inside the queue since the last reset.
private  SimTime maximumLengthAt
          The point in simulation time the queue's maximum length was recorded.
private  SimTime maximumWaitTime
          The maximum time an object inside the queue spent waiting.
private  SimTime maximumWaitTimeAt
          The point in simulation time the maximum waiting time of an object inside the queue was recorded at.
private  int minimumLength
          Displays the minimum number of objects that have been waiting inside the queue since the last reset.
private  SimTime minimumLengthAt
          The point in simulation time the queue's minimum length was recorded.
private  boolean qImpWarnings
          Flag for letting the underlying queue implementation (QueueList) show own warnings (true) or suppressing them (false).
protected  java.lang.Class[] queueingStrategy
          An array representing the possible queueing strategies as implemented in the QueueListFifo and QueueListLifo classes.
protected  int queueLimit
          Represents the maximum number of entities in the queue (default is unlimited capacity).
private  SimTime sumSquareWaitTime
          The square of the sums of the waiting times spent by all objects that have passed through the queue.
private  SimTime sumWaitTime
          The sum of the waiting times spent by all objects that have passed through the queue.
static double UNDEFINED
          Represents the value returned if for a given statistics no valid value can be returned.
private  double wSumLength
          Displays the sum of the queue length weighted over the time each object spent waiting in the queue.
private  double wSumSquareLength
          Displays the squares of the sums of the queue length weighted over the time each object spent waiting in the queue.
private  long zeros
          Displays the number of objects that have passed the queue without waiting time.
 
Fields inherited from class desmoj.Reportable
 
Fields inherited from class desmoj.ModelComponent
 
Fields inherited from class desmoj.NamedObject
 
Constructor Summary
QueueBased(Model owner, java.lang.String name, boolean showInReport, boolean showInTrace)
          Creates a queuebased object and initializes all statistical counters.
 
Method Summary
protected  void addItem()
          Updates the statistics when a new element is inserted into the underlying queue.
 double averageLength()
          Returns the average length of the underlying queue since the last reset.
 SimTime averageWaitTime()
          Returns the average waiting time of all objects who have exited the queue.
abstract  desmoj.report.Reporter createReporter()
          Creates the reporter qualified to produce a report about a class that has been derived from queuebased.
protected  void deleteItem(SimTime entryTime)
          Updates the statistics when a new element is exiting the underlying queue.
 int getQueueLimit()
          Returns the maximum possible number of entities in the underlying queue.
 int length()
          Returns the current length of the underlying queue.
 int maxLength()
          Returns the maximum length of the underlying queue since the last reset.
 SimTime maxLengthAt()
          Returns the point of simulation time with the maximum number of objects waiting inside the underlying queue.
 SimTime maxWaitTime()
          Returns the maximum duration in simulation time that an object has spent waiting inside the underlying queue.
 SimTime maxWaitTimeAt()
          Returns the point of simulation time when the object with the maximum waiting time exited the underlying queue.
 int minLength()
          Returns the minimumn length of the underlying queue since the last reset.
 SimTime minLengthAt()
          Returns the point of simulation time with the minimum number of objects waiting inside the underlying queue.
(package private)  boolean qImpWarn()
          Returns a boolean flag telling if the underlying queue implementation should issue own warnings or not.
 void reset()
          Resets all statistical counters to their default values.
 void setQueueImpWarning(boolean warnFlag)
          Method switches on warnings issued from the underlying queue implementation if parameter given is true.
 double stdDevLength()
          Returns the standard deviation of the queue's length.
 SimTime stdDevWaitTime()
          Returns the standard deviation of the queue's objects waiting times.
protected  void updateStatistics()
          Updates the parts of the statistics used by both addItem and deleteItem.
 long zeroWaits()
          Returns the number of objects that have passed through the queue without spending time waiting.
 
Methods inherited from class desmoj.Reportable
getObservations, incrementObservations, incrementObservations, reportIsOn, reportOff, reportOn, resetAt
 
Methods inherited from class desmoj.ModelComponent
current, currentEntity, currentEvent, currentModel, currentSimProcess, currentTime, debugIsOn, debugOff, debugOn, epsilon, getModel, isExperimentCompatible, isModelCompatible, sendDebugNote, sendMessage, sendTraceNote, sendWarning, setOwner, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOn
 
Methods inherited from class desmoj.NamedObject
getName, getQuotedName, rename, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEFINED

public static final double UNDEFINED
Represents the value returned if for a given statistics no valid value can be returned.

See Also:
Constant Field Values

currentLength

private int currentLength
Displays the current number of objects waiting inside the queue.


qImpWarnings

private boolean qImpWarnings
Flag for letting the underlying queue implementation (QueueList) show own warnings (true) or suppressing them (false). Is false by default but can be set to true for debugging purposes


minimumLength

private int minimumLength
Displays the minimum number of objects that have been waiting inside the queue since the last reset.


maximumLength

private int maximumLength
Displays the maximum number of objects that have been waiting inside the queue since the last reset.


zeros

private long zeros
Displays the number of objects that have passed the queue without waiting time. Thus the name "zeros" for zero waiting time. Value is valid for the span of time since the last reset.


wSumLength

private double wSumLength
Displays the sum of the queue length weighted over the time each object spent waiting in the queue. Value is valid for the span of time since the last reset.


wSumSquareLength

private double wSumSquareLength
Displays the squares of the sums of the queue length weighted over the time each object spent waiting in the queue. Value is valid for the span of time since the last reset.


lastAcc

private SimTime lastAcc
The point in simulation time the queue was last accessed. Value is valid for the span of time since the last reset.


minimumLengthAt

private SimTime minimumLengthAt
The point in simulation time the queue's minimum length was recorded. Value is valid for the span of time since the last reset.


maximumLengthAt

private SimTime maximumLengthAt
The point in simulation time the queue's maximum length was recorded. Value is valid for the span of time since the last reset.


maximumWaitTime

private SimTime maximumWaitTime
The maximum time an object inside the queue spent waiting. Value is valid for the span of time since the last reset.


maximumWaitTimeAt

private SimTime maximumWaitTimeAt
The point in simulation time the maximum waiting time of an object inside the queue was recorded at. Value is valid for the span of time since the last reset.


sumWaitTime

private SimTime sumWaitTime
The sum of the waiting times spent by all objects that have passed through the queue. Value is valid for the span of time since the last reset.


sumSquareWaitTime

private SimTime sumSquareWaitTime
The square of the sums of the waiting times spent by all objects that have passed through the queue. Value is valid for the span of time since the last reset.


FIFO

public static final int FIFO
Defining a constant for the service discipline of the underlying queue. FIFO = First In First Out.

See Also:
Constant Field Values

LIFO

public static final int LIFO
Defining a constant for the service discipline of the underlying queue. LIFO = Last In First Out.

See Also:
Constant Field Values

queueLimit

protected int queueLimit
Represents the maximum number of entities in the queue (default is unlimited capacity).


queueingStrategy

protected java.lang.Class[] queueingStrategy
An array representing the possible queueing strategies as implemented in the QueueListFifo and QueueListLifo classes. If new queueing strategies are added later on, they must be declared here also.

Constructor Detail

QueueBased

public QueueBased(Model owner,
                  java.lang.String name,
                  boolean showInReport,
                  boolean showInTrace)
Creates a queuebased object and initializes all statistical counters. If this standard constructor is used a queue with Fifo sort order and no limited capacity will be created.

Method Detail

addItem

protected void addItem()
Updates the statistics when a new element is inserted into the underlying queue. Note that this method must always be called whenever an insertion is made. If class QueueList is used in combination with a queuebased, this method gets called automatically whenever a new entity is inserted.


averageLength

public double averageLength()
Returns the average length of the underlying queue since the last reset. Current length of that queue will be returned, if the time span since the last reset is smaller than the smallest distinguishable timespan epsilon.


averageWaitTime

public SimTime averageWaitTime()
Returns the average waiting time of all objects who have exited the queue. Value is valid for the time span since the last reset. Returns 0 (zero) if no objects have exited the queue after the last reset.


createReporter

public abstract desmoj.report.Reporter createReporter()
Creates the reporter qualified to produce a report about a class that has been derived from queuebased. This method is declared abstract since no real queuebased is supposed to be instantiated and thus no rReporter can be defined here. Implement this method in the subclasses of queuebased such as in class Queue.

Overrides:
createReporter in class Reportable

deleteItem

protected void deleteItem(SimTime entryTime)
Updates the statistics when a new element is exiting the underlying queue. Note that this method must always be called whenever an object is taken from the queue. The simulation time parameter given provides the statistics with the information about the point of time the exiting object had enterd this queue. This is needed to calculate the waiting times. If a queuebased is used in conjunction with class queuelist, this method is automatically called whenever an entity is taken from the queuelist to keep track of


getQueueLimit

public int getQueueLimit()
Returns the maximum possible number of entities in the underlying queue.


length

public int length()
Returns the current length of the underlying queue.


maxLength

public int maxLength()
Returns the maximum length of the underlying queue since the last reset.


maxLengthAt

public SimTime maxLengthAt()
Returns the point of simulation time with the maximum number of objects waiting inside the underlying queue. The value is valid for the period since the last reset.


maxWaitTime

public SimTime maxWaitTime()
Returns the maximum duration in simulation time that an object has spent waiting inside the underlying queue. The value is valid for the period since the last reset.


maxWaitTimeAt

public SimTime maxWaitTimeAt()
Returns the point of simulation time when the object with the maximum waiting time exited the underlying queue. The value is valid for the period since the last reset.


minLength

public int minLength()
Returns the minimumn length of the underlying queue since the last reset.


minLengthAt

public SimTime minLengthAt()
Returns the point of simulation time with the minimum number of objects waiting inside the underlying queue. The value is valid for the period since the last reset.


qImpWarn

boolean qImpWarn()
Returns a boolean flag telling if the underlying queue implementation should issue own warnings or not. The warnings from the queue implementation (QueueList) are needed for debugging purposes.


reset

public void reset()
Resets all statistical counters to their default values. The mininum and maximum length of the queue are set to the current number of queued objects.

Overrides:
reset in class Reportable

setQueueImpWarning

public void setQueueImpWarning(boolean warnFlag)
Method switches on warnings issued from the underlying queue implementation if parameter given is true. Warnings are suppressed if false is given. This method is used for internal debugging only.


stdDevLength

public double stdDevLength()
Returns the standard deviation of the queue's length. Value is weighted over time.


stdDevWaitTime

public SimTime stdDevWaitTime()
Returns the standard deviation of the queue's objects waiting times.


updateStatistics

protected void updateStatistics()
Updates the parts of the statistics used by both addItem and deleteItem.


zeroWaits

public long zeroWaits()
Returns the number of objects that have passed through the queue without spending time waiting.