public class Entrepot extends QueueBased
SimProcess
es) can be stored. They will be stored in a kind of
FIFO order, that means the products arriving first at the Entrepot will be
the first ones to be removed. One can remove products from the Entrepot in
order to sell (or dispatch) them or to process them in any other way. Note:
while products can enter the Entrepot themselves, another process (
SimProcess
) is needed to remove the products from the
Entrepot. Because the product processes are passivated while they are stored
in the Entepot! The Entrepot has no capacity limit, so it can store (almost)
an endless number of products. The maximum number of available products in
the Entrepot will be shown in the report and can be used to judge what a
reasonable capacity limit for the Entrepot in the real world might be. In
contrast the queue for the waiting customers can have a certain limit. If the
customers' queue capacity is reached any further customer will be rejected
(refused to service). The default number of products an Entrepot starts with
is zero. It will be filled during simulation by some manufacturing process
(or the product process itself) using the storeProduct()
method. Products can be retrieved (removed) from the Entrepot using one of
the removeProduct()
methods. If no or not enough products are
available the costumers have to wait in a queue until new products are stored
in the Entrepot. The first sort criteria of the customer queue is always
highest priorities first. The second queueing discipline and the capacity
limit of the customer queue can be determined by the user (default is FIFO
and unlimited capacity). As long as the products (SimProcesses) are stored in
the Entrepot they are passivated and blocked. Entrepot is derived from
QueueBased, which provides all the statistical functionality for the customer
queue.QueueBased
,
Bin
QueueBased.QueueAction
FIFO, LIFO, RANDOM, UNDEFINED
Constructor and Description |
---|
Entrepot(Model owner,
java.lang.String name,
boolean showInReport,
boolean showInTrace)
Constructs an empty Entrepot where products (SimProcesses) can be stored
and retrieved.
|
Entrepot(Model owner,
java.lang.String name,
int sortOrder,
int qCapacity,
boolean showInReport,
boolean showInTrace)
Constructs an empty Entrepot where products (SimProcesses) can be stored
and retrieved.
|
Modifier and Type | Method and Description |
---|---|
double |
avgAvail()
Returns the average number of products available in the Entrepot over the
time since the last reset of the Entrepot.
|
boolean |
contains(SimProcess product)
Checks if the given product (SimProcess) is contained in the Entrepot.
|
Reporter |
createDefaultReporter()
Returns a Reporter to produce a report about this Entrepot.
|
int |
getAvail()
Returns the number of products available at the moment.
|
int |
getAvailComplyWith(Condition condition)
Returns the number of products available in the Entrepot at the moment
which are in compliance with the given
Condition . |
long |
getCustomers()
Returns the number of customers having obtained products from the
Entrepot.
|
long |
getMaximum()
Returns the maximum number of products in the Entrepot.
|
boolean |
getPassBy()
Returns whether entities can pass by other entities which are enqueued
before them in the queue.
|
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 SimProcesses refused to be enqueued in the queue,
because the capacity limit is reached.
|
long |
getSoldProducts()
Returns the number of products which already have been sold (passed
through this Entrepot).
|
boolean |
isEmpty()
Tests if the Entrepot is empty (has no products stored).
|
java.util.Enumeration |
products()
Returns an enumeration of the products stored in this
Entrepot . |
SimProcess[] |
removeAllProducts()
Removes (and returns) all products (SimProcesses) from the Entrepot which
are contained in there at the moment, even if other processes are waiting
in the queue.
|
SimProcess[] |
removeAllProducts(Condition condition)
Removes (and returns) all products (SimProcesses) which are in compliance
with the given condition from the Entrepot, no matter if there are other
processes waiting in the queue.
|
SimProcess |
removeProduct()
Removes (and returns) one product (SimProcess) from the Entrepot.
|
void |
removeProduct(SimProcess product)
Removes a certain product (SimProcess) from the Entrepot, if the given
product is stored in the Entrepot, no matter if other processes are
waiting in the queue already.
|
SimProcess[] |
removeProducts(int n,
Condition condition)
Removes (and returns) a certain number of products (SimProcesses) from
the Entrepot which are in compliance with the given condition.
|
SimProcess[] |
removeProducts(long n)
Removes (and returns) a certain number of products (SimProcesses) from
the Entrepot.
|
void |
reset()
To reset the statistics of this Entrepot.
|
void |
setPassBy(boolean newPassBy)
Sets the flag passBy to a new value.
|
void |
storeProduct(SimProcess product)
Stores a sim-process as a product in the Entrepot.
|
void |
storeProducts(SimProcess[] finishedProds)
Stores an array of SimProcesses as products in the Entrepot.
|
addObserver, averageLength, averageWaitTime, deleteObserver, getQueueLimit, length, maxLength, maxLengthAt, maxWaitTime, maxWaitTimeAt, minLength, minLengthAt, notifyObservers, setQueueImpWarning, stdDevLength, stdDevWaitTime, zeroWaits
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 Entrepot(Model owner, java.lang.String name, int sortOrder, int qCapacity, boolean showInReport, boolean showInTrace)
owner
- desmoj.Model : The model this Entrepot is associated to.name
- java.lang.String : The name of this Entrepot.sortOrder
- int : determines the sort order of the underlying queue
implementation. Choose a constant from QueueBased
like QueueBased.FIFO
or
QueueBased.LIFO
or ...qCapacity
- int : The capacity of the queue, that is how many processes
can be enqueued. Zero (0) means unlimited capacity.showInReport
- boolean : Flag, if this Entrepot should produce a report or
not.showInTrace
- boolean : Flag, if this Entrepot should produce trace messages
or not.public Entrepot(Model owner, java.lang.String name, boolean showInReport, boolean showInTrace)
owner
- desmoj.Model : The model this Entrepot is associated to.name
- java.lang.String : The name of this Entrepot.showInReport
- boolean : Flag, if this Entrepot should produce a report or
not.showInTrace
- boolean : Flag, if this Entrepot should produce trace messages
or not.public double avgAvail()
public boolean contains(SimProcess product)
product
- desmoj.SimProcess : The product which might be in the
Entrepot.true
if and only if the specified
SimProcess is the same as a component in this Entrepot, as
determined by the equals method; false
otherwise.public Reporter createDefaultReporter()
public int getAvail()
public int getAvailComplyWith(Condition condition)
Condition
. This
method is useful to test if enough products are available which are in
compliance with a given condition (i.e. before you use the method
removeProducts(n, condition)
).condition
- desmoj.Condition : The Condition
the products
have to be in compliance with.Condition
.public long getCustomers()
public long getMaximum()
public boolean getPassBy()
public java.lang.String getQueueStrategy()
public long getRefused()
public long getSoldProducts()
public boolean isEmpty()
true
if and only if this Entrepot has no
products stored (it is empty); false
otherwise.public java.util.Enumeration products()
Entrepot
. The returned Enumeration
object
will generate all items contained in the vector products
.public SimProcess[] removeAllProducts()
null
will be returned. The
products will be retrieved in a kind of FIFO order, that means the
product which arrived first in the Entrepot is the first to be removed.null
if no products are available
at the moment.public SimProcess[] removeAllProducts(Condition condition)
null
will be returned. The products will be retrieved in a
kind of FIFO order, that means the product which arrived first in the
Entrepot is the first to be removed. To check if there are any products
available which are in compliance with the given condition use the method
getAvailComplyWith()
.condition
- desmoj.Condition : The condition the products to be removed
must comply with.null
if no such
products are available at the moment.public SimProcess removeProduct() throws SuspendExecution
null
will be returned). The product will be retrieved in a
kind of FIFO order, that means the product which arrived first in the
Entrepot is the first to be removed.null
if the
capacity limit of the wait queue is reached and therefore the
SimProcess is refused to be serviced or another failure has
occured.SuspendExecution
public void removeProduct(SimProcess product)
products()
or
contains()
. The products will be retrieved in a kind of
FIFO order that means the product which arrived first in the Entrepot is
the first to be removed. Users of this method will not be enqueued in the
waiting-queue, because no one can ensure that the requested SimProcess
will ever arrive in this Entrepot.product
- desmoj.SimProcess : The product to be removed from the
Entrepot. Note that this SimProcess will be activated after
the current SimProcess as long as its lifeCycle is not
terminated.public SimProcess[] removeProducts(long n) throws SuspendExecution
null
will be returned). The products will be retrieved in a kind of FIFO
order, that means the product which arrived first in the Entrepot is the
first to be removed.n
- int : The number of products to be removed from the Entrepot.null
if the
capacity limit of the wait queue is reached and therefore the
SimProcess is refused to be serviced or another failure has
occured.SuspendExecution
public SimProcess[] removeProducts(int n, Condition condition) throws SuspendExecution
null
will be returned). The products will
be retrieved in a kind of FIFO order, that means the product which
arrived first in the Entrepot is the first to be removed. To make sure
there are enough products available which are in compliance with the
given condition use the method getAvailComplyWith()
.n
- int : The number of products (which are in compliance with the
given condition) to be removed from the Entrepot.condition
- desmoj.Condition : The condition the products to be removed
must comply with.null
if the capacity
limit of the wait queue is reached and therefore the sim-process
is refused to be serviced or another failure has occured.SuspendExecution
public void reset()
QueueBased
is also reset.reset
in class QueueBased
public void setPassBy(boolean newPassBy)
newPassBy
- boolean : The new value of passBy. Set it to true
if you want entities to pass by other entities which are
enqueued before them in the queue. Set it to
false
if you don't want entities to overtake
other entities in the queue.public void storeProduct(SimProcess product) throws SuspendExecution
product
- desmoj.SimProcess : The sim-process (product) to be stored in
the Entrepot.SuspendExecution
public void storeProducts(SimProcess[] finishedProds) throws SuspendExecution
finishedProds
- desmoj.SimProcess[] : The array of SimProcesses (products) to
be stored in the Entrepot.SuspendExecution