public abstract class QueueBased extends Reportable implements Subject<QueueBased,QueueBased.QueueAction>
QueueList
Modifier and Type | Class and Description |
---|---|
static class |
QueueBased.QueueAction
Enum to representing the actions of adding and removing an item to/from the queue.
|
Modifier and Type | Field and Description |
---|---|
static int |
FIFO
Defining a constant for the FIFO (First In First Out) service discipline of the underlying queue: An Entity inserted into the queue is removed
after all entities already enqueued with the same priority.
|
static int |
LIFO
Defining a constant for the LIFO (Last In First Out) service discipline of the underlying queue: An Entity inserted into the queue is removed
before all entities already enqueued with the same priority.
|
static int |
RANDOM
Defining a constant for the random service discipline of the underlying queue: An Entity inserted into the queue may be removed before or after
any other Entity with the same priority.
|
static double |
UNDEFINED
Represents the value returned if for a given statistics no valid value can be returned.
|
Constructor and Description |
---|
QueueBased(Model owner,
java.lang.String name,
boolean showInReport,
boolean showInTrace)
Creates a QueueBased object and initializes all statistical counters.
|
Modifier and Type | Method and Description |
---|---|
void |
addObserver(Observer<QueueBased,QueueBased.QueueAction> observer)
This method adds an observer to the subject
|
double |
averageLength()
Returns the average length of the underlying queue since the last reset.
|
TimeSpan |
averageWaitTime()
Returns the average waiting time of all objects who have exited the queue.
|
void |
deleteObserver(Observer<QueueBased,QueueBased.QueueAction> observer)
This method deletes an observer from the subject
|
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.
|
TimeInstant |
maxLengthAt()
Returns the point of simulation time with the maximum number of objects waiting inside the underlying queue.
|
TimeSpan |
maxWaitTime()
Returns the maximum duration in simulation time that an object has spent waiting inside the underlying queue.
|
TimeInstant |
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.
|
TimeInstant |
minLengthAt()
Returns the point of simulation time with the minimum number of objects waiting inside the underlying queue.
|
void |
notifyObservers(QueueBased subject,
QueueBased.QueueAction eventObject)
This method is used to notify the registerd observers
|
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.
|
TimeSpan |
stdDevWaitTime()
Returns the standard deviation of the queue's objects waiting times.
|
long |
zeroWaits()
Returns the number of objects that have passed through the queue without spending time waiting.
|
getCorrespondingSchedulable, getDescription, getObservations, getReporter, incrementObservations, incrementObservations, reportIsOn, reportOff, reportOn, resetAt, setCorrespondingSchedulable, setDescription, setReporter
current, currentEntity, currentEntityAll, currentEvent, currentModel, currentSimProcess, debugIsOn, debugOff, debugOn, getModel, isExperimentCompatible, isModelCompatible, presentTime, sendDebugNote, sendMessage, sendTraceNote, sendWarning, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOn
getName, getQuotedName, toString
public static final double UNDEFINED
public static final int FIFO
public static final int LIFO
public static final int RANDOM
public QueueBased(Model owner, java.lang.String name, boolean showInReport, boolean showInTrace)
owner
- desmoj.Model : The model it belongs toname
- java.lang.String : The name for this QueueBased objectshowInReport
- boolean : Flag if values are shown in reportshowInTrace
- boolean : Flag if QueueBased writes trace messagespublic void addObserver(Observer<QueueBased,QueueBased.QueueAction> observer)
Subject
addObserver
in interface Subject<QueueBased,QueueBased.QueueAction>
observer
- the observer which should be added to the subjectpublic double averageLength()
public TimeSpan averageWaitTime()
public void deleteObserver(Observer<QueueBased,QueueBased.QueueAction> observer)
Subject
deleteObserver
in interface Subject<QueueBased,QueueBased.QueueAction>
observer
- the observer which should be deletedpublic int getQueueLimit()
public int length()
public int maxLength()
public TimeInstant maxLengthAt()
public TimeSpan maxWaitTime()
public TimeInstant maxWaitTimeAt()
public int minLength()
public TimeInstant minLengthAt()
public void notifyObservers(QueueBased subject, QueueBased.QueueAction eventObject)
Subject
notifyObservers
in interface Subject<QueueBased,QueueBased.QueueAction>
subject
- reference to the actual subjecteventObject
- an eventtype to distinguish different notification types like itemAdded or itemRemovedpublic void reset()
reset
in class Reportable
public void setQueueImpWarning(boolean warnFlag)
true
. Warnings are suppressed if
false
is given. This method is used for internal debugging only.warnFlag
- boolean :true
switches warnings on, false
switches warnings offpublic double stdDevLength()
public TimeSpan stdDevWaitTime()
public long zeroWaits()