tableModels
Class TemplateVectorModel

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended bytableModels.TemplateVectorModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class TemplateVectorModel
extends javax.swing.table.AbstractTableModel

Table model responsible for displaying and allowing the user to select which statistics to actually use when performing the clustering algorithm.

The user can see and select any attribute to use when clustering.

See Also:
Serialized Form

Field Summary
private  java.util.ArrayList selectedStats
          list of boolean values signifying which statistics the user wishes to use
private  java.util.ArrayList statList
          list of statistics to offer to the user
private  java.lang.String[] tableColumnNames
          column names for the tables
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TemplateVectorModel()
           
TemplateVectorModel(AttributeVector template)
          Creates an instance of the model with the rows initialized to the statistics names present in the template attribute vector and the boolean values set according to the double values present in the template vector.
 
Method Summary
 void addStatistic(java.lang.String statName)
          Add a new statistic to the table
 void addStatistic(java.lang.String statName, double value)
          Adds the statistic name and sets the boolean on the table.
 void clearVectorTableModel()
          Reinitializes the table model in preperation fo new data being loaded
 java.lang.Class getColumnClass(int c)
           
 int getColumnCount()
           
 java.lang.String getColumnName(int col)
           
 int getRowCount()
           
 java.util.ArrayList getTemplateVector()
          Gets an array of strings where each index in the array is either a "1" or "0".
 java.lang.Object getValueAt(int row, int col)
           
 void initializeTableWithVector(AttributeVector template)
          Allows the table to be initialized with a vector that already has all the statistic names set.
 boolean isCellEditable(int row, int col)
           
 void setValueAt(java.lang.Object value, int row, int col)
          Setter for the table, stores a data item stored in the table
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tableColumnNames

private java.lang.String[] tableColumnNames
column names for the tables


selectedStats

private java.util.ArrayList selectedStats
list of boolean values signifying which statistics the user wishes to use


statList

private java.util.ArrayList statList
list of statistics to offer to the user

Constructor Detail

TemplateVectorModel

public TemplateVectorModel()

TemplateVectorModel

public TemplateVectorModel(AttributeVector template)
Creates an instance of the model with the rows initialized to the statistics names present in the template attribute vector and the boolean values set according to the double values present in the template vector.

Parameters:
template - Usually it is the paramVector from ClusterUtils which has 0's and 1's denoting if that column should be used in the clustering algorithm
Method Detail

getColumnName

public java.lang.String getColumnName(int col)

getColumnCount

public int getColumnCount()

getRowCount

public int getRowCount()

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)

getColumnClass

public java.lang.Class getColumnClass(int c)

isCellEditable

public boolean isCellEditable(int row,
                              int col)

setValueAt

public void setValueAt(java.lang.Object value,
                       int row,
                       int col)
Setter for the table, stores a data item stored in the table

Parameters:
row - row value to store item
col - column value to store item
value - Object to store in the table

clearVectorTableModel

public void clearVectorTableModel()
Reinitializes the table model in preperation fo new data being loaded


addStatistic

public void addStatistic(java.lang.String statName)
Add a new statistic to the table

Parameters:
statName - the name of the statistic to add

addStatistic

public void addStatistic(java.lang.String statName,
                         double value)
Adds the statistic name and sets the boolean on the table.

If value > 0, the boolean is set to TRUE, FALSE otherwise

Parameters:
statName - the statical attribute to add to the table
value - the value uesed to determine if the boolean is true or false

getTemplateVector

public java.util.ArrayList getTemplateVector()
Gets an array of strings where each index in the array is either a "1" or "0".

This array is a representation of which statistics the user has selected will be used to perform the clustering

Returns:
the string array list populated with "1" or "0" at every index

initializeTableWithVector

public void initializeTableWithVector(AttributeVector template)
Allows the table to be initialized with a vector that already has all the statistic names set.

This first initializes the table and then loads the table with the contents of the name field of the attribute vector passed to it

Parameters:
template - the vector to use to load the names into the table