org.apache.commons.math3.stat.clustering
Class EuclideanDoublePoint

java.lang.Object
  extended by org.apache.commons.math3.stat.clustering.EuclideanDoublePoint
All Implemented Interfaces:
Serializable, Clusterable<EuclideanDoublePoint>

public class EuclideanDoublePoint
extends Object
implements Clusterable<EuclideanDoublePoint>, Serializable

A simple implementation of Clusterable for points with double coordinates.

Since:
3.1
Version:
$Id: EuclideanDoublePoint.java 1413096 2012-11-23 22:34:05Z erans $
See Also:
Serialized Form

Constructor Summary
EuclideanDoublePoint(double[] point)
          Build an instance wrapping an integer array.
 
Method Summary
 EuclideanDoublePoint centroidOf(Collection<EuclideanDoublePoint> points)
          Returns the centroid of the given Collection of points.
 double distanceFrom(EuclideanDoublePoint p)
          Returns the distance from the given point.
 boolean equals(Object other)
          
 double[] getPoint()
          Get the n-dimensional point in integer space.
 int hashCode()
          
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EuclideanDoublePoint

public EuclideanDoublePoint(double[] point)
Build an instance wrapping an integer array.

The wrapped array is referenced, it is not copied.

Parameters:
point - the n-dimensional point in integer space
Method Detail

centroidOf

public EuclideanDoublePoint centroidOf(Collection<EuclideanDoublePoint> points)
Returns the centroid of the given Collection of points.

Specified by:
centroidOf in interface Clusterable<EuclideanDoublePoint>
Parameters:
points - the Collection of points to compute the centroid of
Returns:
the centroid of the given Collection of Points

distanceFrom

public double distanceFrom(EuclideanDoublePoint p)
Returns the distance from the given point.

Specified by:
distanceFrom in interface Clusterable<EuclideanDoublePoint>
Parameters:
p - the point to compute the distance from
Returns:
the distance from the given point

equals

public boolean equals(Object other)

Overrides:
equals in class Object

getPoint

public double[] getPoint()
Get the n-dimensional point in integer space.

Returns:
a reference (not a copy!) to the wrapped array

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.