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

java.lang.Objectdesmoj.QueueList
desmoj.QueueListFifo
- All Implemented Interfaces:
- java.util.EventListener, java.beans.PropertyChangeListener
- public class QueueListFifo
- extends QueueList
- implements java.beans.PropertyChangeListener
- extends QueueList
Contains the implementation of a double linked list to represent
queueing functionality. The entities are queued first according to their
priority and second in first in first out order. The statistc data
of the queue will be stored in a QueueBased object.
The QueueListFifo has a reference to its QueueBased
object.
It uses the QueueLink class to build a list out of links
with references to each element's predecessor, successor, the QueueBased
object this QueueListFifo is associated to and of course, the Entity that
is supposed to be enqueued here.
This class needs a reference to a subclass of QueueBased to update
the queue statistics.
It is used in many kinds of queue implementations i.e. in classes
Queue and ProcessQueue.
- Version:
- DESMO-J, Ver. 1.5 copyright (c) 2001 licensed under GNU GPL
| Field Summary | |
private java.lang.String |
abbreviation
An abbreviation to identify the sort of queueing discipline (like FIFO or LIFO or ...) |
private QueueLink |
head
The first link element of the list. |
private QueueLink |
tail
The last link element of the list It is set to null in the constructor to indicate that the
QueueListFifo is empty. |
| Fields inherited from class desmoj.QueueList |
clientQ |
| Constructor Summary | |
QueueListFifo()
Constructs an empty QueueListFifo with no reference to its
client QueueBased. |
|
| Method Summary | |
protected boolean |
checkProcess(SimProcess proc)
Checks whether the process using the QueueList is a valid SimProcess. |
(package private) boolean |
contains(Entity e)
Returns true if the given entity is contained in the list, false otherwise. |
(package private) Entity |
first()
Returns the first entity stored in the list. |
java.lang.String |
getAbbreviation()
Returns an abbreviation as a String to identify the sort of queueing discipline (like FIFO or LIFO or ...). |
(package private) void |
insert(Entity e)
Adds a new entity to the QueueListFifo. |
(package private) boolean |
insertAfter(Entity e,
Entity which)
Inserts the given "e" after the position of "which" in the queuelistfifo. |
(package private) boolean |
insertBefore(Entity e,
Entity which)
Inserts the given "e" before the position of "which" in the queuelistfifo. |
(package private) boolean |
isEmpty()
Returns true, if no elements are inside the QueueListFifo,
false otherwise |
(package private) Entity |
last()
Returns the last entity stored in the queuelistfifo. |
(package private) Entity |
pred(Entity e)
Returns the predecessor to the given entity in the queuelistfifo. |
void |
propertyChange(java.beans.PropertyChangeEvent evt)
This method will be called every time the Stock (the number of available units) has changed. |
(package private) boolean |
remove(Entity e)
Removes the given entity from the queuelistfifo. |
(package private) boolean |
removeFirst()
Removes the first entity from this QueueListFifo and returns true
if it was removed successfully. |
(package private) boolean |
removeLast()
Removes the last entity from the QueueListFifo and returns true
if it was removed successfully. |
(package private) void |
sendWarning(java.lang.String description,
java.lang.String location,
java.lang.String reason,
java.lang.String prevention)
Sends a warning to the error output by forwarding it to the associated queuebased's sendwarning method. |
(package private) Entity |
succ(Entity e)
Returns the successor to the given entity in the queuelistfifo. |
java.lang.String |
toString()
Returns a string representation of the queuelistfifo. |
| Methods inherited from class desmoj.QueueList |
getQueueBased, setQueueBased |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
head
private QueueLink head
- The first link element of the list.
It is set to
nullin the constructor to indicate that the QueueListFifo is empty.
tail
private QueueLink tail
- The last link element of the list
It is set to
nullin the constructor to indicate that the QueueListFifo is empty.
abbreviation
private java.lang.String abbreviation
- An abbreviation to identify the sort of queueing discipline
(like FIFO or LIFO or ...)
| Constructor Detail |
QueueListFifo
public QueueListFifo()
- Constructs an empty
QueueListFifowith no reference to its client QueueBased. This no-arg constructor is necessary to instantiate an object of this class by calling thejava.lang.Class.newInstance()method. The reference to the QueueBased object making use of this queue-functionality must be provided later by calling the setQueueBased() method. The initial length is always zero.
| Method Detail |
checkProcess
protected boolean checkProcess(SimProcess proc)
- Checks whether the process using the QueueList is a valid SimProcess.
contains
boolean contains(Entity e)
- Returns true if the given entity is contained in the list,
false otherwise.
first
Entity first()
- Returns the first entity stored in the list.
If the queue is empty,
nullis returned.
getAbbreviation
public java.lang.String getAbbreviation()
- Returns an abbreviation as a String to identify the sort of queueing
discipline (like FIFO or LIFO or ...). Is used to display the queueing
discipline in the report of the QueueBased objects.
- Specified by:
getAbbreviationin classQueueList
insert
void insert(Entity e)
- Adds a new entity to the QueueListFifo.
Entities are inserted according to their priority in descending order.
The highest priority Entity will always be first in the queue.
Entities with same priority are inserted in FiFo order.
insertAfter
boolean insertAfter(Entity e, Entity which)
- Inserts the given "e" after the position of
"which" in the queuelistfifo.
Returns true if "e" is inserted correctly after "which".
If the list is empty or the referenced "which" is not contained, the
"e" will not be inserted and false is returned.
- Specified by:
insertAfterin classQueueList
insertBefore
boolean insertBefore(Entity e, Entity which)
- Inserts the given "e" before the position of "which" in the queuelistfifo.
Returns true if "e" is inserted correctly after "which".
If the list is empty or the referenced "which" is not contained, the
"e" will not be inserted and false is returned.
- Specified by:
insertBeforein classQueueList
isEmpty
boolean isEmpty()
- Returns
true, if no elements are inside theQueueListFifo,falseotherwise
last
Entity last()
- Returns the last entity stored in the queuelistfifo.
If the queuelistfifo is empty,
nullis returned.
pred
Entity pred(Entity e)
- Returns the predecessor to the given entity in the queuelistfifo.
If there is no predecessor or no entity,
nullis returned.
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- This method will be called every time the Stock (the number of available units)
has changed.
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
remove
boolean remove(Entity e)
- Removes the given entity from the queuelistfifo.
Checks if the given entity to be removed does apply to all restrictions
on this operation. These are :
- The given reference to an entity must not be
null - This queuelistfifo must not be empty, otherwise there's nothing to remove
- The entity's queuelink to the queues it is in must not be
null - The entity's list of queues it is in must contain a queuelink referencing this queuelistfifo
trueis returned and the entity is removed, otherwisefalseis the return value because the given entity could not be removed since one of the restrictions above was not met. - The given reference to an entity must not be
removeFirst
boolean removeFirst()
- Removes the first entity from this QueueListFifo and returns
trueif it was removed successfully. If the queuelistfifo is empty,falseis returned.- Specified by:
removeFirstin classQueueList
removeLast
boolean removeLast()
- Removes the last entity from the QueueListFifo and returns
trueif it was removed successfully. If the queuelistfifo is empty,falseis returned.- Specified by:
removeLastin classQueueList
sendWarning
void sendWarning(java.lang.String description, java.lang.String location, java.lang.String reason, java.lang.String prevention)
- Sends a warning to the error output by forwarding it to the associated
queuebased's
sendwarningmethod. Warnings are sent only if the queuebased's flag for queue implementation warnings is set totrue.- Specified by:
sendWarningin classQueueList
succ
Entity succ(Entity e)
- Returns the successor to the given entity in the queuelistfifo.
If there is no successor or no entity in the queuelistfifo,
nullis returned.
toString
public java.lang.String toString()
- Returns a string representation of the queuelistfifo.
The string is built by concatenating all string representations of
the contained entities, calling their
toString()methods.
|
|||||||||
| Home >> All >> [ desmoj overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC