prefuse.data
Interface Tuple

All Known Subinterfaces:
AggregateItem, DecoratorItem, Edge, EdgeItem, Node, NodeItem, VisualItem
All Known Implementing Classes:
TableAggregateItem, TableDecoratorItem, TableEdge, TableEdgeItem, TableNode, TableNodeItem, TableTuple, TableVisualItem

public interface Tuple

Tuples are objects representing a row of a data table, providing a simplified interface to table data. They maintain a pointer to a corresponding row in a table. When rows are deleted, any live Tuples for that row become invalidated, and any further attempts to access or set data with that Tuple will result in an exception.

Author:
jeffrey heer

Method Summary
 boolean canGet(java.lang.String field, java.lang.Class type)
          Check if the get method for the given data field returns values that are compatible with a given target type.
 boolean canGetBoolean(java.lang.String field)
          Check if the given data field can return primitive boolean values.
 boolean canGetDate(java.lang.String field)
          Check if the given data field can return Date values.
 boolean canGetDouble(java.lang.String field)
          Check if the given data field can return primitive double values.
 boolean canGetFloat(java.lang.String field)
          Check if the given data field can return primitive float values.
 boolean canGetInt(java.lang.String field)
          Check if the given data field can return primitive int values.
 boolean canGetLong(java.lang.String field)
          Check if the given data field can return primitive long values.
 boolean canGetString(java.lang.String field)
          Check if the given data field can return String values.
 boolean canSet(java.lang.String field, java.lang.Class type)
          Check if the set method for the given data field can accept values of a given target type.
 boolean canSetBoolean(java.lang.String field)
          Check if the setBoolean method can safely be used for the given data field.
 boolean canSetDate(java.lang.String field)
          Check if the setDate method can safely be used for the given data field.
 boolean canSetDouble(java.lang.String field)
          Check if the setDouble method can safely be used for the given data field.
 boolean canSetFloat(java.lang.String field)
          Check if the setFloat method can safely be used for the given data field.
 boolean canSetInt(java.lang.String field)
          Check if the setInt method can safely be used for the given data field.
 boolean canSetLong(java.lang.String field)
          Check if the setLong method can safely be used for the given data field.
 boolean canSetString(java.lang.String field)
          Check if the setString method can safely be used for the given data field.
 java.lang.Object get(int col)
          Get the data value at the given column number as an Object.
 java.lang.Object get(java.lang.String field)
          Get the data value at the given field as an Object.
 boolean getBoolean(int col)
          Get the data value at the given field as a boolean.
 boolean getBoolean(java.lang.String field)
          Get the data value at the given field as a boolean.
 int getColumnCount()
          Get the number of columns maintained by the backing table.
 int getColumnIndex(java.lang.String field)
          Get the column index corresponding to the given data field.
 java.lang.String getColumnName(int col)
          Get the data field name of the column at the given index.
 java.lang.Class getColumnType(int col)
          Returns the data type of the given column as a Java Class instance.
 java.lang.Class getColumnType(java.lang.String field)
          Returns the data type of the given field as a Java Class instance.
 java.util.Date getDate(int col)
          Get the data value at the given field as a Date.
 java.util.Date getDate(java.lang.String field)
          Get the data value at the given field as a Date.
 java.lang.Object getDefault(java.lang.String field)
          Get the default value for the given data field.
 double getDouble(int col)
          Get the data value at the given field as a double.
 double getDouble(java.lang.String field)
          Get the data value at the given field as a double.
 float getFloat(int col)
          Get the data value at the given field as a float.
 float getFloat(java.lang.String field)
          Get the data value at the given field as a float.
 int getInt(int col)
          Get the data value at the given field as an int.
 int getInt(java.lang.String field)
          Get the data value at the given field as an int.
 long getLong(int col)
          Get the data value at the given field as a long.
 long getLong(java.lang.String field)
          Get the data value at the given field as a long.
 int getRow()
          Returns the row index for this Tuple's backing Table, if it exists.
 Schema getSchema()
          Returns the schema for this tuple's data.
 java.lang.String getString(int col)
          Get the data value at the given field as a String.
 java.lang.String getString(java.lang.String field)
          Get the data value at the given field as a String.
 Table getTable()
          Returns the Table instance that backs this Tuple, if it exists.
 boolean isValid()
          Indicates if this Tuple is valid.
 void revertToDefault(java.lang.String field)
          Revert this tuple's value for the given field to the default value for the field.
 void set(int col, java.lang.Object value)
          Set the value of at the given column number.
 void set(java.lang.String field, java.lang.Object value)
          Set the value of a given data field.
 void setBoolean(int col, boolean val)
          Set the data value of the given field with a boolean.
 void setBoolean(java.lang.String field, boolean val)
          Set the data value of the given field with a boolean.
 void setDate(int col, java.util.Date val)
          Set the data value of the given field with a Date.
 void setDate(java.lang.String field, java.util.Date val)
          Set the data value of the given field with a Date.
 void setDouble(int col, double val)
          Set the data value of the given field with a double.
 void setDouble(java.lang.String field, double val)
          Set the data value of the given field with a double.
 void setFloat(int col, float val)
          Set the data value of the given field with a float.
 void setFloat(java.lang.String field, float val)
          Set the data value of the given field with a float.
 void setInt(int col, int val)
          Set the data value of the given field with an int.
 void setInt(java.lang.String field, int val)
          Set the data value of the given field with an int.
 void setLong(int col, long val)
          Set the data value of the given field with a long.
 void setLong(java.lang.String field, long val)
          Set the data value of the given field with a long.
 void setString(int col, java.lang.String val)
          Set the data value of the given field with a String.
 void setString(java.lang.String field, java.lang.String val)
          Set the data value of the given field with a String.
 

Method Detail

getSchema

Schema getSchema()
Returns the schema for this tuple's data.

Returns:
the Tuple Schema

getTable

Table getTable()
Returns the Table instance that backs this Tuple, if it exists.

Returns:
the backing Table, or null if there is none.

getRow

int getRow()
Returns the row index for this Tuple's backing Table, if it exists.

Returns:
the backing row index, or -1 if there is no backing table or if this Tuple has been invalidated (i.e., the Tuple's row was deleted from the backing table).

isValid

boolean isValid()
Indicates if this Tuple is valid. Trying to get or set values on an invalid Tuple will result in a runtime exception.

Returns:
true if this Tuple is valid, false otherwise

getColumnType

java.lang.Class getColumnType(java.lang.String field)
Returns the data type of the given field as a Java Class instance.

Parameters:
field - the data field
Returns:
the data type of the field, a Class instance indicating the top-level type of data values in this field.

getColumnType

java.lang.Class getColumnType(int col)
Returns the data type of the given column as a Java Class instance.

Parameters:
col - the column index
Returns:
the data type of the column, a Class instance indicating the top-level type of data values in this field.

getColumnIndex

int getColumnIndex(java.lang.String field)
Get the column index corresponding to the given data field.

Parameters:
field - the data field to look up
Returns:
the column index of the field within the backing table, or -1 if no columns with the given name were found

getColumnCount

int getColumnCount()
Get the number of columns maintained by the backing table.

Returns:
the number of columns / data fields.

getColumnName

java.lang.String getColumnName(int col)
Get the data field name of the column at the given index.

Parameters:
col - the column index to look up
Returns:
the data field name of the given column index

canGet

boolean canGet(java.lang.String field,
               java.lang.Class type)
Check if the get method for the given data field returns values that are compatible with a given target type.

Parameters:
field - the data field to check
type - a Class instance to check for compatibility with the data field values.
Returns:
true if the data field is compatible with provided type, false otherwise. If the value is true, objects returned by the get(String) can be cast to the given type.
See Also:
get(String)

canSet

boolean canSet(java.lang.String field,
               java.lang.Class type)
Check if the set method for the given data field can accept values of a given target type.

Parameters:
field - the data field to check
type - a Class instance to check for compatibility with the data field values.
Returns:
true if the data field is compatible with provided type, false otherwise. If the value is true, objects of the given type can be used as parameters of the set(String, Object) method.
See Also:
set(String, Object)

get

java.lang.Object get(java.lang.String field)
Get the data value at the given field as an Object.

Parameters:
field - the data field to retrieve
Returns:
the data value as an Object. The concrete type of this Object is dependent on the underlying data column used.
See Also:
canGet(String, Class), getColumnType(String)

set

void set(java.lang.String field,
         java.lang.Object value)
Set the value of a given data field.

Parameters:
field - the data field to set
value - the value for the field. If the concrete type of this Object is not compatible with the underlying data model, an Exception will be thrown. Use the canSet(String, Class) method to check the type-safety ahead of time.
See Also:
canSet(String, Class), getColumnType(String)

get

java.lang.Object get(int col)
Get the data value at the given column number as an Object.

Parameters:
col - the column number
Returns:
the data value as an Object. The concrete type of this Object is dependent on the underlying data column used.
See Also:
canGet(String, Class), getColumnType(int)

set

void set(int col,
         java.lang.Object value)
Set the value of at the given column number.

Parameters:
col - the column number
value - the value for the field. If the concrete type of this Object is not compatible with the underlying data model, an Exception will be thrown. Use the canSet(String, Class) method to check the type-safety ahead of time.
See Also:
canSet(String, Class), getColumnType(String)

getDefault

java.lang.Object getDefault(java.lang.String field)
Get the default value for the given data field.

Parameters:
field - the data field
Returns:
the default value, as an Object, used to populate rows of the data field.

revertToDefault

void revertToDefault(java.lang.String field)
Revert this tuple's value for the given field to the default value for the field.

Parameters:
field - the data field
See Also:
getDefault(String)

canGetInt

boolean canGetInt(java.lang.String field)
Check if the given data field can return primitive int values.

Parameters:
field - the data field to check
Returns:
true if the data field can return primitive int values, false otherwise. If true, the getInt(String) method can be used safely.

canSetInt

boolean canSetInt(java.lang.String field)
Check if the setInt method can safely be used for the given data field.

Parameters:
field - the data field to check
Returns:
true if the setInt(String, int) method can safely be used for the given field, false otherwise.

getInt

int getInt(java.lang.String field)
Get the data value at the given field as an int.

Parameters:
field - the data field to retrieve
See Also:
canGetInt(String)

setInt

void setInt(java.lang.String field,
            int val)
Set the data value of the given field with an int.

Parameters:
field - the data field to set
val - the value to set
See Also:
canSetInt(String)

getInt

int getInt(int col)
Get the data value at the given field as an int.

Parameters:
col - the column number of the data field to retrieve
See Also:
canGetInt(String)

setInt

void setInt(int col,
            int val)
Set the data value of the given field with an int.

Parameters:
col - the column number of the data field to set
val - the value to set
See Also:
canSetInt(String)

canGetLong

boolean canGetLong(java.lang.String field)
Check if the given data field can return primitive long values.

Parameters:
field - the data field to check
Returns:
true if the data field can return primitive long values, false otherwise. If true, the getLong(String) method can be used safely.

canSetLong

boolean canSetLong(java.lang.String field)
Check if the setLong method can safely be used for the given data field.

Parameters:
field - the data field to check
Returns:
true if the setLong(String, long) method can safely be used for the given field, false otherwise.

getLong

long getLong(java.lang.String field)
Get the data value at the given field as a long.

Parameters:
field - the data field to retrieve
See Also:
canGetLong(String)

setLong

void setLong(java.lang.String field,
             long val)
Set the data value of the given field with a long.

Parameters:
field - the data field to set
val - the value to set
See Also:
canSetLong(String)

getLong

long getLong(int col)
Get the data value at the given field as a long.

Parameters:
col - the column number of the data field to retrieve
See Also:
canGetLong(String)

setLong

void setLong(int col,
             long val)
Set the data value of the given field with a long.

Parameters:
col - the column number of the data field to set
val - the value to set
See Also:
canSetLong(String)

canGetFloat

boolean canGetFloat(java.lang.String field)
Check if the given data field can return primitive float values.

Parameters:
field - the data field to check
Returns:
true if the data field can return primitive float values, false otherwise. If true, the getFloat(String) method can be used safely.

canSetFloat

boolean canSetFloat(java.lang.String field)
Check if the setFloat method can safely be used for the given data field.

Parameters:
field - the data field to check
Returns:
true if the setFloat(String, float) method can safely be used for the given field, false otherwise.

getFloat

float getFloat(java.lang.String field)
Get the data value at the given field as a float.

Parameters:
field - the data field to retrieve
See Also:
canGetFloat(String)

setFloat

void setFloat(java.lang.String field,
              float val)
Set the data value of the given field with a float.

Parameters:
field - the data field to set
val - the value to set
See Also:
canSetFloat(String)

getFloat

float getFloat(int col)
Get the data value at the given field as a float.

Parameters:
col - the column number of the data field to retrieve
See Also:
canGetFloat(String)

setFloat

void setFloat(int col,
              float val)
Set the data value of the given field with a float.

Parameters:
col - the column number of the data field to set
val - the value to set
See Also:
canSetFloat(String)

canGetDouble

boolean canGetDouble(java.lang.String field)
Check if the given data field can return primitive double values.

Parameters:
field - the data field to check
Returns:
true if the data field can return primitive double values, false otherwise. If true, the getDouble(String) method can be used safely.

canSetDouble

boolean canSetDouble(java.lang.String field)
Check if the setDouble method can safely be used for the given data field.

Parameters:
field - the data field to check
Returns:
true if the setDouble(String, double) method can safely be used for the given field, false otherwise.

getDouble

double getDouble(java.lang.String field)
Get the data value at the given field as a double.

Parameters:
field - the data field to retrieve
See Also:
canGetDouble(String)

setDouble

void setDouble(java.lang.String field,
               double val)
Set the data value of the given field with a double.

Parameters:
field - the data field to set
val - the value to set
See Also:
canSetDouble(String)

getDouble

double getDouble(int col)
Get the data value at the given field as a double.

Parameters:
col - the column number of the data field to retrieve
See Also:
canGetDouble(String)

setDouble

void setDouble(int col,
               double val)
Set the data value of the given field with a double.

Parameters:
col - the column number of the data field to set
val - the value to set
See Also:
canSetDouble(String)

canGetBoolean

boolean canGetBoolean(java.lang.String field)
Check if the given data field can return primitive boolean values.

Parameters:
field - the data field to check
Returns:
true if the data field can return primitive boolean values, false otherwise. If true, the getBoolean(String) method can be used safely.

canSetBoolean

boolean canSetBoolean(java.lang.String field)
Check if the setBoolean method can safely be used for the given data field.

Parameters:
field - the data field to check
Returns:
true if the setBoolean(String, boolean) method can safely be used for the given field, false otherwise.

getBoolean

boolean getBoolean(java.lang.String field)
Get the data value at the given field as a boolean.

Parameters:
field - the data field to retrieve
See Also:
canGetBoolean(String)

setBoolean

void setBoolean(java.lang.String field,
                boolean val)
Set the data value of the given field with a boolean.

Parameters:
field - the data field to set
val - the value to set
See Also:
canSetBoolean(String)

getBoolean

boolean getBoolean(int col)
Get the data value at the given field as a boolean.

Parameters:
col - the column number of the data field to retrieve
See Also:
canGetBoolean(String)

setBoolean

void setBoolean(int col,
                boolean val)
Set the data value of the given field with a boolean.

Parameters:
col - the column number of the data field to set
val - the value to set
See Also:
canSetBoolean(String)

canGetString

boolean canGetString(java.lang.String field)
Check if the given data field can return String values.

Parameters:
field - the data field to check
Returns:
true if the data field can return String values, false otherwise. If true, the getString(String) method can be used safely.

canSetString

boolean canSetString(java.lang.String field)
Check if the setString method can safely be used for the given data field.

Parameters:
field - the data field to check
Returns:
true if the setString(String, String) method can safely be used for the given field, false otherwise.

getString

java.lang.String getString(java.lang.String field)
Get the data value at the given field as a String.

Parameters:
field - the data field to retrieve
See Also:
canGetString(String)

setString

void setString(java.lang.String field,
               java.lang.String val)
Set the data value of the given field with a String.

Parameters:
field - the data field to set
val - the value to set
See Also:
canSetString(String)

getString

java.lang.String getString(int col)
Get the data value at the given field as a String.

Parameters:
col - the column number of the data field to retrieve
See Also:
canGetString(String)

setString

void setString(int col,
               java.lang.String val)
Set the data value of the given field with a String.

Parameters:
col - the column number of the data field to set
val - the value to set
See Also:
canSetString(String)

canGetDate

boolean canGetDate(java.lang.String field)
Check if the given data field can return Date values.

Parameters:
field - the data field to check
Returns:
true if the data field can return Date values, false otherwise. If true, the getDate(String) method can be used safely.

canSetDate

boolean canSetDate(java.lang.String field)
Check if the setDate method can safely be used for the given data field.

Parameters:
field - the data field to check
Returns:
true if the setDate(String, Date) method can safely be used for the given field, false otherwise.

getDate

java.util.Date getDate(java.lang.String field)
Get the data value at the given field as a Date.

Parameters:
field - the data field to retrieve
See Also:
canGetDate(String)

setDate

void setDate(java.lang.String field,
             java.util.Date val)
Set the data value of the given field with a Date.

Parameters:
field - the data field to set
val - the value to set
See Also:
canSetDate(String)

getDate

java.util.Date getDate(int col)
Get the data value at the given field as a Date.

Parameters:
col - the column number of the data field to retrieve
See Also:
canGetDate(String)

setDate

void setDate(int col,
             java.util.Date val)
Set the data value of the given field with a Date.

Parameters:
col - the column number of the data field to set
val - the value to set
See Also:
canSetDate(String)


Copyright 2007 Regents of the University of California