ProGAL.geomNd
Class PointList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<Point>
              extended by ProGAL.geomNd.PointList
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Point>, java.util.Collection<Point>, java.util.List<Point>, java.util.RandomAccess

public class PointList
extends java.util.ArrayList<Point>

An ArrayList-wrapper for storing Nd points. Adds functionality specific to point-sets such as finding centroid, diameter or covariance.

See Also:
Serialized Form

Constructor Summary
PointList(int dim)
          Construct an empty point-list.
PointList(Point[] elements)
          Construc a point-list from an array of points.
 
Method Summary
 boolean add(Point p)
           
 PointList clone()
          Get a shallow copy of this list.
static java.util.List<Point> generatePointsInCube(int n, int d)
           
 Point getCentroid()
          Get the centroid of the points.
 double getCoord(int k, int i)
          Returns the i'th coordinate of k'th point.
 Matrix getCovariance()
          Get the covariance of the points.
 PointList getRandomPermutation()
          Returns a new point-list containing all the elements in random order.
 double getStandardDeviation()
          Get the standard deviation of the point set.
 PointList getSubList(int from, int to)
          Returns a sub-list of elements from (including) from to (not including) to.
 double getVariance()
          Get the variance of the points.
 void toConsole()
          Writes this point-list to System.out.
 void toConsole(int dec)
          Writes this point-list to System.out.
 
Methods inherited from class java.util.ArrayList
add, addAll, addAll, clear, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

PointList

public PointList(int dim)
Construct an empty point-list.


PointList

public PointList(Point[] elements)
Construc a point-list from an array of points.

Method Detail

add

public boolean add(Point p)
Specified by:
add in interface java.util.Collection<Point>
Specified by:
add in interface java.util.List<Point>
Overrides:
add in class java.util.ArrayList<Point>

getCoord

public double getCoord(int k,
                       int i)
Returns the i'th coordinate of k'th point.


getSubList

public PointList getSubList(int from,
                            int to)
Returns a sub-list of elements from (including) from to (not including) to. The returned sub-list is not a 'view' of the sublist (such as AbstractList.subList), but a shallow copy of the specified range.


getRandomPermutation

public PointList getRandomPermutation()
Returns a new point-list containing all the elements in random order.


getCentroid

public Point getCentroid()
Get the centroid of the points.


getVariance

public double getVariance()
Get the variance of the points.


getCovariance

public Matrix getCovariance()
Get the covariance of the points.


getStandardDeviation

public double getStandardDeviation()
Get the standard deviation of the point set.


clone

public PointList clone()
Get a shallow copy of this list.

Overrides:
clone in class java.util.ArrayList<Point>

toConsole

public void toConsole()
Writes this point-list to System.out.


toConsole

public void toConsole(int dec)
Writes this point-list to System.out.


generatePointsInCube

public static java.util.List<Point> generatePointsInCube(int n,
                                                         int d)