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

java.lang.Objectdesmoj.NamedObject
desmoj.ModelComponent
desmoj.Reportable
desmoj.QueueBased
desmoj.Bin
- public class Bin
- extends QueueBased
Bin is the place where producers can store their products for consumers
to come and use them up.
Bin is used to implement process synchronization between producers and
consumers. Producers are producing products and store them using
store() in the bin. Consumers make the Bin
deliver() the products to use them up.
If no or not enough units of a product are available for the consumers,
they have to wait in a queue until new units are delivered by a
producer.
The first sort criteria of the queue is always highest priorities first,
the second queueing discipline of the underlying queue and the capacity
limit can be determined by the user (default is Fifo and unlimited
capacity).
Bin is derived from QueueBased, which provides all the statistical
functionality for a queue.
- Version:
- DESMO-J, Ver. 1.5 copyright (c) 2001 licensed under GNU GPL
| Field Summary | |
private long |
avail
Number of products available at the moment |
private long |
consumers
Number of consumers having visited the Bin |
private long |
initial
The initial number of products in the Bin |
private SimTime |
lastUsage
The last time the Bin has been used |
private long |
maximum
The maximum number of products in the Bin |
private boolean |
passBy
Flag to indicate whether an entity can pass by other entities in the queue which are enqueued before that entity in the queue. |
private long |
producers
Number of producers having visited the Bin |
private QueueList |
queue
The queue, actually storing the processes waiting for products |
private long |
refused
Counter for the SimProcesses which are refused to be enqueued, because the queue capacity is full. |
private java.lang.String |
where
Indicates the method where something has gone wrong. |
private double |
wSumAvail
Weighted sum of available products in the Bin over the time (must be divided by the total time to get the average available units!) |
| 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 | |
Bin(Model owner,
java.lang.String name,
int sortOrder,
int qCapacity,
long initialUnits,
boolean showInReport,
boolean showInTrace)
Constructor for a Bin with a number of initial units of a product in it. |
|
Bin(Model owner,
java.lang.String name,
long initialUnits,
boolean showInReport,
boolean showInTrace)
Constructor for a Bin with a number of initial units of a product in it. |
|
| Method Summary | |
protected void |
activateAsNext(SimProcess process)
Activates the SimProcess process, given as a parameter of
this method, as the next process. |
protected void |
activateFirst()
Activates the first process waiting in the queue. |
double |
avgAvail()
Returning the average number of products available in the bin over the time since the last reset of the bin. |
protected boolean |
checkProcess(SimProcess p,
java.lang.String where)
Checks whether the entity using the bin is a valid process. |
desmoj.report.Reporter |
createReporter()
Returns a Reporter to produce a report about this Bin. |
boolean |
deliver(long n)
Method for consumers to make the Bin deliver a number of n products. |
long |
getAvail()
Returns the number of units available at the moment. |
long |
getConsumers()
Returns the number of consumers having visited the Bin. |
long |
getInitial()
Returns the initial number of products in the bin. |
long |
getMaximum()
Returns the maximum number of products in the bin. |
boolean |
getPassBy()
Returns whether entities can pass by other entities which are enqueued before them in the queue. |
long |
getProducers()
Returns the number of producers having used the Bin. |
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, because the capacity limit is reached. |
void |
reset()
To reset the statistics of this bin. |
void |
setPassBy(boolean newPassBy)
Sets the flag passBy to a new value. |
void |
store(long n)
Method for producers to put a number of n new products in the Bin. |
protected void |
updateStatistics(long n)
Updates the statistics for producers and consumers. |
| 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 |
queue
private QueueList queue
- The queue, actually storing the processes waiting for products
initial
private long initial
- The initial number of products in the Bin
maximum
private long maximum
- The maximum number of products in the Bin
avail
private long avail
- Number of products available at the moment
producers
private long producers
- Number of producers having visited the Bin
consumers
private long consumers
- Number of consumers having visited the Bin
wSumAvail
private double wSumAvail
- Weighted sum of available products in the Bin over the time
(must be divided by the total time to get the average available units!)
lastUsage
private SimTime lastUsage
- The last time the Bin has been used
where
private java.lang.String where
- Indicates the method where something has gone wrong. Is passed as a
parameter to the method
checkProcess().
refused
private long refused
- Counter for the SimProcesses which are refused to be enqueued, because the
queue capacity is full.
passBy
private boolean passBy
- Flag to indicate whether an entity can pass by other entities in the queue
which are enqueued before that entity in the queue. Is
falseper default.
| Constructor Detail |
Bin
public Bin(Model owner, java.lang.String name, int sortOrder, int qCapacity, long initialUnits, boolean showInReport, boolean showInTrace)
- Constructor for a Bin with a number of initial units of a product in it.
The queueing discipline and the capacity limit of the underlying queue
can be chosen, too. Highest priority are always first in the queue.
Bin
public Bin(Model owner, java.lang.String name, long initialUnits, boolean showInReport, boolean showInTrace)
- Constructor for a Bin with a number of initial units of a product in it.
The underlying queue has a Fifo queueing discipline and unlimited capacity.
| Method Detail |
activateAsNext
protected void activateAsNext(SimProcess process)
- Activates the SimProcess
process, given as a parameter of this method, as the next process. This process should be a SimProcess waiting in the queue for some products.
activateFirst
protected void activateFirst()
- Activates the first process waiting in the queue. That is a
process which was trying to take products, but it could not get any
because there were not enough products for it or another process was
first in the queue to be served. This method is called every time a
producer has given new products or a consumer in the waiting queue is
satisfied.
avgAvail
public double avgAvail()
- Returning the average number of products available in the bin
over the time since the last reset of the bin.
checkProcess
protected boolean checkProcess(SimProcess p, java.lang.String where)
- Checks whether the entity using the bin is a valid process.
createReporter
public desmoj.report.Reporter createReporter()
- Returns a Reporter to produce a report about this Bin.
- Specified by:
createReporterin classQueueBased
deliver
public boolean deliver(long n)
- Method for consumers to make the Bin deliver a number of n products.
When there are not enough products available or another consumer is first
in the queue to be served (and it is not possible to pass by), the current
consumer process will be blocked and inserted in the waiting queue.
getAvail
public long getAvail()
- Returns the number of units available at the moment.
getConsumers
public long getConsumers()
- Returns the number of consumers having visited the Bin.
getInitial
public long getInitial()
- Returns the initial number of products in the bin.
getMaximum
public long getMaximum()
- Returns the maximum number of products in the bin.
getPassBy
public boolean getPassBy()
- Returns whether entities can pass by other entities which are enqueued before
them in the queue.
getProducers
public long getProducers()
- Returns the number of producers having used the Bin.
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,
because the capacity limit is reached.
reset
public void reset()
- To reset the statistics of this bin. The number of available
products at this moment and the processes waiting in the queue are not
changed. But all statistic counters are reset.
The
QueueBasedis also reset.- Overrides:
resetin classQueueBased
setPassBy
public void setPassBy(boolean newPassBy)
- Sets the flag passBy to a new value. PassBy is indicating whether entities can
pass by other entities which are enqueued before them in the queue.
store
public void store(long n)
- Method for producers to put a number of n new products in the Bin.
When producers
store()new products n is positive. Producers can always store products into the Bin and will never be inserted in a queue and blocked, because the Bin has no capacity limit..
updateStatistics
protected void updateStatistics(long n)
- Updates the statistics for producers and consumers.
|
|||||||||
| Home >> All >> [ desmoj overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC