
com.panayotis.gnuplot.dataset.Point Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pa-toolbox-extern-javaplot Show documentation
Show all versions of pa-toolbox-extern-javaplot Show documentation
This JavaPlot library has not been written by me (the author of the PA-Toolbox project).
See the given URL for the original JavaPlot project.
These files have been extracted from the download JavaPlot-0.5.0.tar.bz2.
It is included here just to resolve external dependencies of other PA-Toolbox submodules.
The newest version!
/* Copyright (c) 2007-2014 by panayotis.com
*
* JavaPlot is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 2.
*
* JavaPlot is free in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CrossMobile; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Created on October 15, 2007, 1:54 AM
*/
package com.panayotis.gnuplot.dataset;
import java.io.Serializable;
import java.lang.reflect.Array;
/**
* This object represents a N-dimensional point. It is used in PointDataSet as
* the actual data object
*
* @param N the type of this object. It should be a Number
* @author teras
*/
public class Point implements Serializable {
private N[] coords;
/**
* Creates a new instance of Point with given coordinates
*
* @param coords The coordinates given as a list of native (or boxed) type
* numbers.
*/
@SuppressWarnings("unchecked")
public Point(N... coords) {
this.coords = (N[]) Array.newInstance(Number.class, coords.length);
System.arraycopy(coords, 0, this.coords, 0, coords.length);
}
/**
* Retrieve the value of a specific coordinate of this point
*
* @param dimension the coordination dimension
* @return the value of this point
* @throws java.lang.ArrayIndexOutOfBoundsException The coordination
* required is not present
*/
public N get(int dimension) throws ArrayIndexOutOfBoundsException {
return coords[dimension];
}
/**
* Retrieve the actual coordinations of this point
*
* @return The coordinations (dimensions) of this point
*/
public int getDimensions() {
return coords.length;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy