Class 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 Detail

      • WeaponsDealerState

        public WeaponsDealerState()
    • 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:
        move in interface IWeaponsDealer
        Parameters:
        weapon - to be moved
        amount - 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.
      • getWeapon

        private int getWeapon​(IWeapon weapon)
        Retrieve the amount of the weapon that belongs to the dealer.
        Parameters:
        weapon - type of weapon
        Returns:
        amount available at the time of the call of the method.
      • amountAvailableProperty

        public javafx.beans.property.ReadOnlyIntegerProperty amountAvailableProperty​(EWeapon weapon)
        Description copied from interface: IWeaponsDealer
        Property representing the amount that can be bought from the dealer.
        Specified by:
        amountAvailableProperty in interface IWeaponsDealer
        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: IWeaponsDealer
        Set the city.
        Specified by:
        setCity in interface IWeaponsDealer
        Parameters:
        city - in which the weapons dealer operates