Class PositionReferenceFinder

java.lang.Object
PamController.positionreference.PositionReferenceFinder

public class PositionReferenceFinder extends Object
Find a Position Reference, based on a preferred order. Options to take anything available if nothing in list exists.
Author:
Doug
  • Constructor Details

    • PositionReferenceFinder

      public PositionReferenceFinder(List<Class> preferredList, boolean acceptAnything)
      Construct a class to find and managed PositionReference Preferences
      Parameters:
      preferredList - list or preferred reference types in preferred order
      acceptAnything - accept anything if nothing in the preferred list exists.
    • PositionReferenceFinder

      public PositionReferenceFinder(Class[] preferredList, boolean acceptAnything)
      Construct a class to find and managed PositionReference Preferences
      Parameters:
      preferredList - list or preferred reference types in preferred order
      acceptAnything - accept anything if nothing in the preferred list exists.
  • Method Details

    • findReference

      public PositionReference findReference()
      Try to find a reference position based on the set rules.
      Returns:
    • findAnyReference

      public PositionReference findAnyReference()
      Find any available PositionReference
      Returns:
      first available position reference
    • findPreferredReference

      public PositionReference findPreferredReference()
      Find the preferred position reference
      Returns:
      the first available position reference in the preferred list.
    • findAllReferences

      public List<PositionReference> findAllReferences()
      Get a list of all available position references
      Returns:
      list of available position references
    • findReference

      public PositionReference findReference(Class referenceClass)
      Find the first available reference for a given class type
      Parameters:
      referenceClass - class of PositionReference
      Returns:
      position reference
    • getPreferredList

      public List<Class> getPreferredList()
      Returns:
      the preferredList
    • setPreferredList

      public void setPreferredList(List<Class> preferredList)
      Parameters:
      preferredList - the preferredList to set
    • isAcceptAnything

      public boolean isAcceptAnything()
      Returns:
      the acceptAnything
    • setAcceptAnything

      public void setAcceptAnything(boolean acceptAnything)
      Parameters:
      acceptAnything - the acceptAnything to set
    • distanceToAirgun

      public Double distanceToAirgun(LatLong latLong, long timeMillis)
      Get the distance to the nearest Airgun array from the given position. 2D distance only !
      Parameters:
      timeMillis - Current time in milliseconds.
      sequencePos - Position of generated sequence
      Returns:
      smallest distance or null.
    • distanceToNearest

      public Double distanceToNearest(LatLong latLong, Class<?> referenceType, long timeMillis)
      Find the 2D distance to the nearest reference position of a given type.
      Parameters:
      latLong - location of start point
      referenceType - Type of position reference
      timeMillis - Millisecond time
      Returns:
      distance in metres, or null if no reference found.
    • findNearest

      public PositionReference findNearest(LatLong latLong, Class<?> referenceType, long timeMillis)
      Find the nearest reference position of a given type.
      Parameters:
      latLong - location of start point
      referenceType - Type of position reference
      timeMillis - Millisecond time
      Returns:
      distance in metres, or null if no reference found.