Class WaitTimeForShipArrival

  • Direct Known Subclasses:
    ShipArrivalForLoading

    public abstract class WaitTimeForShipArrival
    extends ShipArivalInPortEventListener
    Wait for until a defined time for the arrival of a ship in a city. If the time has passed this event listener unregisters itself from the queue.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2013 Created on Feb 20, 2013
    • Field Detail

      • deadline

        private final java.time.LocalDateTime deadline
      • date

        @Autowired
        private Date date
    • Constructor Detail

      • WaitTimeForShipArrival

        public WaitTimeForShipArrival​(ICity city,
                                      IPlayer player,
                                      java.time.LocalDateTime deadline)
    • Method Detail

      • getDate

        public Date getDate()
      • handleShipEntersPort

        public void handleShipEntersPort​(ShipEntersPortEvent event)
        Description copied from class: ShipArivalInPortEventListener
        Handling the event when a ship enters the port. Subclasses are intended to override this implementation by extension implement the correct logic. This base implementation provides two points:
        1. if the player and city that triggered the event match with the ones listed to by this instance the ship is set on this instance
        2. Then the ShipArivalInPortEventListener.execute() method is called and if it returns true this instance is unregistered from the event bus. Otherwise the ship is set to null.
        Overrides:
        handleShipEntersPort in class ShipArivalInPortEventListener
        Parameters:
        event - for the ship entering the port