Class EuclideanIntegerPoint
- java.lang.Object
-
- org.apache.commons.math.stat.clustering.EuclideanIntegerPoint
-
- All Implemented Interfaces:
Serializable
,Clusterable<EuclideanIntegerPoint>
public class EuclideanIntegerPoint extends Object implements Clusterable<EuclideanIntegerPoint>, Serializable
A simple implementation ofClusterable
for points with integer coordinates.- Since:
- 2.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description EuclideanIntegerPoint(int[] point)
Build an instance wrapping an integer array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EuclideanIntegerPoint
centroidOf(Collection<EuclideanIntegerPoint> points)
Returns the centroid of the given Collection of points.double
distanceFrom(EuclideanIntegerPoint p)
Returns the distance from the given point.boolean
equals(Object other)
int[]
getPoint()
Get the n-dimensional point in integer space.int
hashCode()
String
toString()
-
-
-
Method Detail
-
getPoint
public int[] getPoint()
Get the n-dimensional point in integer space.- Returns:
- a reference (not a copy!) to the wrapped array
-
distanceFrom
public double distanceFrom(EuclideanIntegerPoint p)
Returns the distance from the given point.- Specified by:
distanceFrom
in interfaceClusterable<EuclideanIntegerPoint>
- Parameters:
p
- the point to compute the distance from- Returns:
- the distance from the given point
-
centroidOf
public EuclideanIntegerPoint centroidOf(Collection<EuclideanIntegerPoint> points)
Returns the centroid of the given Collection of points.- Specified by:
centroidOf
in interfaceClusterable<EuclideanIntegerPoint>
- Parameters:
points
- the Collection of points to compute the centroid of- Returns:
- the centroid of the given Collection of Points
-
-