|
|||||||||
| 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.ComplexDataset
public class ComplexDataset
ComplexDataset stores and plots a complex dataset (x,z) where the dependent variable has real and imaginary parts, z=(real, imaginary). In Re_Im mode, both the real and imaginary parts are shown as separate curves. In Phase mode, the vertical coordinate represents magnitude and color represents phase. ComplexDataset is Drawable and can be rendered on a DrawingPanel. ComplexDataset extends AbstractTableModel and can be rendered in a JTable.
| Field Summary | |
|---|---|
static int |
AMP_CURVE
AMP height equal to |z|.. |
protected double[] |
amp_points
|
protected double[] |
im_points
|
protected int |
index
|
static int |
PHASE_BAR
PHASE_BAR the phase is shown as the bar's color |
static int |
PHASE_CURVE
PHASE_CURVE the phase is shown as color. |
static int |
PHASE_POST
Field POST |
static int |
RE_IM_CURVE
RE_IM real and imaginary curves. |
protected double[] |
re_points
|
protected double[] |
xpoints
|
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
ComplexDataset()
Dataset constructor. |
|
| Method Summary | |
|---|---|
void |
append(double[] _xpoints,
double[] _zpoints)
Appends x and z data to the Dataset. |
void |
append(double[] _xpoints,
double[] _repoints,
double[] _impoints)
Appends x, real, and imaginary arrays to the Dataset. |
void |
append(double x,
double re,
double im)
Appends (x, re, im) datum to the Dataset. |
void |
clear()
Clear all data from this Dataset. |
void |
draw(DrawingPanel drawingPanel,
java.awt.Graphics g)
Draw this Dataset in the drawing panel. |
protected void |
drawLinePlot(DrawingPanel drawingPanel,
java.awt.Graphics2D g2)
Draw the lines connecting the data points. |
protected void |
drawPhaseBars(DrawingPanel drawingPanel,
java.awt.Graphics2D g2)
Draw the phase as a colored bar. |
protected void |
drawPhaseCurve(DrawingPanel drawingPanel,
java.awt.Graphics2D g2)
Draw the phase as color. |
protected void |
drawPhasePosts(DrawingPanel drawingPanel,
java.awt.Graphics2D g2)
Draw the phase as a colored post. |
protected void |
drawReImPlot(DrawingPanel drawingPanel,
java.awt.Graphics2D g2)
Draw the lines connecting 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.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 elements (a Group, for instance) do not contain data, but a list of subelements which do. |
java.util.ArrayList<Dataset> |
getDatasets()
Gets a list of OSP Datasets. |
java.awt.Color |
getFillColor()
Fill color to use for this data |
java.awt.Color[] |
getFillColors()
Fill colors to Data interface. |
int |
getID()
Returns a unique identifier for this Data. |
double[] |
getImPoints()
Gets a copy of the imaginary points array. |
java.awt.Color |
getLineColor()
Gets the line color. |
java.awt.Color[] |
getLineColors()
Line colors for Data interface. |
static XML.ObjectLoader |
getLoader()
Returns the XML.ObjectLoader for this class. |
int |
getMarkerShape()
Gets the marker shape. |
int |
getMarkerSize()
Gets the marker size. |
java.lang.String |
getName()
Gets the name. |
double[][] |
getPoints()
Gets a data array containing both x and y values. |
double[] |
getRePoints()
Gets a copy of the real points array. |
int |
getRowCount()
Gets the number of rows for rendering in a JTable. |
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. |
protected void |
moveDatum(int loc)
Move an out-of-place datum into its correct position. |
protected void |
recalculatePath()
Recalcualte the general path. |
void |
setCentered(boolean _centered)
Sets the centered flag. |
void |
setConnected(boolean _connected)
Sets the data connected flag. |
void |
setID(int id)
Sets the ID number of this Data. |
void |
setLineColor(java.awt.Color _lineColor)
Sets the color of the lines connecting data points. |
void |
setLineColor(java.awt.Color reColor,
java.awt.Color imColor)
Sets the color of the lines connecting data points. |
void |
setMarkerShape(int _markerShape)
Sets the data point marker. |
void |
setMarkerSize(int size)
Sets the marker size. |
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 data stride for table view. |
void |
setXYColumnNames(java.lang.String _xColumnName,
java.lang.String _reColumnName,
java.lang.String _imColumnName)
Sets the column names when rendering this dataset in a JTable. |
void |
setXYColumnNames(java.lang.String _xColumnName,
java.lang.String _reColumnName,
java.lang.String _imColumnName,
java.lang.String datasetName)
Sets the column names when rendering this dataset in a JTable. |
javax.swing.JFrame |
showLegend()
Shows the phase legend. |
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 |
| Field Detail |
|---|
public static final int AMP_CURVE
public static final int RE_IM_CURVE
public static final int PHASE_CURVE
public static final int PHASE_BAR
public static final int PHASE_POST
protected double[] xpoints
protected double[] re_points
protected double[] im_points
protected double[] amp_points
protected int index
| Constructor Detail |
|---|
public ComplexDataset()
| Method Detail |
|---|
public javax.swing.JFrame showLegend()
public boolean isMeasured()
isMeasured in interface Measurabletrue<\code> if measure is validpublic double getXMin()
getXMin in interface Measurablepublic double getXMax()
getXMax in interface Measurablepublic double getYMin()
getYMin in interface Measurablepublic double getYMax()
getYMax in interface Measurablepublic double[] getXPoints()
public double[] getRePoints()
public double[] getImPoints()
public double[] getYPoints()
public double[][] getPoints()
public void setMarkerShape(int _markerShape)
_markerShape - public int getMarkerShape()
public int getMarkerSize()
public void setMarkerSize(int size)
size - intpublic void setSorted(boolean _sorted)
_sorted - true<\code> to sortpublic void setStride(int _stride)
_stride - public boolean isSorted()
true<\code> if the data is sortedpublic void setConnected(boolean _connected)
_connected - true<\code> if points are connectedpublic void setCentered(boolean _centered)
_centered - true<\code> if data is centeredpublic boolean isConnected()
true<\code> if points are connectedpublic void setLineColor(java.awt.Color _lineColor)
_lineColor -
public void setLineColor(java.awt.Color reColor,
java.awt.Color imColor)
reColor - the real component colorimColor - the imaginary component colorpublic java.awt.Color[] getLineColors()
getLineColors in interface Datapublic java.awt.Color getLineColor()
public java.awt.Color[] getFillColors()
getFillColors in interface Datapublic java.awt.Color getFillColor()
public void setXYColumnNames(java.lang.String _xColumnName,
java.lang.String _reColumnName,
java.lang.String _imColumnName)
_xColumnName - String_reColumnName - String_imColumnName - String
public void setXYColumnNames(java.lang.String _xColumnName,
java.lang.String _reColumnName,
java.lang.String _imColumnName,
java.lang.String datasetName)
_xColumnName - String_reColumnName - String_imColumnName - StringdatasetName - String
public void append(double x,
double re,
double im)
x - doublere - doubleim - double
public void append(double[] _xpoints,
double[] _repoints,
double[] _impoints)
_xpoints - _repoints - _impoints -
public void append(double[] _xpoints,
double[] _zpoints)
Re(z) = z[2*i]
Im(z) = z[2*i + 1]
_xpoints - _zpoints - public void setID(int id)
setID in interface Dataid - the ID numberpublic int getID()
getID in interface Data
public void draw(DrawingPanel drawingPanel,
java.awt.Graphics g)
draw in interface DrawabledrawingPanel - g - public void clear()
public java.lang.String toString()
toString in class java.lang.Objectpublic int getColumnCount()
getColumnCount in interface javax.swing.table.TableModelpublic int getRowCount()
getRowCount in interface javax.swing.table.TableModelpublic java.lang.String getColumnName(int columnIndex)
getColumnName in interface javax.swing.table.TableModelgetColumnName in class javax.swing.table.AbstractTableModelcolumnIndex -
public java.lang.Object getValueAt(int rowIndex,
int columnIndex)
getValueAt in interface javax.swing.table.TableModelrowIndex - columnIndex -
public java.lang.Class<?> getColumnClass(int columnIndex)
getColumnClass in interface javax.swing.table.TableModelgetColumnClass in class javax.swing.table.AbstractTableModelcolumnIndex -
protected void insertionSort()
protected void recalculatePath()
protected void moveDatum(int loc)
loc - the datum
protected void drawLinePlot(DrawingPanel drawingPanel,
java.awt.Graphics2D g2)
drawingPanel - g2 -
protected void drawReImPlot(DrawingPanel drawingPanel,
java.awt.Graphics2D g2)
drawingPanel - g2 -
protected void drawPhaseCurve(DrawingPanel drawingPanel,
java.awt.Graphics2D g2)
drawingPanel - g2 -
protected void drawPhaseBars(DrawingPanel drawingPanel,
java.awt.Graphics2D g2)
drawingPanel - g2 -
protected void drawPhasePosts(DrawingPanel drawingPanel,
java.awt.Graphics2D g2)
drawingPanel - g2 - public static XML.ObjectLoader getLoader()
public void setName(java.lang.String name)
name - Stringpublic java.lang.String getName()
getName in interface Datapublic java.lang.String[] getColumnNames()
getColumnNames in interface Datapublic double[][] getData2D()
Data
getData2D in interface Datapublic double[][][] getData3D()
Data
getData3D in interface Datapublic java.util.ArrayList<Dataset> getDatasets()
Data
getDatasets in interface Datapublic java.util.List<Data> getDataList()
getDataList in interface Data
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||