Package uk.ac.starlink.topcat.plot
Class CartesianPointStore
- java.lang.Object
-
- uk.ac.starlink.topcat.plot.CartesianPointStore
-
- All Implemented Interfaces:
Points,PointStore
public class CartesianPointStore extends java.lang.Object implements PointStore
PointStore implementation used for storing coordinate information about from Cartesian point selection. AValueStoreis used to back the storage.The error points returned by
getErrors(int)are an array with two elements (N-d coordinate arrays) for each non-blank element of the ErrorMode array. Each pair is a lower bound followed by an upper bound along that dimension.- Since:
- 29 Mar 2007
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description CartesianPointStore(int ndim, uk.ac.starlink.ttools.plot.ErrorMode[] errorModes, int npoint)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static doubledoubleValue(java.lang.Object value)Utility method to convert an object into a numeric (double) value where possible.intgetCount()Returns the number of points in this dataset.double[][]getErrors(int ipoint)Reads the errors for one of the stored points.java.lang.StringgetLabel(int ipoint)Returns a string associated with a given point.intgetNdim()Returns the length of the coordinate array for each point.intgetNerror()Returns the number of error points returned for each point.double[]getPoint(int ipoint)Reads the coordinates of one of the stored points.booleanhasLabels()Indicates whether a string label is associated with some points.voidstorePoint(java.lang.Object[] coordRow, java.lang.Object[] errorRow, java.lang.String label)Stores the next point in sequence to this object.
-
-
-
Constructor Detail
-
CartesianPointStore
public CartesianPointStore(int ndim, uk.ac.starlink.ttools.plot.ErrorMode[] errorModes, int npoint)Constructor.- Parameters:
ndim- coordinate dimensionalityerrorModes- error mode arraynpoint- number of timesstorePoint(java.lang.Object[], java.lang.Object[], java.lang.String)will be called.
-
-
Method Detail
-
storePoint
public void storePoint(java.lang.Object[] coordRow, java.lang.Object[] errorRow, java.lang.String label)Description copied from interface:PointStoreStores the next point in sequence to this object. The lengths of the arrays supplied here are not necessarily the same as those returned by thePoints.getNdim()andPoints.getNerror()methods, since there may be some translation between the arrays.The
PointSelectionsubmits rows here as retrieved directly from the AxesSelectorAxesSelector.getData()andAxesSelector.getErrorData()tables.- Specified by:
storePointin interfacePointStore- Parameters:
coordRow- array of objects representing coordinate valueserrorRow- array of objects representing error valueslabel- string labelling the point
-
getCount
public int getCount()
Description copied from interface:PointsReturns the number of points in this dataset.
-
getNdim
public int getNdim()
Description copied from interface:PointsReturns the length of the coordinate array for each point.
-
getPoint
public double[] getPoint(int ipoint)
Description copied from interface:PointsReads the coordinates of one of the stored points. The returned array may be modified by subsequent calls to this method. The caller is also permitted to modify it.
-
getNerror
public int getNerror()
Description copied from interface:PointsReturns the number of error points returned for each point.
-
getErrors
public double[][] getErrors(int ipoint)
Description copied from interface:PointsReads the errors for one of the stored points. The returned value is an array ofnerrordouble[] arrays, each of which hasndimelements and represents the coordinates of the end of an error bar. If any of these coordinate arrays isnull, it represents an error bar of zero size, that is one whose end sits right on the data point. The ordering of these points is up to the user of this object, but typically they will be in pairs, e.g. (xlo,xhi, ylo,hi, ...). The content of the returned double[][] array and of its elements may be modified by subsequent calls to this method. The caller is also permitted to modify these.
-
hasLabels
public boolean hasLabels()
Description copied from interface:PointsIndicates whether a string label is associated with some points.- Specified by:
hasLabelsin interfacePoints- Returns:
- true if
Points.getLabel(int)may return a non-null value for any point
-
getLabel
public java.lang.String getLabel(int ipoint)
Description copied from interface:PointsReturns a string associated with a given point. May only return a non-null value ifPoints.hasLabels()returns true.
-
doubleValue
public static double doubleValue(java.lang.Object value)
Utility method to convert an object into a numeric (double) value where possible.- Parameters:
value- value to decode- Returns:
- double precision equivalent
-
-