Gephi Toolkit Javadoc

org.gephi.data.attributes.api
Interface AttributeTable


public interface AttributeTable

Table hosts columns and permits all manipulation on them. Columns can be appened with different level of details. The table maintains a map with column identifier and title (header) in order they can be retrieved efficiently.

Tracking added or removed columns can be performed by adding an AttributeListener to this table.

Author:
Mathieu Bastian, Martin Ć kurla
See Also:
AttributeColumn, AttributeRow

Method Summary
 AttributeColumn addColumn(java.lang.String id, AttributeType type)
          Creates and add a new column to this table.
 AttributeColumn addColumn(java.lang.String id, AttributeType type, AttributeOrigin origin)
          Creates and add a new column to this table.
 AttributeColumn addColumn(java.lang.String id, java.lang.String title, AttributeType type, AttributeOrigin origin, java.lang.Object defaultValue)
          Creates and add a new column to this table.
 AttributeColumn addColumn(java.lang.String id, java.lang.String title, AttributeType type, AttributeValueDelegateProvider attributeValueDelegateProvider, java.lang.Object defaultValue)
          Creates and add a new column to this table.
 AttributeColumn addPropertiesColumn(PropertiesColumn propertiesColumn)
          Creates and add a new properties column to this table.
 int countColumns()
          Returns the number of column in this table.
 AttributeColumn getColumn(int index)
          Gets the column at the index of null if the index is not valid.
 AttributeColumn getColumn(java.lang.String id)
          Gets the column with the given identifier or null if it is not found.
 AttributeColumn getColumn(java.lang.String title, AttributeType type)
          Gets the column which match the given parameters or null if it is not found.
 AttributeColumn[] getColumns()
          Returns the current columns.
 java.lang.String getName()
          Returns the name of this table.
 boolean hasColumn(java.lang.String title)
          Return true if this table has a column with the given title or id.
 void mergeTable(AttributeTable table)
          Merge this table with the given table given.
 void removeColumn(AttributeColumn column)
          If exists, remove the column and all rows values.
 AttributeColumn replaceColumn(AttributeColumn source, java.lang.String id, java.lang.String title, AttributeType type, AttributeOrigin origin, java.lang.Object defaultValue)
          If exists, replace source by the new column created from params.
 

Method Detail

getName

java.lang.String getName()
Returns the name of this table.

Returns:
the name of this table

getColumns

AttributeColumn[] getColumns()
Returns the current columns. Call this method to iterate over columns.

Returns:
the current columns.

countColumns

int countColumns()
Returns the number of column in this table.

Returns:
the number of columns

addColumn

AttributeColumn addColumn(java.lang.String id,
                          AttributeType type)

Creates and add a new column to this table. The default origin is set at DATA.

The title of the column is the identifier.

Parameters:
id - the identifier of the column
type - the type of the column
Returns:
the newly created column

addColumn

AttributeColumn addColumn(java.lang.String id,
                          AttributeType type,
                          AttributeOrigin origin)

Creates and add a new column to this table.

The title of the column is the identifier.

Parameters:
id - the identifier of the column
type - the type of the column
origin - the origin of the column
Returns:
the newly created column

addColumn

AttributeColumn addColumn(java.lang.String id,
                          java.lang.String title,
                          AttributeType type,
                          AttributeOrigin origin,
                          java.lang.Object defaultValue)

Creates and add a new column to this table.

The title can't be null, empty or already existing in the table

Parameters:
id - the identifier of the column
title - the title of the column
type - the type of the column
origin - the origin of the column.
defaultValue - the default value of the column.
Returns:
the newly created column

addColumn

AttributeColumn addColumn(java.lang.String id,
                          java.lang.String title,
                          AttributeType type,
                          AttributeValueDelegateProvider attributeValueDelegateProvider,
                          java.lang.Object defaultValue)

Creates and add a new column to this table.

The title can't be null, empty or already existing in the table

Attribute origin will be set to AttributeOrigin.DELEGATE.

*

Parameters:
id - the identifier of the column
title - the title of the column
type - the type of the column
attributeValueDelegateProvider - the attribute value delegate provider of the column
defaultValue - the default value of the column
Returns:
the newly created column

addPropertiesColumn

AttributeColumn addPropertiesColumn(PropertiesColumn propertiesColumn)
Creates and add a new properties column to this table. All needed informations are set in PropertiesColumn enum instance. *

Parameters:
propertiesColumn - the properties column
Returns:
the newly created column

removeColumn

void removeColumn(AttributeColumn column)
If exists, remove the column and all rows values.

Parameters:
column - the column that is to be removed

replaceColumn

AttributeColumn replaceColumn(AttributeColumn source,
                              java.lang.String id,
                              java.lang.String title,
                              AttributeType type,
                              AttributeOrigin origin,
                              java.lang.Object defaultValue)
If exists, replace source by the new column created from params.

Parameters:
source - the column that is to be removed
id - the identifier of the column
title - the title of the column
type - the type of the column
defaultValue - the default value of the column
Returns:
the newly created column, or null if source can't be found

getColumn

AttributeColumn getColumn(int index)
Gets the column at the index of null if the index is not valid.

Parameters:
index - a valid column index range
Returns:
the column, or null if not found

getColumn

AttributeColumn getColumn(java.lang.String id)
Gets the column with the given identifier or null if it is not found.

Parameters:
id - the column id or title
Returns:
the column, or null if not found

getColumn

AttributeColumn getColumn(java.lang.String title,
                          AttributeType type)
Gets the column which match the given parameters or null if it is not found.

Parameters:
title - the column id or title
type - the column type
Returns:
the column, or null if not found

hasColumn

boolean hasColumn(java.lang.String title)
Return true if this table has a column with the given title or id.

Parameters:
title - the column title that is to be searched
Returns:
true if found, or false otherwise

mergeTable

void mergeTable(AttributeTable table)
Merge this table with the given table given. New columns from table are added to this table.

Columns are compared according to their id and type. Columns found in model are appended only if they no column exist with the same id and type.

Parameters:
table - the table that is to be merged with this table

Gephi Toolkit Javadoc