PointND implements Serializable { public T get(int dimension) { return coordinates[dimension]; } PointND(T... coordinates); int getDimensions(); T get(int dimension); void set(int dimension, T coordinate); void setLocation(T... coordinates); Point2D getPoint2D(int dimX, int dimY); Point2D getPoint2D(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); static final int X; static final int Y; static final int Z; }
@Test public void testGet() { Double[] coordinates = {1.0, 2.0, 3.0, 4.0}; PointND<Double> p = new PointND<>(coordinates); for (int dim = 0; dim < coordinates.length; dim++) { assertEquals(coordinates[dim], p.get(dim)); } }