|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
org.opensourcephysics.display.Dataset
Dataset stores and plots (x,y) points. Dataset is Drawable and can be rendered on a DrawingPanel. Dataset extends AbstractTableModel and can be rendered in a JTable.
Nested Class Summary | |
protected static class |
Dataset.Loader
A class to save and load Dataset data in an XMLControl. |
Field Summary | |
static int |
AREA
Field AREA |
static int |
BAR
Field BAR |
static int |
CIRCLE
Field CIRCLE |
static int |
CUSTOM
Field POST |
protected java.awt.Shape |
customMarker
|
protected int |
datasetID
Field datasetID an integer ID that identifies this object |
protected java.util.ArrayList |
errorBars
|
protected java.awt.geom.GeneralPath |
generalPath
|
protected int |
index
|
protected int |
maxPoints
|
static int |
NO_MARKER
Field NO_MARKER |
static int |
PIXEL
Field PIXEL |
static int |
POST
Field POST |
protected boolean |
sorted
|
static int |
SQUARE
Field SQUARE |
protected double |
xmax
|
protected double |
xmin
|
protected double[] |
xpoints
|
protected double |
ymax
|
protected double |
ymin
|
protected double[] |
ypoints
|
Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
Constructor Summary | |
Dataset()
Dataset contructor. |
|
Dataset(java.awt.Color _markerColor)
Dataset contructor specifying the marker color. |
|
Dataset(java.awt.Color markerColor,
java.awt.Color _lineColor,
boolean _connected)
Dataset contructor specifying the marker color, line color, and whether points are connected. |
Method Summary | |
void |
append(double[] _xpoints,
double[] _ypoints)
Appends (x,y) arrays to the Dataset. |
void |
append(double[] xpoints,
double[] ypoints,
double[] delx,
double[] dely)
Appends arrays of data points and uncertainties to the Dataset. |
void |
append(double x,
double y)
Appends an (x,y) datum to the Dataset. |
void |
append(double x,
double y,
double delx,
double dely)
Appends a data point and its uncertainty to the Dataset. |
void |
clear()
Clear all data from this Dataset. |
static int |
convertTableColumnIndex(boolean[] visible,
int columnIndex)
Converts a table column in a table model to the appropriate table column. |
static int |
countColumnsVisible(boolean[] visible)
Counts the number of columns visible |
void |
draw(DrawingPanel drawingPanel,
java.awt.Graphics g)
Draw this Dataset in the drawing panel. |
protected void |
drawFilledPlot(DrawingPanel drawingPanel,
java.awt.Graphics2D g2)
Fills the line connecting the data points. |
protected void |
drawLinePlot(DrawingPanel drawingPanel,
java.awt.Graphics2D g2)
Draw the lines connecting the data points. |
protected void |
drawScatterPlot(DrawingPanel drawingPanel,
java.awt.Graphics2D g2)
Draw the markers at the data points. |
java.lang.Class |
getColumnClass(int columnIndex)
Gets the type of object for JTable entry. |
int |
getColumnCount()
Gets the number of columns for rendering in a JTable. |
java.lang.String |
getColumnName(int columnIndex)
Gets the name of the colummn for rendering in a JTable |
java.awt.Color |
getEdgeColor()
Gets the data point edge color. |
java.awt.Color |
getFillColor()
Gets the data point fill color. |
int |
getID()
Dets an id that can be used to identify the dataset. |
int |
getIndex()
Gets the current index of the array. |
java.awt.Color |
getLineColor()
Gets the line color. |
static XML.ObjectLoader |
getLoader()
Returns the XML.ObjectLoader for this class. |
int |
getMarkerShape()
Gets the data point marker shape. |
int |
getMarkerSize()
Gets the half-width of the data point marker. |
java.lang.String |
getName()
Gets the dataset name. |
double[][] |
getPoints()
Gets a data array containing both x and y values. |
int |
getRowCount()
Gets the number of rows for rendering in a JTable. |
double[] |
getValidXPoints()
Gets an array of valid xpoints. |
double[] |
getValidYPoints()
Gets an array of valid ypoints. |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Gets an x or y value for rendering in a JTable. |
double |
getXMax()
Gets the x world coordinate for the right hand side of the panel. |
double |
getXMin()
Gets the x world coordinate for the left hand side of the panel. |
double[] |
getXPoints()
Gets a copy of the xpoints array. |
double |
getYMax()
Gets y world coordinate for the top of the panel. |
double |
getYMin()
Gets y world coordinate for the bottom of the panel. |
double[] |
getYPoints()
Gets a copy of the ypoints array. |
protected void |
insertionSort()
Perform an insertion sort of the data set. |
boolean |
isConnected()
Gets the data connected flag. |
boolean |
isMeasured()
Gets the valid measure flag. |
boolean |
isSorted()
Gets the sorted flag. |
boolean |
isXColumnVisible()
Gets the visibility of the x column of this Dataset in a table view. |
boolean |
isYColumnVisible()
Gets the visibility of the y column of this Dataset in a table view. |
protected void |
moveDatum(int loc)
Move an out-of-place datum into its correct position. |
void |
read(java.lang.String inputFile)
Reads a file and appends the data contained in the file to this Dataset. |
protected void |
recalculatePath()
Recalculate the general path. |
void |
setConnected(boolean _connected)
Sets the data connected flag. |
void |
setCustomMarker(java.awt.Shape marker)
Sets a custom marker shape. |
void |
setID(int id)
Sets an id that can be used to identify the dataset. |
void |
setLineColor(java.awt.Color _lineColor)
Sets the color of the lines connecting data points. |
void |
setMarkerColor(java.awt.Color markerColor)
Sets the data point fill, edge, and error bar colors to the same color. |
void |
setMarkerColor(java.awt.Color _fillColor,
java.awt.Color _edgeColor)
Sets the data point marker colors. |
void |
setMarkerColor(java.awt.Color _fillColor,
java.awt.Color _edgeColor,
java.awt.Color _errorBarColor)
Sets the data point marker colors. |
void |
setMarkerShape(int _markerShape)
Sets the data point marker shape. |
void |
setMarkerSize(int _markerSize)
Sets the half-width of the data point marker. |
void |
setMaximumPoints(int maxPoints)
Sets the maximum number of allowed datapoints. |
void |
setName(java.lang.String name)
Sets a name that can be used to identify the dataset. |
void |
setSorted(boolean _sorted)
Sets the sorted flag. |
void |
setStride(int _stride)
Sets the stride of this Dataset in a table view. |
void |
setXColumnVisible(boolean b)
Sets the visibility of the x column of this Dataset in a table view. |
void |
setXYColumnNames(java.lang.String _xColumnName,
java.lang.String _yColumnName)
Sets the column names when rendering this dataset in a JTable. |
void |
setXYColumnNames(java.lang.String xColumnName,
java.lang.String yColumnName,
java.lang.String name)
Sets the column names and the dataset name. |
void |
setYColumnVisible(boolean b)
Sets the visibility of the y column of this Dataset in a table view. |
java.lang.String |
toString()
Creates a string representation of the data. |
void |
write(java.lang.String outputFile)
Writes data from this Dataset to a file. |
Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int datasetID
public static final int NO_MARKER
public static final int CIRCLE
public static final int SQUARE
public static final int AREA
public static final int PIXEL
public static final int BAR
public static final int POST
public static final int CUSTOM
protected double[] xpoints
protected double[] ypoints
protected java.awt.geom.GeneralPath generalPath
protected double xmax
protected double ymax
protected double xmin
protected double ymin
protected int index
protected boolean sorted
protected int maxPoints
protected java.util.ArrayList errorBars
protected java.awt.Shape customMarker
Constructor Detail |
public Dataset()
public Dataset(java.awt.Color _markerColor)
_markerColor
- public Dataset(java.awt.Color markerColor, java.awt.Color _lineColor, boolean _connected)
markerColor
- _lineColor
- _connected
- Method Detail |
public void setID(int id)
id
- intpublic int getID()
public void setSorted(boolean _sorted)
_sorted
- true<\code> to sort
public void setConnected(boolean _connected)
_connected
- true<\code> if points are connected
public void setMarkerColor(java.awt.Color markerColor)
markerColor
- public void setMarkerColor(java.awt.Color _fillColor, java.awt.Color _edgeColor)
_fillColor
- _edgeColor
- public void setMarkerColor(java.awt.Color _fillColor, java.awt.Color _edgeColor, java.awt.Color _errorBarColor)
_fillColor
- _edgeColor
- _errorBarColor
- public java.awt.Color getFillColor()
public java.awt.Color getEdgeColor()
public java.awt.Color getLineColor()
public void setCustomMarker(java.awt.Shape marker)
marker
- Shapepublic void setMarkerShape(int _markerShape)
_markerShape
- public int getMarkerShape()
public void setMarkerSize(int _markerSize)
_markerSize
- in pixelspublic void setMaximumPoints(int maxPoints)
maxPoints
- intpublic int getMarkerSize()
public void setLineColor(java.awt.Color _lineColor)
_lineColor
- public void setXYColumnNames(java.lang.String _xColumnName, java.lang.String _yColumnName)
_xColumnName
- _yColumnName
- public void setXYColumnNames(java.lang.String xColumnName, java.lang.String yColumnName, java.lang.String name)
xColumnName
- yColumnName
- name
- public void setName(java.lang.String name)
name
- Stringpublic java.lang.String getName()
public boolean isMeasured()
isMeasured
in interface Measurable
true<\code> if measure is valid
public double getXMin()
getXMin
in interface Measurable
public double getXMax()
getXMax
in interface Measurable
public double getYMin()
getYMin
in interface Measurable
public double getYMax()
getYMax
in interface Measurable
public double[][] getPoints()
public double[] getXPoints()
public double[] getYPoints()
public double[] getValidXPoints()
public double[] getValidYPoints()
public boolean isSorted()
true<\code> if the data is sorted
public boolean isConnected()
true<\code> if points are connected
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public int getIndex()
public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public java.lang.String getColumnName(int columnIndex)
getColumnName
in interface javax.swing.table.TableModel
columnIndex
-
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
getValueAt
in interface javax.swing.table.TableModel
rowIndex
- columnIndex
-
public java.lang.Class getColumnClass(int columnIndex)
getColumnClass
in interface javax.swing.table.TableModel
columnIndex
-
public void append(double x, double y, double delx, double dely)
x
- y
- delx
- dely
- public void append(double x, double y)
x
- y
- public void append(double[] xpoints, double[] ypoints, double[] delx, double[] dely)
xpoints
- ypoints
- delx
- dely
- public void append(double[] _xpoints, double[] _ypoints)
_xpoints
- _ypoints
- public void read(java.lang.String inputFile)
inputFile
- public void write(java.lang.String outputFile)
outputFile
- public void draw(DrawingPanel drawingPanel, java.awt.Graphics g)
draw
in interface Drawable
drawingPanel
- g
- public void clear()
public java.lang.String toString()
public static int countColumnsVisible(boolean[] visible)
visible
- array of column visibilities
public static int convertTableColumnIndex(boolean[] visible, int columnIndex)
visible
- array of column visibilitiescolumnIndex
- table column index to convert
public void setXColumnVisible(boolean b)
b
- new visibilitypublic void setYColumnVisible(boolean b)
b
- new visibilitypublic void setStride(int _stride)
_stride
- the stridepublic boolean isXColumnVisible()
public boolean isYColumnVisible()
protected void insertionSort()
protected void recalculatePath()
protected void moveDatum(int loc)
loc
- the datumprotected void drawLinePlot(DrawingPanel drawingPanel, java.awt.Graphics2D g2)
drawingPanel
- g2
- protected void drawFilledPlot(DrawingPanel drawingPanel, java.awt.Graphics2D g2)
drawingPanel
- g2
- protected void drawScatterPlot(DrawingPanel drawingPanel, java.awt.Graphics2D g2)
drawingPanel
- g2
- public static XML.ObjectLoader getLoader()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |