public interface CyTable extends CyIdentifiable
org.cytoscape.model
documentModule: model-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>model-api</artifactId> </dependency>
Modifier and Type | Interface and Description |
---|---|
static class |
CyTable.Mutability
Mutability of the table specifies whether or not it is able to be deleted..
|
SUID
Modifier and Type | Method and Description |
---|---|
String |
addVirtualColumn(String virtualColumn,
String sourceColumn,
CyTable sourceTable,
String targetJoinKey,
boolean isImmutable)
Adds a "virtual" column to the the current table.
|
void |
addVirtualColumns(CyTable sourceTable,
String targetJoinKey,
boolean isImmutable)
Adds all columns in another table as "virtual" columns to the the current table.
|
int |
countMatchingRows(String columnName,
Object value)
Returns the number of rows with the in the specified column with the specified value.
|
<T> void |
createColumn(String columnName,
Class<? extends T> type,
boolean isImmutable)
Create a column of the specified name and the specified type.
|
<T> void |
createColumn(String columnName,
Class<? extends T> type,
boolean isImmutable,
T defaultValue)
Create a column of the specified name and the specified type.
|
<T> void |
createListColumn(String columnName,
Class<T> listElementType,
boolean isImmutable)
Create a column of Lists with the specified name and the specified element type.
|
<T> void |
createListColumn(String columnName,
Class<T> listElementType,
boolean isImmutable,
List<T> defaultValue)
Create a column of Lists with the specified name and the specified element type.
|
void |
deleteColumn(String columnName)
Will delete the column of the specified name.
|
boolean |
deleteRows(Collection<?> primaryKeys)
Deletes the rows corresponding to the given primary keys and returns true if
at least one row was deleted.
|
List<CyRow> |
getAllRows()
Return a list of all the rows stored in this data table.
|
CyColumn |
getColumn(String columnName)
Returns the column for the specified name.
|
Collection<CyColumn> |
getColumns()
Returns the column types for all columns in this table.
|
String |
getLastInternalError()
Returns a descriptive message for certain internal errors.
|
Collection<CyRow> |
getMatchingRows(String columnName,
Object value)
Returns all the rows of a specified column that contain a certain value for that column.
|
CyTable.Mutability |
getMutability()
The table can be deleted if this returns Mutability.MUTABLE, otherwise it cannot be
deleted!
|
CyColumn |
getPrimaryKey()
Returns the column type of the primary key for this table.
|
CyRow |
getRow(Object primaryKey)
Returns the row specified by the primary key object and if a row
for the specified key does not yet exist in the table, a new row
will be created and the new row will be returned.
|
int |
getRowCount()
Returns the number of rows in this table.
|
SavePolicy |
getSavePolicy()
Returns how (or if) this CyTable should be saved.
|
String |
getTitle()
Returns a human readable name for the CyTable.
|
boolean |
isPublic()
A public CyTable is a table that is accessible to the user through the user
interface.
|
boolean |
rowExists(Object primaryKey)
Returns true if a row exists for the specified primary key and false otherwise.
|
void |
setPublic(boolean isPublic)
Sets the privacy flag for the CyTable.
|
void |
setSavePolicy(SavePolicy policy)
Sets how (or if) this CyTable should be saved.
|
void |
setTitle(String title)
Allows the title of the table to be set.
|
void |
swap(CyTable otherTable)
Swaps the contents and properties (such as mutability) of "otherTable" with this table.
|
getSUID
boolean isPublic()
void setPublic(boolean isPublic)
isPublic
- if true, the table will be public and if false, the table will be private.CyTable.Mutability getMutability()
String getTitle()
void setTitle(String title)
title
- The human readable title for the CyTable suitable for use in a user
interface.CyColumn getPrimaryKey()
CyColumn getColumn(String columnName)
columnName
- The name of the column.Collection<CyColumn> getColumns()
CyColumn
objects that describe all columns in this table.void deleteColumn(String columnName)
ColumnDeletedEvent
will be fired.columnName
- The name identifying the attribute.<T> void createColumn(String columnName, Class<? extends T> type, boolean isImmutable)
T
- The generic type of the column.columnName
- The name identifying the attribute.type
- The type of the column.isImmutable
- if true, this column can never be deleted<T> void createColumn(String columnName, Class<? extends T> type, boolean isImmutable, T defaultValue)
T
- The generic type of the column.columnName
- The name identifying the attribute.type
- The type of the column.isImmutable
- if true, this column can never be deleteddefaultValue
- The default value for the column. Must be of
the specified type or null.<T> void createListColumn(String columnName, Class<T> listElementType, boolean isImmutable)
T
- The generic type of the elements of the list.columnName
- The name identifying the attribute.listElementType
- The type of the elements of the list.isImmutable
- if true, this column can never be deleted<T> void createListColumn(String columnName, Class<T> listElementType, boolean isImmutable, List<T> defaultValue)
T
- The generic type of the elements of the list.columnName
- The name identifying the attribute.listElementType
- The type of the elements of the list.isImmutable
- if true, this column can never be deleteddefaultValue
- A default list for the column. Must be a List of
the specified element type or null.CyRow getRow(Object primaryKey)
primaryKey
- The primary key index of the row to return.CyRow
identified by the specified key or a new
row identified by the key if one did not already exist.boolean rowExists(Object primaryKey)
primaryKey
- The primary key index of the row.boolean deleteRows(Collection<?> primaryKeys)
primaryKeys
- The primary keys of the rows to delete.List<CyRow> getAllRows()
String getLastInternalError()
Collection<CyRow> getMatchingRows(String columnName, Object value)
columnName
- the column for which we want the rowsvalue
- the value for which we want the rows that contain itint countMatchingRows(String columnName, Object value)
columnName
- the column to checkvalue
- the value we want to check forint getRowCount()
String addVirtualColumn(String virtualColumn, String sourceColumn, CyTable sourceTable, String targetJoinKey, boolean isImmutable)
virtualColumn
- The name of the new virtual column, if this name already exists,
new column names with -1, -2 and so appended to this name on will
be tried until a non-existing name will be found.sourceColumn
- The name of the column in "sourceTable" that will be mapped to
"virtualColumn".sourceTable
- The table that really contains the column that we're adding (all
updates and lookups of this new column will be redirected to here).
The table will be joined on the primary key column of this table.targetJoinKey
- The column in current table that will be used for the join. This
column will be joined with the primary key column of the source
table. These columns must be of the same type!isImmutable
- If true, this column cannot be deleted.void addVirtualColumns(CyTable sourceTable, String targetJoinKey, boolean isImmutable)
sourceTable
- The table that really contains the column that we're adding (all
updates and lookups of this new column will be redirected to here).
The table will be joined on the primary key column of this table.
None of the column names in "sourceTable" must exist in the current table!targetJoinKey
- The column in current table that will be used for the join. This
column will be joined with the primary key column of the source
table. These columns must be of the same type!isImmutable
- If true, these columns cannot be deleted.SavePolicy getSavePolicy()
void setSavePolicy(SavePolicy policy)
policy
- the policy to follow during the life-cycle of the CyTable.void swap(CyTable otherTable)
otherTable
- the table that we're being swapped with.
Note: the one "property" that is not being swapped is the SUID. Also, no events are being
fired to give any listeners a chance to react to the exchange!Copyright 2011-2015 Cytoscape Consortium. All rights reserved.