org.opensourcephysics.display
Class DataAdapter

java.lang.Object
  extended by org.opensourcephysics.display.DataAdapter
All Implemented Interfaces:
Data
Direct Known Subclasses:
DataFile

public class DataAdapter
extends java.lang.Object
implements Data

Data adapter class implements the Data interface for double[][] arrays.

Author:
Wolfgang Christian, Doug Brown

Field Summary
protected  java.lang.String[] colNames
           
protected  double[][] data
           
protected  int ID
           
protected  java.lang.String name
           
 
Constructor Summary
DataAdapter(double[][] array)
          Constructor DataAdapter
 
Method Summary
 java.lang.String[] getColumnNames()
          Gets column names.
 double[][] getData2D()
          Gets the double[][] array.
 double[][][] getData3D()
          Not used.
 java.util.List<Data> getDataList()
          Not used.
 java.util.ArrayList<Dataset> getDatasets()
          Not used Data because is stored in 2D array.
 java.awt.Color[] getFillColors()
          Fill colors for columns are not specified.
 int getID()
          Gets the Data ID.
 java.awt.Color[] getLineColors()
          Lines colors for columns are not specified.
 java.lang.String getName()
          Gets the name of the Data.
 void setColumnNames(java.lang.String[] names)
          Sets the column names.
 void setID(int id)
          Sets the Data ID.
 void setName(java.lang.String name)
          Sets the name of the Data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

colNames

protected java.lang.String[] colNames

name

protected java.lang.String name

data

protected double[][] data

ID

protected int ID
Constructor Detail

DataAdapter

public DataAdapter(double[][] array)
Constructor DataAdapter

Parameters:
array -
Method Detail

getColumnNames

public java.lang.String[] getColumnNames()
Gets column names. Client should assign colors. Implementation of Data interface.

Specified by:
getColumnNames in interface Data
Returns:
an array of names

setColumnNames

public void setColumnNames(java.lang.String[] names)
Sets the column names.

Parameters:
names -

getName

public java.lang.String getName()
Gets the name of the Data.

Specified by:
getName in interface Data
Returns:
the name

setName

public void setName(java.lang.String name)
Sets the name of the Data.


getData2D

public double[][] getData2D()
Gets the double[][] array. Implementation of Data interface.

Specified by:
getData2D in interface Data
Returns:
double[][]

getData3D

public double[][][] getData3D()
Not used. Implementation of Data interface method.

Specified by:
getData3D in interface Data
Returns:
double[][][]

getDataList

public java.util.List<Data> getDataList()
Not used. Implementation of Data interface.

Specified by:
getDataList in interface Data
Returns:
a list of Data objects, or null if this object contains data

getDatasets

public java.util.ArrayList<Dataset> getDatasets()
Not used Data because is stored in 2D array. Implementation of Data interface.

Specified by:
getDatasets in interface Data
Returns:
list of Datasets

getFillColors

public java.awt.Color[] getFillColors()
Fill colors for columns are not specified. Client should assign colors. Implementation of Data interface.

Specified by:
getFillColors in interface Data
Returns:
a color

getLineColors

public java.awt.Color[] getLineColors()
Lines colors for columns are not specified. Client should assign colors. Implementation of Data interface.

Specified by:
getLineColors in interface Data
Returns:
a color

getID

public int getID()
Gets the Data ID.

Specified by:
getID in interface Data
Returns:
the ID number

setID

public void setID(int id)
Sets the Data ID.

Specified by:
setID in interface Data
Parameters:
id - the ID number