Package uk.ac.starlink.topcat.plot
Class PointSelection
java.lang.Object
uk.ac.starlink.topcat.plot.PointSelection
- All Implemented Interfaces:
uk.ac.starlink.ttools.plot.PlotData
Encapsulates the selection of the list of points which is to be plotted.
This may be composed of points from one or more than one tables.
- Since:
- 2 Nov 2005
- Author:
- Mark Taylor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Struct-type class which defines an association of a TopcatModel and a BitSet. -
Constructor Summary
ConstructorsConstructorDescriptionPointSelection
(PointSelector[] selectors, int[][] subsetPointers, String[] subsetNames) Constructs a new selection. -
Method Summary
Modifier and TypeMethodDescriptionuk.ac.starlink.ttools.plot.PlotData
createPlotData
(Points points) Returns a PlotData object based on this point selection but with a given points object.boolean
Equals is implemented efficiently to identify two PointSelection objects which will behave in the same way.Returns a dummy Points object compatible with this selection.int
getNdim()
int
long
getPointRow
(long ipoint) Given a point index from this selection, returns the row number in its table (seegetPointTable(long)
that it represents.uk.ac.starlink.ttools.plot.PointSequence
long[]
getPointsForRow
(TopcatModel tcModel, long lrow) Given a table and a row index into that table, returns the point indices of any points in this selection which correspond to that row.getPointTable
(long ipoint) Given a point index from this selection, returns the table that it comes from.int
SetId[]
Returns the list of set ID labels which identify where each set comes from.getSetName
(int iset) uk.ac.starlink.ttools.plot.Style
getSetStyle
(int iset) uk.ac.starlink.ttools.plot.Style[]
Returns a list of styles for subset plotting.Returns a list of subsets to be plotted.getTableMasks
(BitSet pointMask) Given a bit vector which represents a selection of the points in this object, returns an array of TableMask objects which represent selections of rows within any of the tables this object knows about.int
hashCode()
boolean
readPoints
(BoundedRangeModel progress) Reads a data points list for this selection.boolean
sameAxes
(PointSelection other) Determines if the axes defining this point selection are the same as those for another one.boolean
sameData
(PointSelection other) Determines if the data required to plot this point selection is the same as the data required to plot another one.void
-
Constructor Details
-
PointSelection
Constructs a new selection.As well as the point selectors themselves which hold almost all the required state, an additional array,
subsetPointers
is given to indicate in what order the subsets should be plotted. Each element of this array is a two-element int array; the first element is the index of the point selector, and the second element the index of the subset within that selector.- Parameters:
selectors
- array of PointSelector objects whose current state determines the points to be plottedsubsetPointers
- pointers to subsetssubsetNames
- labels to be used for the subsets insubsetPointers
-
-
Method Details
-
readPoints
Reads a data points list for this selection. The data are actually read from the table objects in this call, so it may be time-consuming. So, don't call it if you already have the data it would return (seesameData(uk.ac.starlink.topcat.plot.PointSelection)
). If a progress bar model is supplied it will be updated as the read progresses.This method checks for interruption status on its calling thread. If an interruption is made, it will cease calculating and throw an InterruptedException.
- Parameters:
progress
- bar model to be updated as read is done- Returns:
- points list
- Throws:
InterruptedException
- if the calling thread is interruptedIOException
-
getEmptyPoints
Returns a dummy Points object compatible with this selection. It contains no data.- Returns:
- points object with
getCount()==0
-
getSubsets
Returns a list of subsets to be plotted. The row indices used by these subsets correspond to the row sequence returned by a call toreadPoints(javax.swing.BoundedRangeModel)
.- Returns:
- subset array
-
getStyles
public uk.ac.starlink.ttools.plot.Style[] getStyles()Returns a list of styles for subset plotting. This corresponds to the subset list returned bygetSubsets()
.- Returns:
- style array
-
getSetCount
public int getSetCount()- Specified by:
getSetCount
in interfaceuk.ac.starlink.ttools.plot.PlotData
-
getSetName
- Specified by:
getSetName
in interfaceuk.ac.starlink.ttools.plot.PlotData
-
getSetStyle
public uk.ac.starlink.ttools.plot.Style getSetStyle(int iset) - Specified by:
getSetStyle
in interfaceuk.ac.starlink.ttools.plot.PlotData
-
getNdim
public int getNdim()- Specified by:
getNdim
in interfaceuk.ac.starlink.ttools.plot.PlotData
-
getNerror
public int getNerror()- Specified by:
getNerror
in interfaceuk.ac.starlink.ttools.plot.PlotData
-
hasLabels
public boolean hasLabels()- Specified by:
hasLabels
in interfaceuk.ac.starlink.ttools.plot.PlotData
-
createPlotData
Returns a PlotData object based on this point selection but with a given points object. Since PointSelection implements PlotData in any case, this is not always necessary, but what this method provides is a PlotData whose data will not change if the points object owned by this PointSelection is replaced.- Parameters:
points
- fixed points data- Returns:
- plot data closure
-
getPointSequence
public uk.ac.starlink.ttools.plot.PointSequence getPointSequence()- Specified by:
getPointSequence
in interfaceuk.ac.starlink.ttools.plot.PlotData
-
setPoints
-
getPoints
-
getSetIds
Returns the list of set ID labels which identify where each set comes from. This corresponds to the subset list returned bygetSubsets()
.- Returns:
- set ID array
-
getPointTable
Given a point index from this selection, returns the table that it comes from.- Parameters:
ipoint
- point index- Returns:
- topcat model that the point is from
- See Also:
-
getPointRow
public long getPointRow(long ipoint) Given a point index from this selection, returns the row number in its table (seegetPointTable(long)
that it represents.- Parameters:
ipoint
- point index- Returns:
- row number of point index in its table
-
getPointsForRow
Given a table and a row index into that table, returns the point indices of any points in this selection which correspond to that row.- Parameters:
tcModel
- tablelrow
- row index intcModel
- Returns:
- array of point indices for that row
-
getTableMasks
Given a bit vector which represents a selection of the points in this object, returns an array of TableMask objects which represent selections of rows within any of the tables this object knows about.- Parameters:
pointMask
- bit vector reprsenting a subset of the points in this object- Returns:
- array of table/mask pairs representing non-empty row subsets
-
sameAxes
Determines if the axes defining this point selection are the same as those for another one. This resemblessameData(uk.ac.starlink.topcat.plot.PointSelection)
, except that PointSelections with different error or label information can be considered to have the same axes.- Parameters:
other
- comparison object- Returns:
- true iff the data axes are the same
-
sameData
Determines if the data required to plot this point selection is the same as the data required to plot another one. More exactly, it returns true only ifreadPoints(javax.swing.BoundedRangeModel)
will return the same result for this object andother
.- Parameters:
other
- comparison object- Returns:
- true iff the data is the same
-
equals
Equals is implemented efficiently to identify two PointSelection objects which will behave in the same way. -
hashCode
public int hashCode()
-