Class WeaponStorage
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.building.impl.WeaponStorage
-
- All Implemented Interfaces:
IWeaponStorage
public class WeaponStorage extends java.lang.Object implements IWeaponStorage
Implementation for the storage of weapons- Author:
- Andi Hotz, (c) Sahits GmbH, 2012 Created on Jul 25, 2012
-
-
Field Summary
Fields Modifier and Type Field Description private AmountableProvider
amountableProvider
private java.util.Hashtable<IWeapon,BaseAmountable<IWeapon>>
storage
-
Constructor Summary
Constructors Constructor Description WeaponStorage()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getWeapon(IWeapon weapon)
Retrieve the amount of weapons in storagejavafx.beans.property.ReadOnlyIntegerProperty
getWeaponProperty(IWeapon weapon)
Retrieve the property holding the mount of stored weapons of the indicated type.boolean
hasWeapons()
check if there are any weapons storedprivate void
init()
int
update(IWeapon weapon, int amount)
Move weapons in or out of storage
-
-
-
Field Detail
-
storage
private java.util.Hashtable<IWeapon,BaseAmountable<IWeapon>> storage
-
amountableProvider
@Autowired private AmountableProvider amountableProvider
-
-
Method Detail
-
init
@PostConstruct private void init()
-
getWeapon
public int getWeapon(IWeapon weapon)
Description copied from interface:IWeaponStorage
Retrieve the amount of weapons in storage- Specified by:
getWeapon
in interfaceIWeaponStorage
- Parameters:
weapon
- for which to retrieve the amount- Returns:
- amount of
weapon
stored.
-
update
public int update(IWeapon weapon, int amount)
Description copied from interface:IWeaponStorage
Move weapons in or out of storage- Specified by:
update
in interfaceIWeaponStorage
- Parameters:
weapon
- type of weaponamount
- to be moved (positive means into the storage, negative out of the storage)- Returns:
- amount that is moved
-
hasWeapons
public boolean hasWeapons()
Description copied from interface:IWeaponStorage
check if there are any weapons stored- Specified by:
hasWeapons
in interfaceIWeaponStorage
- Returns:
- true if weapons are stored
-
getWeaponProperty
public javafx.beans.property.ReadOnlyIntegerProperty getWeaponProperty(IWeapon weapon)
Description copied from interface:IWeaponStorage
Retrieve the property holding the mount of stored weapons of the indicated type.- Specified by:
getWeaponProperty
in interfaceIWeaponStorage
- Parameters:
weapon
- for which to retrieve the amount- Returns:
- read only property of the amount of stored
weapon
-
-