Class TravellingVessels

  • All Implemented Interfaces:
    ITravellingVessels, java.lang.Iterable<INavigableVessel>

    @Component
    @Lazy
    public class TravellingVessels
    extends java.lang.Object
    implements ITravellingVessels
    This iterable collection stores all vessels that are currently travelling. Vessels should be added when they start their travel and be removed when they reach their destination or otherwise stop traveling (e.g. are sunk).
    Author:
    Andi Hotz, (c) Sahits GmbH, 2016 Created on Jan 08, 2016
    • Constructor Detail

      • TravellingVessels

        public TravellingVessels()
    • Method Detail

      • addVessel

        public void addVessel​(INavigableVessel vessel,
                              java.util.Optional<javafx.scene.shape.Path> path,
                              java.util.List<javafx.geometry.Point2D> points)
        The vessel starts it's travel and must be added to this collection together with its data.
        Parameters:
        vessel - that starts the travel
        path - the Bezière path representing the route.
        points - the list of points that make up the path along which the vessel is travelling.
      • setTravelDestionation

        private void setTravelDestionation​(IShip vessel,
                                           java.util.Optional<ICity> destCity)
      • remove

        public void remove​(INavigableVessel vessel)
        The vessel is no longer travelling and should no longer be part of this collection.
        Parameters:
        vessel - to be removed
      • findCity

        public java.util.Optional<ICity> findCity​(javafx.geometry.Point2D location)
        Find the city that is located at the postion location.
        Parameters:
        location - that should be checked.
        Returns:
        Optional of a ICity if there is a city at location.