Class LocationTracker

  • All Implemented Interfaces:
    ch.sahits.game.openpatrician.model.sea.ILocationTracker

    @Component
    @Lazy
    public class LocationTracker
    extends java.lang.Object
    implements ch.sahits.game.openpatrician.model.sea.ILocationTracker
    Component that helps split up the amount of ships into segements of the navigable map. This reduces the omount of ships that need to be checked if a ship nearby is searched.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2015 Created on Dec 13, 2015
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.google.common.collect.Interner<javafx.geometry.Point2D> pointInterner  
    • Constructor Summary

      Constructors 
      Constructor Description
      LocationTracker()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)  
      java.util.List<ch.sahits.game.openpatrician.model.ship.INavigableVessel> getShipsInSegment​(javafx.geometry.Point2D location)  
      java.util.List<ch.sahits.game.openpatrician.model.ship.INavigableVessel> getShipsInSegments​(javafx.geometry.Point2D location, int radius)  
      void handleGameLoad​(ch.sahits.game.openpatrician.event.GameStateChange gameStateChange)  
      void handleShipMove​(ch.sahits.game.openpatrician.event.data.ShipPositionUpdateEvent event)  
      void remove​(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)  
      void updateSegmentSize​(int nbShips)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • pointInterner

        @Autowired
        protected com.google.common.collect.Interner<javafx.geometry.Point2D> pointInterner
    • Constructor Detail

      • LocationTracker

        public LocationTracker()
    • Method Detail

      • updateSegmentSize

        public void updateSegmentSize​(int nbShips)
      • add

        public void add​(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)
        Specified by:
        add in interface ch.sahits.game.openpatrician.model.sea.ILocationTracker
      • remove

        public void remove​(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)
      • getShipsInSegment

        public java.util.List<ch.sahits.game.openpatrician.model.ship.INavigableVessel> getShipsInSegment​(javafx.geometry.Point2D location)
      • getShipsInSegments

        public java.util.List<ch.sahits.game.openpatrician.model.ship.INavigableVessel> getShipsInSegments​(javafx.geometry.Point2D location,
                                                                                                           int radius)
      • handleShipMove

        public void handleShipMove​(ch.sahits.game.openpatrician.event.data.ShipPositionUpdateEvent event)
      • handleGameLoad

        public void handleGameLoad​(ch.sahits.game.openpatrician.event.GameStateChange gameStateChange)