Class AggregatedBuyTradingOfficeTradeStep

  • All Implemented Interfaces:
    ITradeStep

    public class AggregatedBuyTradingOfficeTradeStep
    extends java.lang.Object
    implements ITradeStep
    Aggregate multiple BuySteps for the trading office.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2016 Created on Dec 21, 2016
    • Field Detail

      • city

        private ICity city
      • context

        @Autowired
        private org.springframework.context.ApplicationContext context
      • retainCash

        private long retainCash
    • Constructor Detail

      • AggregatedBuyTradingOfficeTradeStep

        public AggregatedBuyTradingOfficeTradeStep()
    • Method Detail

      • addBuyStep

        public void addBuyStep​(IWare ware,
                               int maxPrice)
      • getPriorityList

        private java.util.List<BuyTradingOfficeTradeStep> getPriorityList()
        Sort the list of wares that should be bought so that the wares with the least amount are at the begining of the list.
        Returns:
        priority sorted ware list.
      • execute

        public boolean execute()
        Description copied from interface: ITradeStep
        Execute the trade step.
        Specified by:
        execute in interface ITradeStep
        Returns:
        true if the next step can be executed on completion or if the execution is triggered by the arrival of the ship in the next port.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object