org.opensourcephysics.display
Class DataFunction

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.opensourcephysics.display.Dataset
          extended by org.opensourcephysics.display.DataFunction
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel, Data, Drawable, LogMeasurable, Measurable

public class DataFunction
extends Dataset

This is a dataset whose values are determined by a multivariable function evaluated with input constants and linked datasets.

Author:
Douglas Brown
See Also:
Serialized Form

Nested Class Summary
protected static class DataFunction.Loader
          A class to save and load DataFunction data in an XMLControl.
 
Field Summary
 
Fields inherited from class org.opensourcephysics.display.Dataset
AREA, BAR, CIRCLE, columnID, CUSTOM, customMarker, datasetID, errorBars, generalPath, index, maxPoints, NO_MARKER, PIXEL, POST, sorted, SQUARE, visible, xmax, xmaxLogscale, xmin, xminLogscale, xpoints, ymax, ymaxLogscale, ymin, yminLogscale, ypoints
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
DataFunction(DatasetManager input)
          Constructs a DataFunction for the specified input data.
DataFunction(DatasetManager input, java.lang.String name, java.lang.String expression)
          Constructs a DataFunction for the specified input data, name and expression.
 
Method Summary
 void append(double[] x, double[] y)
          Appends (x,y) arrays to the Dataset.
 void append(double[] x, double[] y, double[] dx, double[] dy)
          Appends arrays of data points and uncertainties to the Dataset.
 void append(double x, double y)
          Overrides Dataset methods.
 void append(double x, double y, double dx, double dy)
          Appends a data point and its uncertainty to the Dataset.
 void clear()
          Clear all data from this Dataset.
 java.lang.String getExpression()
          Gets the expression.
 java.lang.String getInputString()
          Gets the current input string.
static XML.ObjectLoader getLoader()
          Returns the XML.ObjectLoader for this class.
 void refreshFunctionData()
          Refreshes the data points.
 void setExpression(java.lang.String e)
          Sets the expression.
 void setYColumnName(java.lang.String name)
          Sets the y-column name (ie the function name).
 java.lang.String toString()
          Creates a string representation of the data.
 
Methods inherited from class org.opensourcephysics.display.Dataset
convertTableColumnIndex, countColumnsVisible, draw, drawFilledPlot, drawLinePlot, drawScatterPlot, getColumnClass, getColumnCount, getColumnID, getColumnName, getColumnNames, getData2D, getData3D, getDataList, getDatasets, getEdgeColor, getFillColor, getFillColors, getID, getIndex, getLineColor, getLineColors, getMarkerShape, getMarkerSize, getName, getPoints, getRowCount, getValidXPoints, getValidYPoints, getValueAt, getVisible, getXColumnName, getXMax, getXMaxLogscale, getXMin, getXMinLogscale, getXPoints, getYColumnName, getYMax, getYMaxLogscale, getYMin, getYMinLogscale, getYPoints, insertionSort, isConnected, isMeasured, isSorted, isXColumnVisible, isYColumnVisible, moveDatum, read, recalculatePath, setColumnID, setConnected, setCustomMarker, setID, setLineColor, setMarkerColor, setMarkerColor, setMarkerColor, setMarkerShape, setMarkerSize, setMaximumPoints, setName, setSorted, setStride, setVisible, setXColumnVisible, setXYColumnNames, setXYColumnNames, setYColumnVisible, write
 
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

DataFunction

public DataFunction(DatasetManager input)
Constructs a DataFunction for the specified input data.

Parameters:
input - the input data

DataFunction

public DataFunction(DatasetManager input,
                    java.lang.String name,
                    java.lang.String expression)
Constructs a DataFunction for the specified input data, name and expression.

Parameters:
input - the input data
name -
expression -
Method Detail

setExpression

public void setExpression(java.lang.String e)
Sets the expression.

Parameters:
e - the expression string

getExpression

public java.lang.String getExpression()
Gets the expression.

Returns:
the expression string

setYColumnName

public void setYColumnName(java.lang.String name)
Sets the y-column name (ie the function name).

Parameters:
name - the name

getInputString

public java.lang.String getInputString()
Gets the current input string. If the last attempt to set the function was unsuccessful, this is different from the function string.

Returns:
the input string

refreshFunctionData

public void refreshFunctionData()
Refreshes the data points.


toString

public java.lang.String toString()
Description copied from class: Dataset
Creates a string representation of the data.

Overrides:
toString in class Dataset
Returns:
the name of this DataFunction

append

public void append(double x,
                   double y)
Overrides Dataset methods. DatasetFunction manages its own data.

Overrides:
append in class Dataset

append

public void append(double x,
                   double y,
                   double dx,
                   double dy)
Description copied from class: Dataset
Appends a data point and its uncertainty to the Dataset.

Overrides:
append in class Dataset

append

public void append(double[] x,
                   double[] y)
Description copied from class: Dataset
Appends (x,y) arrays to the Dataset. Any y value of Double.NaN is treated as null in plots and tables.

Overrides:
append in class Dataset

append

public void append(double[] x,
                   double[] y,
                   double[] dx,
                   double[] dy)
Description copied from class: Dataset
Appends arrays of data points and uncertainties to the Dataset.

Overrides:
append in class Dataset

clear

public void clear()
Description copied from class: Dataset
Clear all data from this Dataset.

Overrides:
clear in class Dataset

getLoader

public static XML.ObjectLoader getLoader()
Returns the XML.ObjectLoader for this class.

Returns:
the object loader