Module ojalgo

Class Point

  • All Implemented Interfaces:
    java.lang.Comparable<Point>

    public final class Point
    extends java.lang.Object
    implements java.lang.Comparable<Point>
    Immutable coordinate point used by the clustering utilities. A Point wraps a float[] (to minimise memory footprint) and an id. Distance calculations are central to most algorithms.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Point.Factory
      Simple factory that generates consecutive ids and ensures consistent dimensionality.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      float[] coordinates
      Features
      int id
      Index/Key
    • Constructor Summary

      Constructors 
      Constructor Description
      Point​(int id, float[] coordinates)  
    • Field Detail

      • coordinates

        public final float[] coordinates
        Features
      • id

        public final int id
        Index/Key
    • Constructor Detail

      • Point

        Point​(int id,
              float[] coordinates)
    • Method Detail

      • mean

        public static double[] mean​(java.util.Collection<Point> points)
      • of

        public static Point of​(int id,
                               float... coordinates)
        Creates a point with the supplied id and coordinates (no defensive copy). Caller must ensure the coordinate array is not mutated afterwards if logical immutability is desired.
      • compareTo

        public int compareTo​(Point ref)
        Specified by:
        compareTo in interface java.lang.Comparable<Point>
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object