data
public class DataSheet extends java.lang.Object implements javax.swing.table.TableModel, java.io.Serializable, javax.swing.ListModel
Everytime the user imports data from a text file the data is stored in
a DataSheet. The data sheet is a kind of wrapper class for the collection
of all rows in the text file. Each row represents one Design
.
In addition to storing the Designs and providing the possibility to display
them in a JTable by implementing TableModel, the DataSheet class also
keeps track of the Parameters in the data set. Each column represents one
Parameter
.
The third main function of this class is to actually read the data from a text file. While doing this, the DataSheet also collects some additional information, such as
A ListModel is implemented for other functions of the program to be able to display parameters in a JList.
Finally, the DataSheet also keeps track of all Cluster
s. However, it does not
store the information to which Cluster each Design belongs. This information is stored in
the Designs themselves. It is important to understand this because it means that whenever
updateData(String, boolean, ProgressMonitor)
is called this information is lost.
Constructor and Description |
---|
DataSheet(java.lang.String pathToInputFile,
boolean dataHasHeaders,
Main mainWindow,
javax.swing.ProgressMonitor progressMonitor)
Instantiates a new data sheet and fills it with data from a given file.
|
Modifier and Type | Method and Description |
---|---|
void |
addDesign(Design design)
Adds a Design to the DataSheet.
|
void |
addListDataListener(javax.swing.event.ListDataListener l) |
void |
addTableModelListener(javax.swing.event.TableModelListener l) |
void |
evaluateBoundsForAllDesigns(ParallelCoordinatesChart chart)
Evaluate each Design to check whether it is within all axis bounds.
|
void |
fireTableChanged(int firstRow,
int lastRow,
int column,
boolean chartRebuildRequired,
boolean chartRepaintRequired,
boolean dataPanelUpdateRequired,
boolean[] axisAutofitRequired,
boolean[] axisResetFilterRequired,
boolean[] axisApplyFiltersRequired)
Fire table changed.
|
ClusterSet |
getClusterSet()
Gets the cluster set.
|
java.lang.Class<?> |
getColumnClass(int arg0) |
int |
getColumnCount() |
java.lang.String |
getColumnName(int columnIndex) |
Design |
getDesign(int i)
Gets the Design with index i.
|
int |
getDesignCount()
Gets the design count.
|
java.lang.Object |
getElementAt(int index) |
double |
getMaxValueOf(Parameter param)
Gets the maximum value of a given Parameter in the DataSheet.
|
double |
getMinValueOf(Parameter param)
Gets the minimum value of a given Parameter.
|
Parameter |
getParameter(int index)
Gets the Parameter with the index index.
|
Parameter |
getParameter(java.lang.String parameterName)
Gets the Parameter with the name parameterName.
|
int |
getParameterCount()
Gets the Parameter count.
|
int |
getParameterIndex(java.lang.String parameterName)
Gets the index of the Parameter with the name parameterName.
|
java.lang.String |
getParameterName(int index)
Gets the Parameter name of the Parameter with index index.
|
int |
getRowCount() |
int |
getSize() |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex) |
boolean |
isCellEditable(int rowIndex,
int columnIndex) |
void |
moveParameter(int oldIndex,
int newIndex)
Function to reorder the parameters in the datasheet
|
boolean |
parameterExists(Parameter param)
Checks if the given Parameter exists.
|
void |
removeDesigns(int[] designsToRemove)
Removes a Design from the DataSheet.
|
void |
removeListDataListener(javax.swing.event.ListDataListener l) |
Parameter |
removeParameter(java.lang.String parameterName)
Removes the Parameter with the name parameterName.
|
void |
removeTableModelListener(javax.swing.event.TableModelListener l) |
void |
setClusterSet(ClusterSet clusterSet)
Sets the cluster set.
|
void |
setValueAt(java.lang.Object arg0,
int rowIndex,
int columnIndex) |
void |
updateData(java.lang.String pathToInputFile,
boolean dataHasHeaders,
javax.swing.ProgressMonitor progressMonitor)
Updates the DataSheet with Data from a given file and assigns Parameter names.
|
public DataSheet(java.lang.String pathToInputFile, boolean dataHasHeaders, Main mainWindow, javax.swing.ProgressMonitor progressMonitor) throws java.io.IOException
Uses importData(String, boolean, ProgressMonitor)
for the step of reading the data.
pathToInputFile
- the path to the input filedataHasHeaders
- specifies whether the data has headers to read the Parameter names from.java.io.IOException
- Signals that an I/O exception has occurred.public void updateData(java.lang.String pathToInputFile, boolean dataHasHeaders, javax.swing.ProgressMonitor progressMonitor) throws java.io.IOException, InconsistentDataException
If dataHasHeaders is true, the Parameter names are read from the first line. Otherwise the parameter names are created automatically.
The difference of updating vs. importing is that all Charts are kept. This requires the new data to have the same number of parameters as the previous one. Otherwise the InconsistentDataException is thrown.
pathToInputFile
- the path to the input filedataHasHeaders
- specifies whether the data has headers to read the Parameter names from.progressMonitor
- the progress monitor.java.io.IOException
- Signals that an I/O exception has occurred.InconsistentDataException
- if the user tries to import data that does not have the same number
of columns as the current DataSheet.public java.lang.Class<?> getColumnClass(int arg0)
getColumnClass
in interface javax.swing.table.TableModel
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public java.lang.String getColumnName(int columnIndex)
getColumnName
in interface javax.swing.table.TableModel
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
getValueAt
in interface javax.swing.table.TableModel
public void setValueAt(java.lang.Object arg0, int rowIndex, int columnIndex)
setValueAt
in interface javax.swing.table.TableModel
public boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface javax.swing.table.TableModel
public void addTableModelListener(javax.swing.event.TableModelListener l)
addTableModelListener
in interface javax.swing.table.TableModel
public void removeTableModelListener(javax.swing.event.TableModelListener l)
removeTableModelListener
in interface javax.swing.table.TableModel
public void fireTableChanged(int firstRow, int lastRow, int column, boolean chartRebuildRequired, boolean chartRepaintRequired, boolean dataPanelUpdateRequired, boolean[] axisAutofitRequired, boolean[] axisResetFilterRequired, boolean[] axisApplyFiltersRequired)
public Design getDesign(int i)
i
- the indexpublic void addDesign(Design design)
design
- the Designpublic void removeDesigns(int[] designsToRemove)
designsToRemove
- an array of indeces that indicate the designs to removepublic int getParameterCount()
public java.lang.String getParameterName(int index)
index
- the indexpublic Parameter getParameter(int index)
index
- the Parameter indexpublic Parameter getParameter(java.lang.String parameterName)
parameterName
- the Parameter namepublic int getParameterIndex(java.lang.String parameterName)
parameterName
- the Parameter namepublic Parameter removeParameter(java.lang.String parameterName)
parameterName
- the Parameter namepublic boolean parameterExists(Parameter param)
param
- the Parameterpublic double getMaxValueOf(Parameter param)
param
- the Parameterpublic double getMinValueOf(Parameter param)
param
- the parameterpublic int getDesignCount()
public ClusterSet getClusterSet()
public void setClusterSet(ClusterSet clusterSet)
clusterSet
- the new cluster setpublic void evaluateBoundsForAllDesigns(ParallelCoordinatesChart chart)
chart
- the chartDesign
public void moveParameter(int oldIndex, int newIndex)
oldIndex
- the index of the parameter to be movednewIndex
- the target index for the parameter to be movedpublic void addListDataListener(javax.swing.event.ListDataListener l)
addListDataListener
in interface javax.swing.ListModel
public java.lang.Object getElementAt(int index)
getElementAt
in interface javax.swing.ListModel
public int getSize()
getSize
in interface javax.swing.ListModel
public void removeListDataListener(javax.swing.event.ListDataListener l)
removeListDataListener
in interface javax.swing.ListModel