Class ConvoyService


  • public class ConvoyService
    extends java.lang.Object
    Service for various actions around convoys.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2018 Created on Sep 23, 2018
    • Field Detail

      • clientServerEventBus

        @Autowired
        @Qualifier("serverClientEventBus")
        private com.google.common.eventbus.AsyncEventBus clientServerEventBus
      • shipFactory

        @Autowired
        private ShipFactory shipFactory
      • convoyList

        @Autowired
        private ConvoyList convoyList
      • shipService

        @Autowired
        private ShipService shipService
      • date

        @Autowired
        private Date date
    • Constructor Detail

      • ConvoyService

        public ConvoyService()
    • Method Detail

      • join

        public void join​(IConvoy convoy,
                         IShip ship)
        Ship joining an existing convoy.
        Parameters:
        convoy - that is joined
        ship - joining ship
      • leave

        public void leave​(IConvoy convoy,
                          IShip ship)
        Ship leaving a convoy.
        Parameters:
        convoy - that is left.
        ship - leafing ship
      • dissolve

        public java.util.List<IShip> dissolve​(IConvoy convoy,
                                              ICity city)
        Dissolving a convoy.
        Parameters:
        convoy - that is being dissolved
        Returns:
        list of all the ships that were part of the convoy.
      • create

        public IConvoy create​(IShip orleg,
                              boolean publicConvoy)
        Create a new convoy.
        Parameters:
        orleg - ship of the convoy
        publicConvoy - flag indicating if it is a public or private convoy.
        Returns:
        newly created convoy.
      • outfitAsOrleg

        public java.util.Optional<IShip> outfitAsOrleg​(IShip ship,
                                                       ICity city)
        Outfit a ship to be orleg capable. This means required weapon strength and enouth sailors. Should the outfitting be possible on the spot, the outfitted ship is returned, otherwise outfitting is scheduled and empty is returned.
        Parameters:
        ship - to be outfitted
        city - where is to be outfitted
        Returns:
        outfitted ship or empty if the ship cannot be outfitted or outfitting is scheduled.