- java.lang.Object
-
- org.ojalgo.data.cluster.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. APointwraps afloat[](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 classPoint.FactorySimple factory that generates consecutive ids and ensures consistent dimensionality.
-
Field Summary
Fields Modifier and Type Field Description float[]coordinatesFeaturesintidIndex/Key
-
Constructor Summary
Constructors Constructor Description Point(int id, float[] coordinates)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Point ref)doubledistance(DistanceMeasure measure, Point other)Distance using the suppliedDistanceMeasure.booleanequals(java.lang.Object obj)inthashCode()static double[]mean(java.util.Collection<Point> points)static Point.FactorynewFactory()static Pointof(int id, float... coordinates)Creates a point with the supplied id and coordinates (no defensive copy).java.lang.StringtoString()
-
-
-
Method Detail
-
mean
public static double[] mean(java.util.Collection<Point> points)
-
newFactory
public static Point.Factory newFactory()
-
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:
compareToin interfacejava.lang.Comparable<Point>
-
distance
public double distance(DistanceMeasure measure, Point other)
Distance using the suppliedDistanceMeasure.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-