Class XYSearcher

  • All Implemented Interfaces:
    Searcher<AngleHint>

    public class XYSearcher
    extends java.lang.Object
    implements Searcher<AngleHint>
    This type of Searcher holds the numbers maxX, maxY, minX, minY, and updates these.

    This Hider works only for AngleHint with an angle ≤ {@link Math#PI}/2. Thus, this Searcher always gets one or two directions, in which the treasure lies for sure.

    If the searcher knows only a minimum X, but no maximum X (or knows only a maximum X, but no minimum X), he will go in the correct X-direction and double its moving-distance each time.

    Otherwise, if the searcher knows both a minimum X and a maximum X, he will go to the middle of these interval.

    The same holds for the Y coordinates.

    • Constructor Summary

      Constructors 
      Constructor Description
      XYSearcher()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void init​(org.locationtech.jts.geom.Point searcherStartPosition)
      SearchPath move()
      Use this to perform a initial move, without a hint given.
      SearchPath move​(AngleHint angleHint)
      If the searcher knows only a minimum X, but no maximum X (or knows only a maximum X, but no minimum X), he will go in the correct X-direction and double its moving-distance each time.
      • Methods inherited from class java.lang.Object

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

      • XYSearcher

        public XYSearcher()
    • Method Detail

      • init

        public void init​(org.locationtech.jts.geom.Point searcherStartPosition)
        Specified by:
        init in interface Searcher<AngleHint>
        Parameters:
        searcherStartPosition - the Searcher starting position, he will initialized on.
      • move

        public SearchPath move()
        Description copied from interface: Searcher
        Use this to perform a initial move, without a hint given. This is for the case, the searcher starts. (as he does normally)
        Specified by:
        move in interface Searcher<AngleHint>
        Returns:
        SearchPath, containing only the starting position.
      • move

        public SearchPath move​(AngleHint angleHint)
        If the searcher knows only a minimum X, but no maximum X (or knows only a maximum X, but no minimum X), he will go in the correct X-direction and double its moving-distance each time.

        Otherwise, if the searcher knows both a minimum X and a maximum X, he will go to the middle of these interval.

        The same holds for the Y coordinates.

        Specified by:
        move in interface Searcher<AngleHint>
        Parameters:
        angleHint - the hint, the Hider gave last.
        Returns:
        SearchPath the SearchPath, this searcher chose.