ch.sahits.game.openpatrician.model.building.impl
Class WeaponStorage

java.lang.Object
  extended by ch.sahits.game.openpatrician.model.building.impl.WeaponStorage
All Implemented Interfaces:
IWeaponStorage

public class WeaponStorage
extends Object
implements IWeaponStorage

Implementation for the storage of weapons

Author:
Andi Hotz, (c) Sahits GmbH, 2012 Created on Jul 25, 2012

Field Summary
private  Hashtable<IWeapon,BaseAmountable<IWeapon>> storage
           
 
Constructor Summary
WeaponStorage()
           
 
Method Summary
 int getWeapon(IWeapon weapon)
          Retrieve the amount of weapons in storage
 boolean hasWeapons()
          check if there are any weapons stored
 int update(IWeapon weapon, int amount)
          Move weapons in or out of storage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

storage

private Hashtable<IWeapon,BaseAmountable<IWeapon>> storage
Constructor Detail

WeaponStorage

public WeaponStorage()
Method Detail

getWeapon

public int getWeapon(IWeapon weapon)
Description copied from interface: IWeaponStorage
Retrieve the amount of weapons in storage

Specified by:
getWeapon in interface IWeaponStorage
Returns:

update

public int update(IWeapon weapon,
                  int amount)
Description copied from interface: IWeaponStorage
Move weapons in or out of storage

Specified by:
update in interface IWeaponStorage
Parameters:
weapon - type of weapon
amount - 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 interface IWeaponStorage
Returns:


Copyright © 2011-2012 Sahits GmbH. All Rights Reserved.