Class WeaponsDealerState
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.people.impl.WeaponsDealerState
-
- All Implemented Interfaces:
IPerson,IWeaponsDealer
public class WeaponsDealerState extends java.lang.Object implements IWeaponsDealer
Implementation of the weapons dealer.- Author:
- Andi Hotz, (c) Sahits GmbH, 2013 Created on Jan 25, 2013
-
-
Constructor Summary
Constructors Constructor Description WeaponsDealerState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javafx.beans.property.ReadOnlyIntegerPropertyamountAvailableProperty(EWeapon weapon)Property representing the amount that can be bought from the dealer.protected booleancontainsWeapon(IWeapon weapons)Check if there is an amountable object for this warevoidinit()intmove(IWeapon weapon, int amount)Move ware into this holding.voidsetCity(ICity city)Set the city.
-
-
-
Method Detail
-
init
@PostConstruct public void init()
-
move
public int move(IWeapon weapon, int amount)
Move ware into this holding. The player may be null and is not used in this base implementation, but subclasses may be interested for statistical reasons. This method is thread save.- Specified by:
movein interfaceIWeaponsDealer- Parameters:
weapon- to be movedamount- of the ware that is moved- Returns:
- the effective amount that was moved. The amount may be positive if something was added, negative if the ware was removed from the holding or zero if nothing was moved.
-
containsWeapon
protected final boolean containsWeapon(IWeapon weapons)
Check if there is an amountable object for this ware- Parameters:
weapons- to be checked- Returns:
- true if the weapon is contained.
-
amountAvailableProperty
public javafx.beans.property.ReadOnlyIntegerProperty amountAvailableProperty(EWeapon weapon)
Description copied from interface:IWeaponsDealerProperty representing the amount that can be bought from the dealer.- Specified by:
amountAvailablePropertyin interfaceIWeaponsDealer- Parameters:
weapon- that is to be sold- Returns:
- integer binding representing the amount of the weapon that can be bought.
-
setCity
public void setCity(ICity city)
Description copied from interface:IWeaponsDealerSet the city.- Specified by:
setCityin interfaceIWeaponsDealer- Parameters:
city- in which the weapons dealer operates
-
-