Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.math.stat.clustering
Class EuclideanIntegerPoint

    java.lang.Object
      org.apache.commons.math.stat.clustering.EuclideanIntegerPoint

All Implemented Interfaces:
  java.io.Serializable, Clusterable<EuclideanIntegerPoint>

    public class EuclideanIntegerPoint

extends java.lang.Object
implements Clusterable<EuclideanIntegerPoint>, java.io.Serializable

A simple implementation of `Clusterable` for points with integer coordinates.

Since:
  2.0
Version:
  $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $
See Also:
  Serialized Form

Field Summary
`private int[]` | `point` Point coordinates.
`private static long` | `serialVersionUID` Serializable version identifier.

Constructor Summary
`EuclideanIntegerPoint(int[] point)` Build an instance wrapping an integer array.

Method Summary
`EuclideanIntegerPoint` | `centroidOf(java.util.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(java.lang.Object other)`
`int[]` | `getPoint()` Get the n-dimensional point in integer space.
`int` | `hashCode()`
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### serialVersionUID

    private static final long serialVersionUID

  Serializable version identifier.

  See Also:
    Constant Field Values

### point

    private final int[] point

  Point coordinates.

Constructor Detail

### EuclideanIntegerPoint

    public EuclideanIntegerPoint(int[] 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

### 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 interface `Clusterable<EuclideanIntegerPoint>`
  Parameters:
    `p` - the point to compute the distance from
  Returns:
    the distance from the given point

### centroidOf

    public EuclideanIntegerPoint centroidOf(java.util.Collection<EuclideanIntegerPoint> points)

  Returns the centroid of the given Collection of points.

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

### equals

    public boolean equals(java.lang.Object other)

  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`
  Since:
    2.1

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2003-2011 Apache Software Foundation