|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--ACraneStrategy
Base class for a strategy of operating the warehouse crane.
| Field Summary | |
protected Crane |
crane
Crane used to operate on the warehouse. |
protected Warehouse |
warehouse
Warehouse on which this driver operates. |
| Constructor Summary | |
ACraneStrategy()
|
|
| Method Summary | |
boolean |
addOrder(Order anOrder)
Places the given order in the warehouse and returns true,
or returns false if it could not be placed. |
protected void |
beginAdd(Order anOrder)
Called when the given order is to be added to the warehouse. |
protected void |
beginRemove(Order anOrder)
Called when the given order is to be removed from the warehouse. |
protected Point |
getAddLocation(Parcel p)
Returns a location in the warehouse at which the given parcel should be added. |
abstract String |
getName()
Returns the name of this device driver. |
protected Point |
getRemoveLocation(Order anOrder)
Returns a location in the warehouse from which a parcel in the given order should be removed. |
void |
installInto(Crane aCrane,
Warehouse aWarehouse)
Installs this device driver into the given crane operating in the given warehouse. |
protected int |
orderNumberAt(int aRow,
int aColumn)
Returns the order number for the parcel stored at the given row and colum coordinates, or -1 if the coordinates represent an empty space. |
protected void |
parcelAdded(int aRow,
int aColumn,
Parcel aParcel)
Called when the given parcel has successfully been added to the warehouse at the given location. |
protected void |
parcelPlacedAt(int aRow,
int aColumn,
int anOrder)
Stores the fact that the given row and column coordinates contain a parcel with the given order number. |
protected void |
parcelRemoved(int aRow,
int aColumn,
Parcel aParcel)
Called when the given parcel has successfully been removed from the warehouse from the given location. |
protected void |
parcelRemovedFrom(int aRow,
int aColumn)
Stores the fact that the given row and column coordinates no longer contain a parcel. |
void |
quit()
Causes this device driver to quit operation. |
boolean |
removeOrder(Order anOrder)
Removes the given order from the warehouse and returns true,
or returns false if it could not be removed. |
void |
reset()
Resets this device driver. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected Warehouse warehouse
protected Crane crane
| Constructor Detail |
public ACraneStrategy()
| Method Detail |
public void installInto(Crane aCrane,
Warehouse aWarehouse)
aCrane - crane to be operated by this driveraWarehouse - warehouse in which the given crane operatespublic void reset()
public void quit()
public boolean addOrder(Order anOrder)
true,
or returns false if it could not be placed.
anOrder - order to placepublic boolean removeOrder(Order anOrder)
true,
or returns false if it could not be removed.
anOrder - order to remove
protected void parcelPlacedAt(int aRow,
int aColumn,
int anOrder)
aRow - row in warehouseaColumn - column in warehouseanOrder - order number
protected void parcelRemovedFrom(int aRow,
int aColumn)
aRow - row in warehouseaColumn - column in warehouse
protected int orderNumberAt(int aRow,
int aColumn)
aRow - row in warehouseaColumn - column in warehouseprotected void beginAdd(Order anOrder)
anOrder - order to be addedprotected void beginRemove(Order anOrder)
anOrder - order to be removedprotected Point getAddLocation(Parcel p)
p - the parcel to be addedprotected Point getRemoveLocation(Order anOrder)
anOrder -
protected void parcelAdded(int aRow,
int aColumn,
Parcel aParcel)
aRow - row in warehouseaColumn - column in warehouseaParcel - parcel that was added
protected void parcelRemoved(int aRow,
int aColumn,
Parcel aParcel)
aRow - row in warehouseaColumn - column in warehouseaParcel - parcel that was removedpublic abstract String getName()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||