public class DataSortedTableModel
extends weka.gui.SortedTableModel
implements weka.core.Undoable
listenerList
Constructor and Description |
---|
DataSortedTableModel(weka.core.Instances data)
initializes the sorter w/o a model, but uses the given data to create
a model from that
|
DataSortedTableModel(String filename,
weka.core.converters.AbstractFileLoader... loaders)
initializes the sorter w/o a model, but loads the given file and creates
from that a model
|
DataSortedTableModel(TableModel model)
initializes the sorter with the given model
|
Modifier and Type | Method and Description |
---|---|
void |
addTableModelListener(TableModelListener l)
adds a listener to the list that is notified each time a change to data
model occurs
|
void |
addUndoPoint()
adds an undo point to the undo history
|
void |
attributeAsClassAt(int columnIndex)
sets the attribute at the given col index as the new class attribute
|
boolean |
canUndo()
returns whether an undo is possible, i.e.
|
void |
clearUndo()
removes the undo history
|
void |
deleteAttributeAt(int columnIndex)
deletes the attribute at the given col index
|
void |
deleteAttributes(int[] columnIndices)
deletes the attributes at the given indices
|
void |
deleteInstanceAt(int rowIndex)
deletes the instance at the given index
|
void |
deleteInstances(int[] rowIndices)
deletes the instances at the given positions
|
weka.core.Attribute |
getAttributeAt(int columnIndex)
returns the attribute at the given index, can be NULL if not an attribute
column
|
int |
getAttributeColumn(String name)
returns the column of the given attribute name, -1 if not found
|
weka.core.Instances |
getInstances()
returns the data
|
double |
getInstancesValueAt(int rowIndex,
int columnIndex)
returns the double value of the underlying Instances object at the
given position, -1 if out of bounds
|
Object |
getModelValueAt(int rowIndex,
int columnIndex)
returns the value at the given position
|
boolean |
getShowAttributeIndex()
Returns whether to display the attribute index in the header.
|
int |
getType(int columnIndex)
returns the TYPE of the attribute at the given position
|
int |
getType(int rowIndex,
int columnIndex)
returns the TYPE of the attribute at the given position
|
void |
insertInstance(int index)
Insert a new instance (all values 0) at the given index.
|
boolean |
isMissingAt(int rowIndex,
int columnIndex)
checks whether the value at the given position is missing
|
boolean |
isNotificationEnabled()
returns whether the notification of changes is enabled
|
boolean |
isReadOnly()
returns whether the model is read-only
|
boolean |
isUndoEnabled()
returns whether undo support is enabled
|
void |
notifyListener(TableModelEvent e)
notfies all listener of the change of the model
|
void |
removeTableModelListener(TableModelListener l)
removes a listener from the list that is notified each time a change to
the data model occurs
|
void |
renameAttributeAt(int columnIndex,
String newName)
renames the attribute at the given col index
|
void |
setInstances(weka.core.Instances data)
sets the data
|
void |
setNotificationEnabled(boolean enabled)
sets whether the notification of changes is enabled
|
void |
setReadOnly(boolean value)
sets whether the model is read-only
|
void |
setShowAttributeIndex(boolean value)
Sets whether to display the attribute index in the header.
|
void |
setUndoEnabled(boolean enabled)
sets whether undo support is enabled
|
void |
sort(int columnIndex,
boolean ascending)
sorts the table over the given column, either ascending or descending
|
void |
sortInstances(int columnIndex)
sorts the instances via the given attribute
|
void |
sortInstances(int columnIndex,
boolean ascending)
sorts the instances via the given attribute
|
void |
undo()
undoes the last action
|
addMouseListenerToHeader, getActualRow, getColumnClass, getColumnCount, getColumnName, getModel, getRowCount, getValueAt, initializeIndices, isCellEditable, isInitialized, isSorted, setModel, setValueAt, sort, tableChanged
findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners
public DataSortedTableModel(String filename, weka.core.converters.AbstractFileLoader... loaders)
filename
- the file to loadloaders
- optional varargs loader to usepublic DataSortedTableModel(weka.core.Instances data)
data
- the data to usepublic DataSortedTableModel(TableModel model)
model
- the model to usepublic boolean isNotificationEnabled()
public void setNotificationEnabled(boolean enabled)
enabled
- enables/disables the notificationpublic boolean isUndoEnabled()
isUndoEnabled
in interface weka.core.Undoable
public void setUndoEnabled(boolean enabled)
setUndoEnabled
in interface weka.core.Undoable
enabled
- whether to enable/disable undo supportpublic boolean isReadOnly()
public void setReadOnly(boolean value)
value
- if true the model is set to read-onlypublic double getInstancesValueAt(int rowIndex, int columnIndex)
rowIndex
- the row indexcolumnIndex
- the column indexpublic Object getModelValueAt(int rowIndex, int columnIndex)
rowIndex
- the row indexcolumnIndex
- the column indexpublic int getType(int columnIndex)
columnIndex
- the index of the columnpublic int getType(int rowIndex, int columnIndex)
rowIndex
- the index of the rowcolumnIndex
- the index of the columnpublic void deleteAttributeAt(int columnIndex)
columnIndex
- the index of the attribute to deletepublic void deleteAttributes(int[] columnIndices)
columnIndices
- the column indicespublic void renameAttributeAt(int columnIndex, String newName)
columnIndex
- the index of the columnnewName
- the new name of the attributepublic void attributeAsClassAt(int columnIndex)
columnIndex
- the index of the columnpublic void deleteInstanceAt(int rowIndex)
rowIndex
- the index of the rowpublic void insertInstance(int index)
index
- the index to insert atpublic void deleteInstances(int[] rowIndices)
rowIndices
- the indices to deletepublic void sortInstances(int columnIndex)
columnIndex
- the index of the columnpublic void sortInstances(int columnIndex, boolean ascending)
columnIndex
- the index of the columnascending
- ascending if true, otherwise descendingpublic void sort(int columnIndex, boolean ascending)
sort
in class weka.gui.SortedTableModel
columnIndex
- the column to sort overascending
- ascending if true, otherwise descendingpublic int getAttributeColumn(String name)
name
- the name of the attributepublic boolean isMissingAt(int rowIndex, int columnIndex)
rowIndex
- the row indexcolumnIndex
- the column indexpublic void setInstances(weka.core.Instances data)
data
- the data to usepublic weka.core.Instances getInstances()
public weka.core.Attribute getAttributeAt(int columnIndex)
columnIndex
- the index of the columnpublic void addTableModelListener(TableModelListener l)
addTableModelListener
in interface TableModel
addTableModelListener
in class AbstractTableModel
l
- the listener to addpublic void removeTableModelListener(TableModelListener l)
removeTableModelListener
in interface TableModel
removeTableModelListener
in class AbstractTableModel
l
- the listener to removepublic void notifyListener(TableModelEvent e)
e
- the event to send to the listenerspublic void clearUndo()
clearUndo
in interface weka.core.Undoable
public boolean canUndo()
canUndo
in interface weka.core.Undoable
public void undo()
undo
in interface weka.core.Undoable
public void addUndoPoint()
addUndoPoint
in interface weka.core.Undoable
public void setShowAttributeIndex(boolean value)
value
- if true then the attribute indices are displayed in the
table headerpublic boolean getShowAttributeIndex()
Copyright © 2017. All Rights Reserved.