org.apache.commons.math3.stat.clustering

## Class EuclideanIntegerPoint

- java.lang.Object
- - org.apache.commons.math3.stat.clustering.EuclideanIntegerPoint

- All Implemented Interfaces:
    Serializable, Clusterable<EuclideanIntegerPoint>

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

  A simple implementation of `Clusterable` for points with integer coordinates.
  Since:
    2.0
  Version:
    $Id: EuclideanIntegerPoint.java 1416643 2012-12-03 19:37:14Z tn $
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private int[]` | `point` Point coordinates.
    `private static long` | `serialVersionUID` Serializable version identifier.

  - ### Constructor Summary

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and 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()`

    - ### 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(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(Object other)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`
      Since:
        2.1

Copyright (c) 2003-2013 Apache Software Foundation