com.dreizak.miniball.model
Class ArrayPointSet

java.lang.Object
  extended by com.dreizak.miniball.model.ArrayPointSet
All Implemented Interfaces:
PointSet

public final class ArrayPointSet
extends java.lang.Object
implements PointSet

A PointSet that stores n d-dimensional points in a Java array of doubles.


Constructor Summary
ArrayPointSet(int d, int n)
          Creates an array-based point set to store n d-dimensional points.
 
Method Summary
 double coord(int i, int j)
          The jth Euclidean coordinate of the ith point.
 int dimension()
          The dimension of the ambient space of the points.
 void set(int i, int j, double v)
          Sets the jth Euclidean coordinate of the ith point to the given value.
 int size()
          Number of points.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayPointSet

public ArrayPointSet(int d,
                     int n)
Creates an array-based point set to store n d-dimensional points.

Parameters:
d - the dimensions of the ambient space
n - the number of points
Method Detail

size

public int size()
Description copied from interface: PointSet
Number of points.

Specified by:
size in interface PointSet
Returns:
the number of points in the point set.

dimension

public int dimension()
Description copied from interface: PointSet
The dimension of the ambient space of the points.

Each point has dimension() many Euclidean coordinates.

Specified by:
dimension in interface PointSet
Returns:
the dimension of the ambient space

coord

public double coord(int i,
                    int j)
Description copied from interface: PointSet
The jth Euclidean coordinate of the ith point.

Specified by:
coord in interface PointSet
Parameters:
i - the number of the point, 0 ≤ i < size()
j - the dimension of the coordinate of interest, 0 ≤ j ≤ dimension()
Returns:
the jth Euclidean coordinate of the ith point

set

public void set(int i,
                int j,
                double v)
Sets the jth Euclidean coordinate of the ith point to the given value.

Parameters:
i - the number of the point, 0 ≤ i < size()
j - the dimension of the coordinate of interest, 0 ≤ j ≤ dimension()
v - the value to set as the jth Euclidean coordinate of the ith point

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2013. All Rights Reserved.