Class TravellingVessels
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.sea.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 Summary
Constructors Constructor Description TravellingVessels()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddVessel(INavigableVessel vessel, java.util.Optional<javafx.scene.shape.Path> path, java.util.List<javafx.geometry.Point2D> points)Thevesselstarts it's travel and must be added to this collection together with its data.java.util.Optional<ICity>findCity(javafx.geometry.Point2D location)Find the city that is located at the postionlocation.TravellingVesselgetTravellingVessel(INavigableVessel vessel)Retrieve the meta date for a travelling vessel.booleanisTravelling(INavigableVessel vessel)Check if the vessel is currently travelling.java.util.Iterator<INavigableVessel>iterator()voidremove(INavigableVessel vessel)The vessel is no longer travelling and should no longer be part of this collection.
-
-
-
Method Detail
-
addVessel
public void addVessel(INavigableVessel vessel, java.util.Optional<javafx.scene.shape.Path> path, java.util.List<javafx.geometry.Point2D> points)
Thevesselstarts it's travel and must be added to this collection together with its data.- Parameters:
vessel- that starts the travelpath- the Bezière path representing the route.points- the list of points that make up the path along which thevesselis travelling.
-
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
-
iterator
public java.util.Iterator<INavigableVessel> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<INavigableVessel>- Specified by:
iteratorin interfaceITravellingVessels
-
getTravellingVessel
public TravellingVessel getTravellingVessel(INavigableVessel vessel)
Description copied from interface:ITravellingVesselsRetrieve the meta date for a travelling vessel.- Specified by:
getTravellingVesselin interfaceITravellingVessels- Parameters:
vessel- for which to get the travelling instance- Returns:
- TravellingVessel instance for
vessel
-
isTravelling
public boolean isTravelling(INavigableVessel vessel)
Description copied from interface:ITravellingVesselsCheck if the vessel is currently travelling.- Specified by:
isTravellingin interfaceITravellingVessels- Parameters:
vessel- to be checked if it is travelling- Returns:
- true if there is an instance of
TravellingVesselforvessel
-
findCity
public java.util.Optional<ICity> findCity(javafx.geometry.Point2D location)
Find the city that is located at the postionlocation.- Parameters:
location- that should be checked.- Returns:
- Optional of a ICity if there is a city at
location.
-
-