Author: mes
Date: 2008-09-13 13:46:20 -0700 (Sat, 13 Sep 2008)
New Revision: 14907
Modified:
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyDataTable.java
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyDataTableFactory.java
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyFunction.java
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyRow.java
Log:
added javadoc describing the new CyAttribute/CyDataTable model
Modified:
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyDataTable.java
===================================================================
---
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyDataTable.java
2008-09-13 15:42:34 UTC (rev 14906)
+++
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyDataTable.java
2008-09-13 20:46:20 UTC (rev 14907)
@@ -4,38 +4,89 @@
import java.util.List;
/**
- *
+ *
*/
public interface CyDataTable {
+ /**
+ * A public CyDataTable is a table that is accessible to the user
+ * through the user interface. Private or non-public CyDataTables will
+ * not be visible to the user from the normal user interface, although
+ * they will be accessible to plugin writers through the API.
+ * @return Whether or not this CyDataTable should be publicly
accessible.
+ */
public boolean isPublic();
- public String getName();
+ /**
+ * @return The session unique identifier.
+ */
+ public long getSUID();
/**
+ * @return A human readable name for the CyDataTable.
*/
+ public String getTitle();
+
+ /**
+ * @param title The human readable title for the CyDataTable
+ * suitable for use in a user interface.
+ */
+ public void setTitle(String title);
+
+ /**
+ * The keySet of this map defines all columns in the CyDataTable and the
+ * the values of this map define the types of the columns.
+ * @return A map of column names to the [EMAIL PROTECTED] Class}
objects that defines
+ * the column type.
+ */
public Map<String,Class<?>> getColumnTypeMap();
/**
- * @param attributeName The name identifying the attribute.
+ * @param columnName The name identifying the attribute.
*/
- public void deleteColumn(String attributeName);
+ public void deleteColumn(String columnName);
/**
- * @param attributeName The name identifying the column.
+ * @param columnName The name identifying the column.
* @param type The type associated with the column.
* @param unique Whether the entries in the column are unique.
*/
- public <T> void createColumn(String attributeName, Class<? extends T>
type, boolean unique);
+ public <T> void createColumn(String columnName, Class<? extends T>
type, boolean unique);
+ /**
+ * Unique columns can be used to map the values from one CyDataTable to
another.
+ * @return A list of column names where the values within the column are
+ * guaranteed to be unique.
+ */
public List<String> getUniqueColumns();
+ /**
+ * @param columnName The name identifying the column to return.
+ * @param type The type of the column to return.
+ * @return The list of values of type T that exist in the column
specified by
+ * the columnName.
+ */
public <T> List<? extends T> getColumnValues(String columnName, Class<?
extends T> type);
- public CyRow getRow(long index);
+ /**
+ * @param primaryKey The primary key index of the row to return.
+ * @return The [EMAIL PROTECTED] CyRow} identified by the specified
index.
+ */
+ public CyRow getRow(long primaryKey);
+ /**
+ * @return A new [EMAIL PROTECTED] CyRow} object for this CyDataTable.
+ */
public CyRow addRow();
+ /**
+ * By default all [EMAIL PROTECTED] CyRow}s created have a primary key
column of
+ * type [EMAIL PROTECTED] Integer} that gets created at initialization
which is
+ * identified by this string.
+ * If the CyDataTable is created and immediately bound to a [EMAIL
PROTECTED] CyNetwork}
+ * then the primary key attribute is populated with the SUID of the
+ * [EMAIL PROTECTED] GraphObject}.
+ */
public static final String PRIMARY_KEY = "AID";
}
Modified:
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyDataTableFactory.java
===================================================================
---
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyDataTableFactory.java
2008-09-13 15:42:34 UTC (rev 14906)
+++
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyDataTableFactory.java
2008-09-13 20:46:20 UTC (rev 14907)
@@ -2,8 +2,35 @@
import java.util.List;
+/**
+ * An interface describing a factory used for creating
+ * [EMAIL PROTECTED] CyDataTable} objects. This factory will be
+ * provided as a service through Spring/OSGi.
+ */
public interface CyDataTableFactory {
+ /**
+ * @param name The name of the CyDataTable.
+ * @param pub Whether or not the CyDataTable should be public.
+ * @return A new [EMAIL PROTECTED] CyDataTable} with the specified name
+ * that is either public or not (see [EMAIL PROTECTED]
CyDataTable#isPublic}.
+ */
CyDataTable createTable(String name, boolean pub);
- List<String> getAllTableNames(boolean includePrivate);
+
+ /**
+ * @param includePrivate Whether to include private CyDataTables
+ * in the list (i.e. all possible CyDataTables) or not.
+ * @return A list containing CyDataTable SUIDs either
+ * including private CyDataTables (i.e. meaning all possible
+ * CyDataTables) or just public CyDataTables.
+ */
+ List<Long> getAllTableSUIDs(boolean includePrivate);
+
+ /**
+ * @param suid The SUID identifying the CyDataTable.
+ * @return The CyDataTable identified by the suid. Will
+ * return null if a CyDataTable doesn't exist for the
+ * specified SUID.
+ */
+ CyDataTable getTable(long suid);
}
Modified:
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyFunction.java
===================================================================
---
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyFunction.java
2008-09-13 15:42:34 UTC (rev 14906)
+++
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyFunction.java
2008-09-13 20:46:20 UTC (rev 14907)
@@ -1,8 +1,32 @@
package org.cytoscape.model.attrs;
+/**
+ * A [EMAIL PROTECTED] CyRow} in a [EMAIL PROTECTED] CyDataTable} may contain
either
+ * values of the base types (see [EMAIL PROTECTED] CyDataTable}) or a
+ * CyFunction. CyFunctions are evaluated when the value for the
+ * row is accessed and return the newly created value. These
+ * can be used as references to rows in other columns or CyDataTables.
+ */
public interface CyFunction<T> {
+
+ /**
+ * @return The type of the value returned by the function.
+ */
Class<T> getBaseType();
+
+ /**
+ * This method will evaluate the function when it is called.
+ * @return The value returned by this function.
+ */
T getValue();
+
+ /**
+ * @return The string that defines the function.
+ */
String getFunction();
- void setFunction(String s);
+
+ /**
+ * @param functionDesc A string describing the function.
+ */
+ void setFunction(String functionDesc);
}
Modified:
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyRow.java
===================================================================
---
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyRow.java
2008-09-13 15:42:34 UTC (rev 14906)
+++
csplugins/trunk/ucsd/mes/api/src/main/java/org/cytoscape/model/attrs/CyRow.java
2008-09-13 20:46:20 UTC (rev 14907)
@@ -2,11 +2,49 @@
import java.util.Map;
+/**
+ * This interface represents one row in a CyDataTable.
+ */
public interface CyRow {
+ /**
+ * @param columnName The name of the column to return.
+ * @param type The type of the column to return. The type
+ * <b>must</b> be type the column is defined for otherwise
+ * an IllegalArgument exception will be thrown.
+ * @return The a value of type T that is identified by the
+ * specified columnName and type.
+ */
public <T> T get(String columnName, Class<? extends T> type);
+
+ /**
+ * @param columnName The string identifying the column whose value
+ * should be set.
+ * @param value The value to set the column to.
+ */
public <T> void set(String columnName, T value);
+
+ /**
+ * @param columnName The name of the column to check.
+ * @return The Class<?> object that is defined for this column. Will
+ * return null if the column has not been defined. Will always return
+ * a base type. If the value is actually a [EMAIL PROTECTED]
CyFunction} the
+ * function will be evaluated and the function must evaluate to the
+ * type of the column.
+ */
public Class<?> contains(String columnName);
+
+ /**
+ * @param columnName The name of the column to check.
+ * @param type The type of the column to check. The type can be
+ * one of the base types OR [EMAIL PROTECTED] CyFunction} so that we
+ * can determine whether a column is a function or raw data.
+ */
public <T> boolean contains(String columnName,Class<? extends T> type);
+
+ /**
+ * @return A map of column names to Objects that contain the values
+ * contained in this Row.
+ */
public Map<String,Object> getAllValues();
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en
-~----------~----~----~----~------~----~------~--~---