|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectch.sahits.game.openpatrician.model.ship.impl.Ship
abstract class Ship
| Field Summary | |
|---|---|
protected int |
fitness
Fitness of the ship. |
private int |
initialValue
Initial value of the ship |
private Map<IWare,AmountablePrice> |
loadedWare
Store the wares loaded on the ship together with their amount. |
protected String |
name
Name of the ship |
protected EShipUpgrade |
upgradeLevel
State of the design standard level |
private ArrayList<WeaponsLocation> |
weapons
List of the weapons on board together with their location |
| Constructor Summary | |
|---|---|
Ship(int value)
|
|
| Method Summary | |
|---|---|
protected void |
clearLoadedWares()
Clear all loaded wares. |
private int |
ensureCapacity(int amount)
Check if the amount can be loaded |
int |
getLoad()
Retrieve the amount of load in barrels that is loaded in actual wares (no wappen or crew) |
Set<IWare> |
getLoadedWares()
Retrieve a list of all loaded wares |
String |
getName()
Retrieve the name of the of the ship |
private EShipSide |
getNextFreeSide(IWeapon weapon)
Retrieve the side of the next free slot where the weapon can be placed. |
private int |
getNextFreeSlot(IWeapon weapon,
EShipSide side)
Retrieve the next free slot for the weapon on the side. |
int |
getValue()
Retrieve the current value of the ship without its cargo |
AmountablePrice |
getWare(IWare ware)
Retrieve the amount of ware loaded |
boolean |
hasWeapons()
check if weapons are on board |
boolean |
isUpgradable()
Check if the ship can be upgraded |
int |
load(IWare ware,
int amount,
int avgPrice)
Load the ware in the specified amount onto the ship. |
void |
setName(String name)
Set the ships name |
int |
unload(IWare ware,
int amount)
Unload the specified quantity of the ware. |
void |
upgrade()
Upgrade the ship if it is upgradable |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface ch.sahits.game.openpatrician.model.ship.IShip |
|---|
damage, getCapacity, getDamage, getSize, getUpgradeSpaceReduction, repair |
| Field Detail |
|---|
protected EShipUpgrade upgradeLevel
protected String name
private Map<IWare,AmountablePrice> loadedWare
private final ArrayList<WeaponsLocation> weapons
protected int fitness
private final int initialValue
| Constructor Detail |
|---|
public Ship(int value)
| Method Detail |
|---|
public boolean isUpgradable()
IShip
isUpgradable in interface IShippublic void upgrade()
IShip
upgrade in interface IShippublic String getName()
IShip
getName in interface IShippublic Set<IWare> getLoadedWares()
IShip
getLoadedWares in interface IShip
public int load(IWare ware,
int amount,
int avgPrice)
load in interface IShipware - to be loadedamount - of items the wareavgPrice - average price of one item of the ware
private int ensureCapacity(int amount)
amount -
public int unload(IWare ware,
int amount)
unload in interface IShipware - to be unloadedamount - amount of items of ware to unload
public void setName(String name)
IShip
setName in interface IShippublic int getLoad()
IShip
getLoad in interface IShipprotected void clearLoadedWares()
public AmountablePrice getWare(IWare ware)
IShip
getWare in interface IShipprivate EShipSide getNextFreeSide(IWeapon weapon)
weapon - to be placed
EShipSide.PORT, EShipSide.STARBOARD or null
private int getNextFreeSlot(IWeapon weapon,
EShipSide side)
weapon - to be placedside - to be checked EShipSide.PORT or EShipSide.STARBOARD
public boolean hasWeapons()
IShip
hasWeapons in interface IShippublic int getValue()
IShip
getValue in interface IShip
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||