|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--harmonic.mz.data.ModelNode
|
+--harmonic.mz.data.TableNode
For storeing data in a relational database style. The function setColumns() should be called directly upon creation of this class. Then rows may be added and querried.
The following column types are supported:
More efficient storage (an array of primatives) is used if the primative types are specified.
A node serializer must be given for every column of Object type. This is used in creation of XML files.
Note that this table is not ment to keep rows ordered. There are no insert operations to add rows at specific row indicies. Row indicies may change after calles to pack().
Typical use of the table would use one column as a "primary key" for finding out what row index corisponds to a row with a field of a certain value, using selectUniqueRow().
Note on the setting functions: they do not cause value changed events to be sent. The caller must manually call ModelNode.valChanged() after changing all the rows it intends to change.
| Field Summary |
| Fields inherited from class harmonic.mz.data.ModelNode |
_fileRoot_, _thread_, ATTRIB_CONTROL_WIDGET, ATTRIB_LISTABLE, ATTRIB_PRESENTABLE, ATTRIB_PRIVATE, ATTRIB_REMOVEABLE, ATTRIB_RENAMEABLE, ATTRIB_SHOW_CONTEXT_MENU, ATTRIB_TYPE_FILTER, ATTRIB_USERGROUP, ATTRIB_VALUE_GROUP, ATTRIB_VE_LISTENER, bCustomCS, bDebug, bValid, name |
| Constructor Summary | |
TableNode()
|
|
| Method Summary | |
void |
addColumn(java.lang.Class type,
java.lang.String name,
NodeSerializer nsa,
boolean bTransient)
Add a column after current last column. |
int |
addRow()
Adds a row. |
void |
allocateRows(int count)
Build an initial allocation of rows. |
int |
columnCount()
Returns number of columns |
int |
columnIndex(java.lang.String name)
Returns column index for name. |
static boolean |
compareColumns(TableNode a,
int columnA,
TableNode b,
int columnB)
|
static boolean |
compareRows(TableNode a,
int rowA,
TableNode b,
int rowB)
Returns true if rows are the same. |
ModelNode |
createCopy()
Overrideable function to create and return a copy of this node Default version uses introspection to create a new copy using the newInstance() function, which requires a no argument public constructor. |
void |
fromXMLNodes(XMLTransferNode[] xmlNodes)
Override of ModelNode XML system. |
boolean |
getBoolean(int iRow,
int iColumn)
Returns boolean value at row index and column index, assuming column is a boolean type A ClassCastException is thrown otherwise. |
java.lang.String |
getColumnName(int iColumn)
|
NodeSerializer |
getColumnSerializer(int iColumn)
|
boolean |
getColumnTransientness(int iColumn)
A transient column will not be saved to files, and can be skipped durring cloning and comparison functions. |
java.lang.Class |
getColumnType(int iColumn)
|
boolean |
getColumnVisibility(int iColumn)
|
double |
getDouble(int iRow,
int iColumn)
Returns double value at row index and column index, assuming column is a double type A ClassCastException is thrown otherwise. |
float |
getFloat(int iRow,
int iColumn)
Returns float value at row index and column index, assuming column is a float type A ClassCastException is thrown otherwise. |
int |
getInt(int iRow,
int iColumn)
Returns int value at row index and column index, assuming column is a int type A ClassCastException is thrown otherwise. |
long |
getLong(int iRow,
int iColumn)
Returns long value at row index and column index, assuming column is a long type A ClassCastException is thrown otherwise. |
java.lang.Object |
getObject(int iRow,
int iColumn)
Returns object value at row index and column index, assuming column is a object type A ClassCastException is thrown otherwise. |
java.lang.String |
getString(int iRow,
int iColumn)
Returns String value at row index and column index, assuming column is a String type A ClassCastException is thrown otherwise. |
XMLTransferNode[] |
getXMLNodes()
Override of ModelNode XML system. |
void |
pack()
Rebuilds data arrays, removing elements that have been marked removed. |
void |
printRow(java.io.PrintStream out,
int iRow)
|
void |
purgeFinal()
Called by database when node is intended to never come back, such as when a file is closed or node is deleted out of the undo system. |
void |
reallocateRows(int count)
Adds new rows, keeping the old values it can. |
void |
removeRow(int iRow)
Removes row by marking it as removed. |
int |
rowCount()
Returns the number of good rows. |
int |
selectUniqueRow(java.lang.Object value,
int iColumn)
Finds row index where data cell matches value for the given column. |
void |
setBoolean(int iRow,
int iColumn,
boolean value)
Sets value at row index and column index, assuming column is a boolean type A ClassCastException is thrown otherwise. |
void |
setBooleanColumnValues(int iColumn,
boolean value)
Set all values of column |
boolean |
setColumnIndexing(int iColumn)
|
void |
setColumnIndexing(int iColumn,
boolean b)
|
void |
setColumns(java.lang.Class[] types,
java.lang.String[] names,
NodeSerializer[] nsa)
Must be called before any other operation is done on table. |
void |
setColumnSerializer(int iColumn,
NodeSerializer ns)
NodeSerializer can be null for all types except for Object. |
void |
setColumnTransientness(int iColumn,
boolean b)
A transient column will not be saved to files, and can be skipped durring cloning and comparison functions. |
void |
setDouble(int iRow,
int iColumn,
double value)
Sets value at row index and column index, assuming column is a double type A ClassCastException is thrown otherwise. |
void |
setDoubleColumnValues(int iColumn,
double value)
Set all values of column |
void |
setFloat(int iRow,
int iColumn,
float value)
Sets value at row index and column index, assuming column is a float type A ClassCastException is thrown otherwise. |
void |
setFloatColumnValues(int iColumn,
float value)
Set all values of column |
void |
setInt(int iRow,
int iColumn,
int value)
Sets value at row index and column index, assuming column is a int type A ClassCastException is thrown otherwise. |
void |
setIntColumnValues(int iColumn,
int value)
Set all values of column |
void |
setLong(int iRow,
int iColumn,
long value)
Sets value at row index and column index, assuming column is a long type A ClassCastException is thrown otherwise. |
void |
setLongColumnValues(int iColumn,
long value)
Set all values of column |
void |
setObject(int iRow,
int iColumn,
java.lang.Object value)
Sets value at row index and column index, assuming column is a Object type A ClassCastException is thrown otherwise. |
void |
setObjectColumnValues(int iColumn,
java.lang.Object value)
Set all values of column |
void |
setString(int iRow,
int iColumn,
java.lang.String value)
Sets value at row index and column index, assuming column is a String type A ClassCastException is thrown otherwise. |
void |
setStringColumnValues(int iColumn,
java.lang.String value)
Set all values of column |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public TableNode()
| Method Detail |
public void purgeFinal()
ModelNode
purgeFinal in interface DataNodepurgeFinal in class ModelNode
public void setColumns(java.lang.Class[] types,
java.lang.String[] names,
NodeSerializer[] nsa)
throws java.lang.Exception
java.lang.Exception
public void addColumn(java.lang.Class type,
java.lang.String name,
NodeSerializer nsa,
boolean bTransient)
throws java.lang.Exception
java.lang.Exception
public void setColumnSerializer(int iColumn,
NodeSerializer ns)
public void setColumnTransientness(int iColumn,
boolean b)
public boolean getColumnTransientness(int iColumn)
public java.lang.String getColumnName(int iColumn)
public java.lang.Class getColumnType(int iColumn)
public NodeSerializer getColumnSerializer(int iColumn)
public boolean getColumnVisibility(int iColumn)
public boolean setColumnIndexing(int iColumn)
public void setColumnIndexing(int iColumn,
boolean b)
public void allocateRows(int count)
public void reallocateRows(int count)
public int addRow()
public void removeRow(int iRow)
public void pack()
public int selectUniqueRow(java.lang.Object value,
int iColumn)
public int rowCount()
public int columnCount()
public int columnIndex(java.lang.String name)
public static boolean compareRows(TableNode a,
int rowA,
TableNode b,
int rowB)
public static boolean compareColumns(TableNode a,
int columnA,
TableNode b,
int columnB)
public void printRow(java.io.PrintStream out,
int iRow)
public ModelNode createCopy()
ModelNode
createCopy in class ModelNode
public void setFloat(int iRow,
int iColumn,
float value)
public void setFloatColumnValues(int iColumn,
float value)
public float getFloat(int iRow,
int iColumn)
public void setDouble(int iRow,
int iColumn,
double value)
public void setDoubleColumnValues(int iColumn,
double value)
public double getDouble(int iRow,
int iColumn)
public void setInt(int iRow,
int iColumn,
int value)
public void setIntColumnValues(int iColumn,
int value)
public int getInt(int iRow,
int iColumn)
public void setLong(int iRow,
int iColumn,
long value)
public void setLongColumnValues(int iColumn,
long value)
public long getLong(int iRow,
int iColumn)
public void setBoolean(int iRow,
int iColumn,
boolean value)
public void setBooleanColumnValues(int iColumn,
boolean value)
public boolean getBoolean(int iRow,
int iColumn)
public void setString(int iRow,
int iColumn,
java.lang.String value)
public void setStringColumnValues(int iColumn,
java.lang.String value)
public java.lang.String getString(int iRow,
int iColumn)
public void setObject(int iRow,
int iColumn,
java.lang.Object value)
public void setObjectColumnValues(int iColumn,
java.lang.Object value)
public java.lang.Object getObject(int iRow,
int iColumn)
public void fromXMLNodes(XMLTransferNode[] xmlNodes)
fromXMLNodes in interface DataNodefromXMLNodes in class ModelNodepublic XMLTransferNode[] getXMLNodes()
getXMLNodes in interface DataNodegetXMLNodes in class ModelNode
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||