public class Yard extends Block
store(Block b)
.With the retrieve(Block b)
a
container can be retrieved from the Yard. Yard is part of the composite
design pattern as described in [Gamm97] page 163. Yard is derived from Block,
which provides the functionality of the Block.Block
Constructor and Description |
---|
Yard(Model owner,
java.lang.String name,
ChooseBlockYardStrategy s,
boolean showInReport,
boolean showInTrace)
Constructor for a Yard.
|
Modifier and Type | Method and Description |
---|---|
void |
addBlock(Block b)
Method for producers to make the Yard add a block.
|
Reporter |
createDefaultReporter()
Returns a Reporter to produce a report about this Yard.
|
Block[] |
getAllBlocks()
Gets all the blocks of the yard.
|
Block |
getBlock(Block[] blocks)
Gets the Block of the yard that was found by using the current yard
strategy of the yard.
|
Block[] |
getBlocks(int typ)
Gets all the blocks of the yard that have the certain typ.
|
Block[] |
getBlocks(int typ,
Block[] b)
Gets all the blocks of a part of the yard that have the certain typ.
|
Block[] |
getCBlocks(int ctyp)
Gets all the blocks of the yard with a certain container typ.
|
Block[] |
getFreeBlocks(Block[] b,
long n)
Gets all the blocks from a part of the yard blocks that have some free
place to store containers.
|
Block[] |
getFreeBlocks(long n)
Gets all the blocks of the yard that have some free place to store
containers.
|
Block[] |
getFullBlocks(Block[] b,
long n)
Gets all the blocks of the yard that have at least some TEUs (not empty).
|
Block[] |
getHOBlocks(HoldingArea ho)
Gets all the blocks of the yard that are assigned a certain holding area
to.
|
int |
getNumBlocks()
Returns the number of all the blocks of this yard.
|
long |
getOverflow()
Gets the current number of TEUs/containers in the overflow part of this
yard.
|
ChooseBlockYardStrategy |
getYardStrategy()
Returns the strategy of this yard for the choosing of a block.
|
boolean |
isFree(long n)
Method to check if the Yard is free (there's at least one block that is
free).
|
boolean |
plan(Block b,
long n)
Method for consumers to make the Yard plan a number of n TEUs (a place
for a container) to be retrieved there later.
|
boolean |
reserve(Block b,
long n)
Method for producers to make the Yard reserve a number of n TEUs (a place
for a container) to be stored there later.
|
void |
reset()
To reset the statistics of this Yard.
|
boolean |
retrieve(Block b,
long n)
Method for consumers to make the Yard retrieve a number of n TEUs (a
container).
|
boolean |
retrieveFromOverflow(long n)
Method for consumers to retrieve from the overflow part of this Yard a
number of n TEUs (a container).
|
void |
setYardStrategy(ChooseBlockYardStrategy s)
Sets strategy of this yard for the choosing of a block to a new value.
|
boolean |
store(Block b,
long n)
Method for producers to make the Yard store a number of n TEUs (a
container).
|
void |
storeInOverflow(long n)
Method for producers to make the Yard store a number of n TEUs (a
container) in its overflow part.
|
avgCapacity, getCapacity, getConsumers, getCTyp, getCurrentCapacity, getHO, getInitial, getMaximum, getMinimum, getProducers, getTyp, OccupRate, plan, reserve, retrieve, setCTyp, setHO, setTyp, store
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 Yard(Model owner, java.lang.String name, ChooseBlockYardStrategy s, boolean showInReport, boolean showInTrace)
owner
- desmoj.Model : The model this Yard is associated to.name
- java.lang.String : The Yard'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 Reporter createDefaultReporter()
createDefaultReporter
in class Block
public void addBlock(Block b)
b
- Block : The Block that must be added to this yard.public Block[] getBlocks(int typ)
typ
- int : The typ of the blocks.Block[]
: The Blocks of the yard of a certain typ.public Block[] getBlocks(int typ, Block[] b)
typ
- int : The typ of the blocks.b
- Block[] : The array of the certain blocks of the yard.Block[]
: The Blocks of the yard of a certain typ.public Block[] getFreeBlocks(long n)
n
- long : The number of TEUs that are at least must be avalaible
(free) in that blocks.Block[]
: The Blocks of the yard that have some
free place.public Block[] getFreeBlocks(Block[] b, long n)
b
- Block[] : The array of the certain blocks of the yard.Block[]
: The Blocks of the yard that have some
free place.public Block[] getAllBlocks()
Block[]
: The Blocks of the yard.public Block getBlock(Block[] blocks)
Block
: The Block of the yard found by using yard
strategy.public void storeInOverflow(long n)
n
- long : The weight of the container to be stored in the
overflow part of this yard. n must be positive.public boolean retrieveFromOverflow(long n)
n
- long : The weight of the container to be stored in the
overflow part of this yard. n must be positive.true
if the try was successfull,
false
otherwise.public boolean store(Block b, long n)
b
- Block : The block of the yard to store.n
- long : The weight of the container to be stored in this Yard.
n must be positive.true
if the container can been stored
successfully, false
otherwise.public boolean retrieve(Block b, long n)
b
- Block : The block of the yard to retrieve.n
- long : The weight of the container to be stored in this Yard.
n must be positive.true
if the container can been stored
successfully, false
otherwise.public long getOverflow()
public boolean isFree(long n)
public boolean reserve(Block b, long n)
b
- Block : The block of the yard to reserve.n
- long : The number of TEUs that are needed for a container to
be stored in the Yard. n must be positive.true
if a place for a container can
been reserved successfully, false
otherwise.public boolean plan(Block b, long n)
b
- Block : The block of the yard to plan.n
- long : The number of TEUs that a container that is in the Yard
weights. n must be positive.true
if a container can been planed
successfully, false
otherwise.public int getNumBlocks()
public void setYardStrategy(ChooseBlockYardStrategy s)
s
- ChooseBlockYardStrategy : The new yard strategy.public ChooseBlockYardStrategy getYardStrategy()
ChooseBlockYardStrategy
: The yard strategy.public void reset()
public Block[] getHOBlocks(HoldingArea ho)
ho
- HoldingArea
: The holding area that the blocks
are assigned to.Block[]
: The Blocks of the yard of a certain
holding area.public Block[] getCBlocks(int ctyp)
ctyp
- int : The typ of the contaners of this block.Block[]
: The Blocks of the yard of a certain
container typ.public Block[] getFullBlocks(Block[] b, long n)
n
- long : The number of TEUs that are at least must be with
containers in the blocks of the yard.Block[]
: The Blocks of the yard that are not
empty.