public class Block extends Reportable
store()
of the Block. With the
retrieve()
a container can be retrieved from the Block. A
Block is a part of the container Yard
. There are no queues
for processes want to store or retrieve one container. If no or not enough
containers are available to retrieve, the tries to do that will be refused.
The Block has a certain capacity that measures in TEUs. So a
20-foot-container weigths one TEU and 40-foot-container 2 TEUs. If the Block
is filled to it's capacity the tries to store a container there will be
refused. Yard is part of the composite design pattern as described in
[Gamm97] page 163 in which it represents the the component class. Block is
derived from Reportable, which provides the report functionality for the
Block.Reportable
Constructor and Description |
---|
Block(Model owner,
java.lang.String name,
int typ,
long capacity,
boolean showInReport,
boolean showInTrace)
Constructor for a Block of a certain typ with a certain capacity.
|
Block(Model owner,
java.lang.String name,
int typ,
long capacity,
long init,
boolean showInReport,
boolean showInTrace)
Constructor for a Block with an initial number of TEUs and a certain
capacity.
|
Block(Model owner,
java.lang.String name,
int typ,
long capacity,
long init,
int ctyp,
boolean showInReport,
boolean showInTrace)
Constructor for a Block with an initial number of TEUs, a certain
capacity and a certain container typ.
|
Modifier and Type | Method and Description |
---|---|
double |
avgCapacity()
Returning the average number of TEUs available in the Block over the time
since the last reset of the Block.
|
Reporter |
createDefaultReporter()
Returns a Reporter to produce a report about this Block.
|
long |
getCapacity()
Gets the max. capacity of the Block.
|
long |
getConsumers()
Gets the number of the processes that retrieved from this Block.
|
int |
getCTyp()
Gets the container typ of the Block: what kind of container is that Block
for.
|
long |
getCurrentCapacity()
Gets the current capacity of the Block.
|
HoldingArea |
getHO()
Gets the holding area this Block is assigned to.
|
long |
getInitial()
Gets the initial number of TEUs the Block starts with.
|
long |
getMaximum()
Gets the maximum number of TEUs in the Block.
|
long |
getMinimum()
Gets the minimum number of TEUs (goods) in the Block.
|
long |
getProducers()
Gets the number of the processes that stored in this Block.
|
int |
getTyp()
Gets the typ of the Block.
|
boolean |
isFree(long n)
Method to check if the Block is free (it can be stored there) for at
least some TEUs.
|
double |
OccupRate()
Gets the occupation rate of the Block.
|
boolean |
plan(long n)
Method for consumers to make the Block plan a number of n TEUs (a place
for a container) to be retrieved there later.
|
boolean |
reserve(long n)
Method for producers to make the Block reserve a number of n TEUs (a
place for a container) to be stored there later.
|
void |
reset()
To reset the statistics of this Block.
|
boolean |
retrieve(long n)
Method for consumers to make the Block retrieve a number of n TEUs (a
container).
|
void |
setCTyp(int ctyp)
Sets the container typ of this Block to a new value.
|
void |
setHO(HoldingArea ho)
Assigns this Block to a new holding area.
|
void |
setTyp(int t)
Sets the typ of this Block to a new value.
|
boolean |
store(long n)
Method for producers to make the Block store a number of n TEUs (a
container).
|
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 Block(Model owner, java.lang.String name, int typ, long capacity, boolean showInReport, boolean showInTrace)
owner
- desmoj.Model : The model this Block is associated to.name
- java.lang.String : The Block's name.typ
- int : The Block's type. It can be only 0 - for export
containers, 1- for import containers or 2 - mixed: for import
and export containers.capacity
- long : The maximum capacity (TEU) of this Block.showInReport
- boolean : Flag, if this Block should produce a report or not.showInTrace
- boolean : Flag for trace to produce trace messages.public Block(Model owner, java.lang.String name, int typ, long capacity, long init, boolean showInReport, boolean showInTrace)
owner
- desmoj.Model : The model this Block is associated to.name
- java.lang.String : The Block's name.typ
- int : The Block's type. It can be only 0 - for export
containers, 1- for import containers or 2 - mixed: for import
and export containers.capacity
- long : The maximum capacity of this Block.init
- long : The initial occupied capacity of the Block starts with.
Must be positive!showInReport
- boolean : Flag, if this Block should produce a report or not.showInTrace
- boolean : Flag for trace to produce trace messages.public Block(Model owner, java.lang.String name, int typ, long capacity, long init, int ctyp, boolean showInReport, boolean showInTrace)
owner
- desmoj.Model : The model this Block is associated to.name
- java.lang.String : The Block's name.typ
- int : The Block's type. It can be only 0 - for export
containers, 1- for import containers or 2 - mixed: for import
and export containers.capacity
- long : The maximum capacity of this Block.ctyp
- int : The container type of this Block. It can be only 0- for
empty, 1- for normal, 2- for reefer, 4- for overlarge, 5- for
danger containers.init
- long : The initial occupied capacity of the Block starts with.
Must be positive!showInReport
- boolean : Flag, if this Block should produce a report or not.showInTrace
- boolean : Flag for trace to produce trace messages.public long getMaximum()
public long getMinimum()
public double OccupRate()
public Reporter createDefaultReporter()
public boolean store(long n)
n
- long : The weight of the container to be stored in this Block.
n must be positive.true
if the container can been stored
successfully, false
otherwise.public double avgCapacity()
public boolean retrieve(long n)
n
- long : The weight of the container to be stored in this Block.
n must be positive.true
if the container can been stored
successfully, false
otherwise.public long getProducers()
public long getConsumers()
public boolean plan(long n)
n
- long : The number of TEUs that a container that is in the
Block weights. n must be positive.true
if a container can been planed
successfully, false
otherwise.public long getInitial()
public void reset()
Reportable
is also reset.reset
in class Reportable
public boolean isFree(long n)
n
- long : The number of TEUs that are at least must be avalaible
(free).true
if the Block is free,
false
otherwise.public int getTyp()
public void setTyp(int t)
t
- int : The new typ of this Block.public boolean reserve(long n)
n
- long : The number of TEUs that are needed for a container to
be stored in the Block. n must be positive.true
if a place for a container can
been reserved successfully, false
otherwise.public long getCapacity()
public long getCurrentCapacity()
public void setHO(HoldingArea ho)
ho
- HoldingArea
: The new holding area of this
Block.public HoldingArea getHO()
HoldingArea
: The Holding area the Block is
assigned to.public void setCTyp(int ctyp)
ctyp
- int : The new container typ of this Block.public int getCTyp()