Class AutomatedTrading

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.HashMap<IWare,​TradableWare> wares  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javafx.beans.property.IntegerProperty amountProperty​(IWare ware)
      Get to the amount property of the tradeable ware.
      int getAmount​(IWare ware)
      Retrieve the minimal amount of the ware that should be hold in the storage.
      int getPrice​(IWare ware)
      Retrieve the price up to which the ware is bought or the minimal price for which it is sold.
      boolean isMovableToShip​(IWare ware)
      Check if this ware can be moved onto ships with automated trading routes
      javafx.beans.property.BooleanProperty movableToShipProperty​(IWare ware)
      Get the movable to ship flag.
      javafx.beans.property.IntegerProperty priceProperty​(IWare ware)
      Get the price property of the tradable ware.
      void setMovableToShip​(IWare ware, boolean isMovable)
      Set the movable flag
      void setTradingType​(IWare ware, ETradeType tt)
      Set the Trayding type.
      javafx.beans.property.ObjectProperty<ETradeType> tradingTypeProperty​(IWare ware)
      Retrieve the trading type of the ware.
      void updateAmount​(IWare ware, int difference)
      Update the amount of ware
      void updatePrice​(IWare ware, int difference)
      Update the price of the ware
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AutomatedTrading

        public AutomatedTrading()
    • Method Detail

      • getAmount

        public int getAmount​(IWare ware)
        Description copied from interface: IAutomatedTrading
        Retrieve the minimal amount of the ware that should be hold in the storage.
        Specified by:
        getAmount in interface IAutomatedTrading
        Parameters:
        ware - to be hold
        Returns:
        amount of that ware
      • amountProperty

        public javafx.beans.property.IntegerProperty amountProperty​(IWare ware)
        Description copied from interface: IAutomatedTrading
        Get to the amount property of the tradeable ware.
        Specified by:
        amountProperty in interface IAutomatedTrading
        Parameters:
        ware - for which to retrieve the amount
        Returns:
        max amount property that should be stored
      • getPrice

        public int getPrice​(IWare ware)
        Description copied from interface: IAutomatedTrading
        Retrieve the price up to which the ware is bought or the minimal price for which it is sold.
        Specified by:
        getPrice in interface IAutomatedTrading
        Parameters:
        ware - to be bought or sold
        Returns:
        price
      • priceProperty

        public javafx.beans.property.IntegerProperty priceProperty​(IWare ware)
        Description copied from interface: IAutomatedTrading
        Get the price property of the tradable ware.
        Specified by:
        priceProperty in interface IAutomatedTrading
        Parameters:
        ware - for which to retrieve the price
        Returns:
        max price property
      • tradingTypeProperty

        public javafx.beans.property.ObjectProperty<ETradeType> tradingTypeProperty​(IWare ware)
        Description copied from interface: IAutomatedTrading
        Retrieve the trading type of the ware. There are only three types applicable: NONE, OFFICE_CITY and CITY_OFFICE
        Specified by:
        tradingTypeProperty in interface IAutomatedTrading
        Parameters:
        ware - that should be checked
        Returns:
        trading type of the ware.
      • isMovableToShip

        public boolean isMovableToShip​(IWare ware)
        Description copied from interface: IAutomatedTrading
        Check if this ware can be moved onto ships with automated trading routes
        Specified by:
        isMovableToShip in interface IAutomatedTrading
        Parameters:
        ware - that should be checked
        Returns:
        true if the ware can be moved to a ship
      • movableToShipProperty

        public javafx.beans.property.BooleanProperty movableToShipProperty​(IWare ware)
        Description copied from interface: IAutomatedTrading
        Get the movable to ship flag.
        Specified by:
        movableToShipProperty in interface IAutomatedTrading
        Parameters:
        ware - for which to retrieve the movable flag
        Returns:
        boolean property indicating if the ware is movable to a ship
      • updateAmount

        public void updateAmount​(IWare ware,
                                 int difference)
        Description copied from interface: IAutomatedTrading
        Update the amount of ware
        Specified by:
        updateAmount in interface IAutomatedTrading
        Parameters:
        ware - to be updated
        difference - in the amount
      • updatePrice

        public void updatePrice​(IWare ware,
                                int difference)
        Description copied from interface: IAutomatedTrading
        Update the price of the ware
        Specified by:
        updatePrice in interface IAutomatedTrading
        Parameters:
        ware - to be updated
        difference - in the price
      • setTradingType

        public void setTradingType​(IWare ware,
                                   ETradeType tt)
        Description copied from interface: IAutomatedTrading
        Set the Trayding type. Only allowed types are NONE, OFFICE_CITY and CITY_OFFICE
        Specified by:
        setTradingType in interface IAutomatedTrading
        Parameters:
        ware - to be updated
        tt - trade type to set
      • setMovableToShip

        public void setMovableToShip​(IWare ware,
                                     boolean isMovable)
        Description copied from interface: IAutomatedTrading
        Set the movable flag
        Specified by:
        setMovableToShip in interface IAutomatedTrading
        Parameters:
        ware - to be updated
        isMovable - flag if the ware is movable to a ship