uk.ac.starlink.topcat.plot
Class CartesianPointStore

java.lang.Object
  extended by uk.ac.starlink.topcat.plot.CartesianPointStore
All Implemented Interfaces:
Points, PointStore

public class CartesianPointStore
extends Object
implements PointStore

PointStore implementation used for storing coordinate information about from Cartesian point selection. A ValueStore is 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
CartesianPointStore(int ndim, uk.ac.starlink.ttools.plot.ErrorMode[] errorModes, int npoint)
          Constructor.
 
Method Summary
static double doubleValue(Object value)
          Utility method to convert an object into a numeric (double) value where possible.
 int getCount()
          Returns the number of points in this dataset.
 double[][] getErrors(int ipoint)
          Reads the errors for one of the stored points.
 String getLabel(int ipoint)
          Returns a string associated with a given point.
 int getNdim()
          Returns the length of the coordinate array for each point.
 int getNerror()
          Returns the number of error points returned for each point.
 double[] getPoint(int ipoint)
          Reads the coordinates of one of the stored points.
 boolean hasLabels()
          Indicates whether a string label is associated with some points.
 void storePoint(Object[] coordRow, Object[] errorRow, String label)
          Stores the next point in sequence to this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CartesianPointStore

public CartesianPointStore(int ndim,
                           uk.ac.starlink.ttools.plot.ErrorMode[] errorModes,
                           int npoint)
Constructor.

Parameters:
ndim - coordinate dimensionality
errorModes - error mode array
npoint - number of times storePoint(java.lang.Object[], java.lang.Object[], java.lang.String) will be called.
Method Detail

storePoint

public void storePoint(Object[] coordRow,
                       Object[] errorRow,
                       String label)
Description copied from interface: PointStore
Stores the next point in sequence to this object. The lengths of the arrays supplied here are not necessarily the same as those returned by the Points.getNdim() and Points.getNerror() methods, since there may be some translation between the arrays.

The PointSelection submits rows here as retrieved directly from the AxesSelector AxesSelector.getData() and AxesSelector.getErrorData() tables.

Specified by:
storePoint in interface PointStore
Parameters:
coordRow - array of objects representing coordinate values
errorRow - array of objects representing error values
label - string labelling the point

getCount

public int getCount()
Description copied from interface: Points
Returns the number of points in this dataset.

Specified by:
getCount in interface Points
Returns:
numer of points

getNdim

public int getNdim()
Description copied from interface: Points
Returns the length of the coordinate array for each point.

Specified by:
getNdim in interface Points
Returns:
number of coordinate values at each point

getPoint

public double[] getPoint(int ipoint)
Description copied from interface: Points
Reads 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.

Specified by:
getPoint in interface Points
Parameters:
ipoint - point index
Returns:
coords an ndim-element array containing point coordinates

getNerror

public int getNerror()
Description copied from interface: Points
Returns the number of error points returned for each point.

Specified by:
getNerror in interface Points
Returns:
number of error values at each point

getErrors

public double[][] getErrors(int ipoint)
Description copied from interface: Points
Reads the errors for one of the stored points. The returned value is an array of nerror double[] arrays, each of which has ndim elements and represents the coordinates of the end of an error bar. If any of these coordinate arrays is null, 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.

Specified by:
getErrors in interface Points
Parameters:
ipoint - point index
Returns:
double[nerr][ndim] array with error extremum coordinates

hasLabels

public boolean hasLabels()
Description copied from interface: Points
Indicates whether a string label is associated with some points.

Specified by:
hasLabels in interface Points
Returns:
true if Points.getLabel(int) may return a non-null value for any point

getLabel

public String getLabel(int ipoint)
Description copied from interface: Points
Returns a string associated with a given point. May only return a non-null value if Points.hasLabels() returns true.

Specified by:
getLabel in interface Points
Parameters:
ipoint - point index
Returns:
label associated with points

doubleValue

public static double doubleValue(Object value)
Utility method to convert an object into a numeric (double) value where possible.

Parameters:
value - value to decode
Returns:
double precision equivalent


Copyright © 2003-2014 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.