|
|||||||||
| Home >> All >> [ desmoj overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
desmoj
Class Queue

java.lang.Objectdesmoj.NamedObject
desmoj.ModelComponent
desmoj.Reportable
desmoj.QueueBased
desmoj.Queue
- public class Queue
- extends QueueBased
Queue provides models with a ready-to-use modelling element to enqueue
entities and simprocesses in.
The sort order of the queue is determined first by the priorities of
the enqueued entities and second by the given sort order. The default
sort order is fifo (first in, first out) but others like lifo
(last in, first out) can be chosen, too. See the constants in class
QueueBased and the derived classes from QueueList.
The capacity of the Queue,
that is the maximum number of entities enqueued, can be chosen, too.
- Version:
- DESMO-J, Ver. 1.5 copyright (c) 2001 licensed under GNU GPL
| Field Summary | |
private QueueList |
ql
The queue implementation (data structure) that actually stores the entities |
private long |
refused
Counter for the entities which are refused to be enqueued, because the queue capacity is full. |
| Fields inherited from class desmoj.QueueBased |
FIFO, LIFO, queueingStrategy, queueLimit, UNDEFINED |
| Fields inherited from class desmoj.Reportable |
|
| Fields inherited from class desmoj.ModelComponent |
|
| Fields inherited from class desmoj.NamedObject |
|
| Constructor Summary | |
Queue(Model owner,
java.lang.String name,
boolean showInReport,
boolean showInTrace)
Constructs a simple priority and Fifo based waiting queue for entities with unlimited capacity of the queue. |
|
Queue(Model owner,
java.lang.String name,
int sortOrder,
int qCapacity,
boolean showInReport,
boolean showInTrace)
Constructs a simple priority based waiting queue for entities, the kind of queue implementation (Fifo or Lifo) and the capacity of the queue can be chosen. |
|
| Method Summary | |
desmoj.report.Reporter |
createReporter()
Returns a special queuereporter to produce a report about this queue. |
Entity |
first()
Returns the first entity queued in this queue or null in case the queue is empty. |
Entity |
first(Condition c)
Returns the first entity queued in this queue that applies to the given condition. |
java.lang.String |
getQueueStrategy()
Returns the implemented queueing discipline of the underlying queue as a String, so it can be displayed in the report. |
long |
getRefused()
Returns the number of entities refused to be enqueued in the queue. |
boolean |
insert(Entity e)
Enters a new entity into the queue. |
boolean |
insertAfter(Entity e,
Entity after)
Enters a new entity into the queue and places it after the given entity. |
boolean |
insertBefore(Entity e,
Entity before)
Enters a new entity into the queue and places it in front of the given entity. |
boolean |
isEmpty()
Returns a boolean value indicating if the queue is empty or if any number of entities is currently enqueued in it. |
Entity |
last()
Returns the last entity queued in this queue or null
in case the queue is empty. |
Entity |
last(Condition c)
Returns the last entity queued in this queue that applies to the given condition. |
Entity |
pred(Entity e)
Returns the entity enqueued directly before the given entity in the queue. |
Entity |
pred(Entity e,
Condition c)
Returns the entity enqueued before the given entity in the queue that also complies to the condition given. |
void |
remove(Entity e)
Removes the given Entity from the Queue. |
void |
reset()
Resets all statistical counters to their default values. |
Entity |
succ(Entity e)
Returns the entity enqueued directly after the given entity in the queue. |
Entity |
succ(Entity e,
Condition c)
Returns the entity enqueued after the given entity in the queue that also complies to the condition given. |
| Methods inherited from class desmoj.QueueBased |
addItem, averageLength, averageWaitTime, deleteItem, getQueueLimit, length, maxLength, maxLengthAt, maxWaitTime, maxWaitTimeAt, minLength, minLengthAt, qImpWarn, setQueueImpWarning, stdDevLength, stdDevWaitTime, updateStatistics, zeroWaits |
| 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 |
ql
private QueueList ql
- The queue implementation (data structure) that actually stores the entities
refused
private long refused
- Counter for the entities which are refused to be enqueued, because the
queue capacity is full.
| Constructor Detail |
Queue
public Queue(Model owner, java.lang.String name, int sortOrder, int qCapacity, boolean showInReport, boolean showInTrace)
- Constructs a simple priority based waiting queue for entities, the kind of
queue implementation (Fifo or Lifo) and the capacity of the queue
can be chosen.
Note that since SimProcesses are derived from Entities, they can be queued
inside this queue, too.
Queue
public Queue(Model owner, java.lang.String name, boolean showInReport, boolean showInTrace)
- Constructs a simple priority and Fifo based waiting queue for entities
with unlimited capacity of the queue.
Note that since SimProcesses are derived from Entities, they can be queued
inside this queue, too.
| Method Detail |
createReporter
public desmoj.report.Reporter createReporter()
- Returns a special queuereporter to produce a report about this queue.
- Specified by:
createReporterin classQueueBased
first
public Entity first()
- Returns the first entity queued in this queue or
nullin case the queue is empty.
first
public Entity first(Condition c)
- Returns the first entity queued in this queue that applies
to the given condition.
The queue is searched from front to end and the first entity
that returns
truewhen the condition is applied to it is returned by this method. If no entity apply to the given condition or the queue is empty,nullwill be returned.
getQueueStrategy
public java.lang.String getQueueStrategy()
- Returns the implemented queueing discipline of the underlying queue
as a String, so it can be displayed in the report.
getRefused
public long getRefused()
- Returns the number of entities refused to be enqueued in the queue.
insert
public boolean insert(Entity e)
- Enters a new entity into the queue. If the capacity of the queue is full,
the entity will not be enqueued and
falsewill be returned. The entity will be stored in the queue until methodremove(Entity e)is called with this specific entity. Entities inside the queue are ordered according to their priority. Higher priorities are sorted in front of lower priorities. Entities with same priority are orderer according to the specified strategy. The first entity inside the queue will always be the one with the highest priority.
insertAfter
public boolean insertAfter(Entity e, Entity after)
- Enters a new entity into the queue and places it after the given
entity. If the capacity of the queue is full,
the entity will not be enqueued and
falsewill be returned. Make sure that the entity given as reference is already queued inside the queue, else the entity will not be enqueued andfalsewill be returned. The entity will be stored in the queue until methodremove(Entity e)is called with this specific entity.
insertBefore
public boolean insertBefore(Entity e, Entity before)
- Enters a new entity into the queue and places it in front of the given
entity. If the capacity of the queue is full, the entity will not be
enqueued and
falsewill be returned. Make sure that the entity given as reference is already queued inside the queue, else the entity will not be queued andfalsewill be returned. The entity will be stored in the queue until methodremove(Entity e)is called with this specific entity.
isEmpty
public boolean isEmpty()
- Returns a boolean value indicating if the queue is empty or if
any number of entities is currently enqueued in it.
last
public Entity last()
- Returns the last entity queued in this queue or
nullin case the queue is empty.
last
public Entity last(Condition c)
- Returns the last entity queued in this queue that applies to the
given condition.
The queue is searched from end to front and the first entity that returns
truewhen the condition is applied to it is returned. If no entity applies to the given condition or the queue is empty,nullwill be returned.
pred
public Entity pred(Entity e)
- Returns the entity enqueued directly before the given entity in the
queue. If the given entity is not contained in this queue or is at the first
position thus having no possible predecessor,
nullis returned.
pred
public Entity pred(Entity e, Condition c)
- Returns the entity enqueued before the given entity in the
queue that also complies to the condition given.
If the given entity is not contained in this queue or is at the first
position thus having no possible predecessor,
nullis returned. If no other entity before the given one complies to the condition,nullis returned, too.
remove
public void remove(Entity e)
- Removes the given Entity from the Queue.
If the given Entity is not in the Queue, a warning will be issued
but nothing else will be changed.
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.
The counter for the entities refused to be enqueued will be reset.
- Overrides:
resetin classQueueBased
succ
public Entity succ(Entity e)
- Returns the entity enqueued directly after the given entity in the
queue. If the given entity is not contained in this queue or is at the last
position thus having no possible successor,
nullis returned.
succ
public Entity succ(Entity e, Condition c)
- Returns the entity enqueued after the given entity in the
queue that also complies to the condition given.
If the given entity is not contained in this queue or is at the last
position thus having no possible successor,
nullis returned. If no other entity after the given one complies to the condition,nullis returned, too.
|
|||||||||
| Home >> All >> [ desmoj overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC