Interface Metric<T, D extends Comparable<? super D>>

Type Parameters:
T - the type of points
D - the type of distance

public interface Metric<T, D extends Comparable<? super D>>
A mathematical distance metric between two points.
Author:
Lee A. Christie
  • Method Summary

    Modifier and Type
    Method
    Description
    default Function<T,D>
    asHeuristic(T goal)
    Creates a heuristic function which takes any point and returns its istance to a predefined goal point.
    distance(T a, T b)
    Returns the distance between points a and b.
  • Method Details

    • distance

      D distance(T a, T b)
      Returns the distance between points a and b.
      Parameters:
      a - point a, not null
      b - point b, not null
      Returns:
      the distance
    • asHeuristic

      default Function<T,D> asHeuristic(T goal)
      Creates a heuristic function which takes any point and returns its istance to a predefined goal point.
      Parameters:
      goal - the goal to which the heuristic in aiming, not null.
      Returns:
      a function which calculates the heuristic form any given point to the fixed goal