|
|||||||||
| 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.DatasetManager
public class DatasetManager
DatasetManager maintains a list of datasets. Datasets are added
automatically to this DatasetCollection by calling a method in this
DatasetManager with a dataset index greater than the maximum value for
the dataset index that has been used previously. For example the statements:
DatasetManager datasetManager = new DatasetManager();
datasetManager.append(0,3,4);
datasetManager.append(1,5,6); appends the point (3,4) to the 0th
dataset (and creates this dataset automatically) and appends the point (5,6)
to the 1-st dataset (and also creates this dataset automatically).
| Field Summary |
|---|
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
DatasetManager()
DatasetManager constructor. |
|
DatasetManager(boolean linked)
DatasetManager constructor. |
|
DatasetManager(boolean _connected,
boolean _sorted)
DatasetManager constructor specifying whether points are connected and sorted. |
|
DatasetManager(boolean _connected,
boolean _sorted,
boolean _linked,
int _markerShape)
DatasetManager constructor specifying whether points are connected, sorted, and the marker shape. |
|
| Method Summary | |
|---|---|
int |
addDataset(Dataset dataset)
Adds a dataset. |
void |
append(int datasetIndex,
double[] xpoints,
double[] ypoints)
Appends (x,y) arrays to the Dataset. |
void |
append(int datasetIndex,
double[] xpoints,
double[] ypoints,
double[] delx,
double[] dely)
Appends arrays of data points and uncertainties to the Dataset. |
void |
append(int datasetIndex,
double x,
double y)
Appends an (x,y) datum to the Dataset with the given index. |
void |
append(int datasetIndex,
double x,
double y,
double delx,
double dely)
Appends a data point and its uncertainty to the Dataset. |
protected void |
checkDatasetIndex(int datasetIndex)
Ensures capacity |
void |
clear()
Clears all data from all Datasets. |
void |
clear(int datasetIndex)
Clears all data from Dataset with the given datasetIndex. |
void |
draw(DrawingPanel drawingPanel,
java.awt.Graphics g)
Draws this Dataset in the drawing panel. |
java.lang.Class<java.lang.Double> |
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 tableColumnIndex)
Gets the name of the column for rendering in a JTable |
java.lang.String[] |
getColumnNames()
The column names to be used in the data display tool |
double[][] |
getData2D()
Gets a 2D array of data. |
double[][][] |
getData3D()
Gets a 3D array of data. |
java.util.List<Data> |
getDataList()
Some objects (eg, a Group) do not contain data, but a list of Data objects that do. |
Dataset |
getDataset(int datasetIndex)
Gets a dataset with the given index. |
int |
getDatasetIndex(java.lang.String yColumnName)
Returns the index of the first dataset with the specified y column name. |
java.util.ArrayList<Dataset> |
getDatasets()
Gets a shallow clone of the dataset list. |
java.awt.Color[] |
getFillColors()
Fill colors for Data interface. |
int |
getID()
Returns a unique identifier for this Data. |
java.awt.Color[] |
getLineColors()
Line colors for Data interface. |
static XML.ObjectLoader |
getLoader()
Returns the XML.ObjectLoader for this class. |
java.lang.String |
getName()
Gets the name of this data. |
java.util.Map<java.lang.String,java.lang.Double> |
getProperties()
Returns the properties map. |
int |
getRowCount()
Gets the number of rows for rendering in a JTable. |
java.lang.Object |
getValueAt(int rowIndex,
int tableColumnIndex)
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 |
getXMaxLogscale()
Gets the maximum x needed to draw this object on a log scale. |
double |
getXMin()
Gets the x world coordinate for the left hand side of the panel. |
double |
getXMinLogscale()
Gets the minimum x needed to draw this object on a log scale. |
double[] |
getXPoints(int datasetIndex)
Gets a copy of the xpoints array. |
double |
getYMax()
Gets y world coordinate for the top of the panel. |
double |
getYMaxLogscale()
Gets the maximum y needed to draw this object on a log scale on a log scale. |
double |
getYMin()
Gets y world coordinate for the bottom of the panel. |
double |
getYMinLogscale()
Gets the minimum y needed to draw this object on a log scale. |
double[] |
getYPoints(int datasetIndex)
Gets a copy of the ypoints array. |
boolean |
isConnected(int datasetIndex)
Gets the data connected flag. |
boolean |
isMeasured()
Gets the valid measure flag. |
boolean |
isSorted(int datasetIndex)
Gets the sorted flag. |
boolean |
isXPointsLinked()
Gets the linked flag. |
Dataset |
removeDataset(int index)
Removes the dataset at the specified index. |
void |
removeDatasets()
Removes all Datasets from the manager. |
void |
setConnected(boolean _connected)
Sets the connected flag for all datasets. |
void |
setConnected(int datasetIndex,
boolean _connected)
Sets the data connected flag. |
void |
setCustomMarker(int datasetIndex,
java.awt.Shape marker)
Sets a custom marker shape. |
void |
setID(int id)
Sets the ID number of this Data. |
void |
setLineColor(int datasetIndex,
java.awt.Color _lineColor)
Sets the color of the lines connecting data points. |
void |
setMarkerColor(int datasetIndex,
java.awt.Color _markerColor)
Sets the data point marker color. |
void |
setMarkerColor(int datasetIndex,
java.awt.Color fillColor,
java.awt.Color edgeColor)
Sets the data point marker's fill and edge color. |
void |
setMarkerShape(int datasetIndex,
int _markerShape)
Sets the data point marker shape. |
void |
setMarkerSize(int datasetIndex,
int _markerSize)
Sets the half-width of the data point marker. |
void |
setName(java.lang.String name)
Sets the name of this data. |
void |
setSorted(boolean _sorted)
Sets the sorted flag for all datasets. |
void |
setSorted(int datasetIndex,
boolean _sorted)
Sets the sorted flag. |
void |
setStride(int _stride)
|
void |
setStride(int datasetIndex,
int stride)
Sets the stride for the given dataset. |
void |
setXColumnVisible(int datasetIndex,
boolean visible)
Sets the visibility of the x column in a table view. |
void |
setXPointsLinked(boolean _linked)
Sets the linked flag. |
void |
setXYColumnNames(int datasetIndex,
java.lang.String xColumnName,
java.lang.String yColumnName)
Sets the column names when rendering this dataset in a JTable. |
void |
setXYColumnNames(int datasetIndex,
java.lang.String xColumnName,
java.lang.String yColumnName,
java.lang.String datsetName)
Sets the column names when rendering this dataset in a JTable. |
void |
setXYColumnNames(java.lang.String _xColumnName,
java.lang.String _yColumnName)
Sets the column names for all datasets when rendering this dataset in a JTable. |
void |
setYColumnVisible(int datasetIndex,
boolean visible)
Sets the visibility of the y column in a table view. |
java.lang.String |
toString()
Create a string representation of the data. |
| 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 |
| Constructor Detail |
|---|
public DatasetManager()
public DatasetManager(boolean linked)
linked -
public DatasetManager(boolean _connected,
boolean _sorted)
_connected - Description of Parameter_sorted - Description of Parameter
public DatasetManager(boolean _connected,
boolean _sorted,
boolean _linked,
int _markerShape)
_connected - Description of Parameter_sorted - Description of Parameter_linked - _markerShape - Description of Parameter| Method Detail |
|---|
public void setXPointsLinked(boolean _linked)
_linked - The new valuepublic boolean isXPointsLinked()
public void setSorted(int datasetIndex,
boolean _sorted)
datasetIndex - The new sorted value_sorted - true<\code> to sortpublic void setSorted(boolean _sorted)
_sorted -
public void setConnected(int datasetIndex,
boolean _connected)
datasetIndex - The new connected value_connected - true<\code> if points are connectedpublic void setConnected(boolean _connected)
_connected - true if connected; false otherwise
public void setStride(int datasetIndex,
int stride)
datasetIndex - The new markerColor valuestride - public void setStride(int _stride)
public void setMarkerColor(int datasetIndex,
java.awt.Color _markerColor)
datasetIndex - _markerColor -
public void setMarkerColor(int datasetIndex,
java.awt.Color fillColor,
java.awt.Color edgeColor)
datasetIndex - fillColor - edgeColor -
public void setMarkerShape(int datasetIndex,
int _markerShape)
datasetIndex - _markerShape -
public void setCustomMarker(int datasetIndex,
java.awt.Shape marker)
datasetIndex - intmarker - Shape
public void setXColumnVisible(int datasetIndex,
boolean visible)
datasetIndex - visible -
public void setYColumnVisible(int datasetIndex,
boolean visible)
datasetIndex - visible -
public void setMarkerSize(int datasetIndex,
int _markerSize)
datasetIndex - _markerSize - in pixels
public void setLineColor(int datasetIndex,
java.awt.Color _lineColor)
datasetIndex - _lineColor - public java.awt.Color[] getLineColors()
getLineColors in interface Datapublic java.awt.Color[] getFillColors()
getFillColors in interface Data
public void setXYColumnNames(int datasetIndex,
java.lang.String xColumnName,
java.lang.String yColumnName,
java.lang.String datsetName)
datasetIndex - xColumnName - yColumnName - datsetName -
public void setXYColumnNames(int datasetIndex,
java.lang.String xColumnName,
java.lang.String yColumnName)
datasetIndex - xColumnName - yColumnName - public boolean isMeasured()
isMeasured in interface Measurabletrue<\code> if measure is validpublic void setID(int id)
setID in interface Dataid - the ID numberpublic int getID()
getID in interface Datapublic double getXMin()
getXMin in interface Measurablepublic double getXMinLogscale()
LogMeasurable
getXMinLogscale in interface LogMeasurablepublic double getXMax()
getXMax in interface Measurablepublic double getXMaxLogscale()
LogMeasurable
getXMaxLogscale in interface LogMeasurablepublic double getYMin()
getYMin in interface Measurablepublic double getYMinLogscale()
LogMeasurable
getYMinLogscale in interface LogMeasurablepublic double getYMax()
getYMax in interface Measurablepublic double getYMaxLogscale()
LogMeasurable
getYMaxLogscale in interface LogMeasurablepublic double[] getXPoints(int datasetIndex)
datasetIndex - Description of Parameter
public double[] getYPoints(int datasetIndex)
datasetIndex - Description of Parameter
public boolean isSorted(int datasetIndex)
datasetIndex - Description of Parameter
true<\code> if the data is sortedpublic boolean isConnected(int datasetIndex)
datasetIndex - Description of Parameter
true<\code> if points are connectedpublic int getColumnCount()
getColumnCount in interface javax.swing.table.TableModelpublic int getRowCount()
getRowCount in interface javax.swing.table.TableModelpublic java.lang.String getName()
getName in interface Datapublic void setName(java.lang.String name)
public java.lang.String getColumnName(int tableColumnIndex)
getColumnName in interface javax.swing.table.TableModelgetColumnName in class javax.swing.table.AbstractTableModeltableColumnIndex -
public java.lang.Object getValueAt(int rowIndex,
int tableColumnIndex)
getValueAt in interface javax.swing.table.TableModelrowIndex - tableColumnIndex -
public java.lang.Class<java.lang.Double> getColumnClass(int columnIndex)
getColumnClass in interface javax.swing.table.TableModelgetColumnClass in class javax.swing.table.AbstractTableModelcolumnIndex -
public void append(int datasetIndex,
double x,
double y)
x - y - datasetIndex - Description of Parameter
public void append(int datasetIndex,
double x,
double y,
double delx,
double dely)
datasetIndex - x - y - delx - dely -
public void append(int datasetIndex,
double[] xpoints,
double[] ypoints)
xpoints - ypoints - datasetIndex - Description of Parameter
public void append(int datasetIndex,
double[] xpoints,
double[] ypoints,
double[] delx,
double[] dely)
datasetIndex - xpoints - ypoints - delx - dely -
public void draw(DrawingPanel drawingPanel,
java.awt.Graphics g)
draw in interface DrawabledrawingPanel - g - public void clear(int datasetIndex)
datasetIndex - Description of Parameterpublic void clear()
public void removeDatasets()
public Dataset getDataset(int datasetIndex)
datasetIndex -
public java.util.ArrayList<Dataset> getDatasets()
getDatasets in interface Datapublic java.util.List<Data> getDataList()
getDataList in interface Datapublic java.lang.String[] getColumnNames()
getColumnNames in interface Datapublic double[][] getData2D()
getData2D in interface Datapublic double[][][] getData3D()
getData3D in interface Datapublic int addDataset(Dataset dataset)
dataset - the Dataset to add
public Dataset removeDataset(int index)
index - the index
public int getDatasetIndex(java.lang.String yColumnName)
yColumnName - the y column name
public java.util.Map<java.lang.String,java.lang.Double> getProperties()
public java.lang.String toString()
toString in class java.lang.Object
public void setXYColumnNames(java.lang.String _xColumnName,
java.lang.String _yColumnName)
_xColumnName - _yColumnName - protected void checkDatasetIndex(int datasetIndex)
datasetIndex - public static XML.ObjectLoader getLoader()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||