Gephi Toolkit Javadoc

org.gephi.data.attributes.api
Interface AttributeRow

All Superinterfaces:
Attributes

public interface AttributeRow
extends Attributes

Rows contains AttributeValue, one for each column. Rows are not stored in columns and nor in tables, they are stored in the object that possess the row, for instance Nodes or Edges.

But colums are fixed, stored in AttributeTable. Rows always contains the values in the same order as columns are described in the table.

For instance, if an table contains a single column label, the column index is equal to 0 and the value can be retrieved in the following ways:

Rows are build from a AttributeRowFactory, that can be get from the AttributeModel.

Nodes and edges

Nodes and edges elements are build from Graph API, and already have a default row that can be found with Attributable.getAttributes() and EdgeData.getAttributes(). Please cast Attributes in AttributesRow to profit from the complete API.

Author:
Mathieu Bastian, Cezary Bartosiak
See Also:
AttributeColumn, AttributeTable, AttributeValue

Method Summary
 int countValues()
          Returns the number of values this rows contains.
 AttributeValue getAttributeValueAt(int index)
          Returns the value at given index or null if the index is not valid.
 AttributeColumn getColumnAt(int index)
          Returns the column at given index or null if the index is not valid
 java.lang.Object getValue(AttributeColumn column)
          Returns the value found at the specified column index.
 java.lang.Object getValue(int index)
          Returns the value at the specified index, if index is in range.
 java.lang.Object getValue(java.lang.String column)
          Returns the value at the specified column, if found.
 AttributeValue[] getValues()
          Returns the value array.
 void reset()
          Resets all data in the row.
 void setValue(AttributeColumn column, java.lang.Object value)
          Sets a value at the specified column index.
 void setValue(AttributeValue value)
          Sets a value for this row.
 void setValue(int index, java.lang.Object value)
          Sets a value at the specified column index, if index is in range.
 void setValue(java.lang.String column, java.lang.Object value)
          Sets a value at the specified column index, if column is found.
 void setValues(AttributeRow row)
          Sets values from another row.
 

Method Detail

reset

void reset()
Resets all data in the row.

Specified by:
reset in interface Attributes

countValues

int countValues()
Returns the number of values this rows contains. Equal to the number of columns of the AttributeTable this row belongs.

Specified by:
countValues in interface Attributes
Returns:
the size of the values array

setValues

void setValues(AttributeRow row)
Sets values from another row. Values must have existing column in the current table.

Parameters:
row - an existing row that may refer to the same columns

setValue

void setValue(AttributeValue value)
Sets a value for this row. If the column retrieved from value cannot be found at the same index, the column Id is used to find the column.

Parameters:
value - a value that refers to an existing column for this row

setValue

void setValue(AttributeColumn column,
              java.lang.Object value)
Sets a value at the specified column index.

Parameters:
column - a column that exists for this row
value - the value that is to be set a the specified column index

setValue

void setValue(java.lang.String column,
              java.lang.Object value)
Sets a value at the specified column index, if column is found. The column is found if column refers to an existing column id or title.

Specified by:
setValue in interface Attributes
Parameters:
column - a column id or title
value - the value that is to be set if column is found

setValue

void setValue(int index,
              java.lang.Object value)
Sets a value at the specified column index, if index is in range. This is equivalent as setValue(AttributeColumn.getIndex(), Object).

Specified by:
setValue in interface Attributes
Parameters:
index - a valid column index
value - the value that is to be set if index is valide

getValue

java.lang.Object getValue(AttributeColumn column)
Returns the value found at the specified column index. May return null if the value is null or if the column doesn't exist.

Parameters:
column - a column that exists for this row
Returns:
the value found at the specified column index or null otherwise

getValue

java.lang.Object getValue(java.lang.String column)
Returns the value at the specified column, if found. The column is found if column refers to an existing column id or title.

Specified by:
getValue in interface Attributes
Parameters:
column - a column id or title
Returns:
the value found at the specified column or null otherwise

getValue

java.lang.Object getValue(int index)
Returns the value at the specified index, if index is in range. This is equivalent as getValue(AttributeColumn.getIndex()).

Specified by:
getValue in interface Attributes
Parameters:
index - a valid column index
Returns:
the value found at the specified column or null otherwise
See Also:
AttributeColumn.getIndex()

getValues

AttributeValue[] getValues()
Returns the value array. Each AttributeValue is a pair between a data and the column it belongs.

Returns:
the value array of this row

getAttributeValueAt

AttributeValue getAttributeValueAt(int index)
Returns the value at given index or null if the index is not valid. Each AttributeValue is a pair between a data and the column it belongs.

Parameters:
index -
Returns:
AttributeValue at given index or null if the index is not valid

getColumnAt

AttributeColumn getColumnAt(int index)
Returns the column at given index or null if the index is not valid

Parameters:
index -
Returns:
AttributeColumn at given index or null if the index is not valid

Gephi Toolkit Javadoc