Cytoscape 2.6.2 (c) 2006,2007 ISB, MSKCC, UCSD

cytoscape.data.attr
Interface MultiHashMapDefinition

All Known Implementing Classes:
ExtensibleMultiHashMapModel

public interface MultiHashMapDefinition

This interface contains the API specification for creating attribute definitions.


Field Summary
static byte TYPE_BOOLEAN
          This type corresponds to java.lang.Boolean.
static byte TYPE_FLOATING_POINT
          This type corresponds to java.lang.Double.
static byte TYPE_INTEGER
          This type corresponds to java.lang.Integer.
static byte TYPE_STRING
          This type corresponds to java.lang.String.
 
Method Summary
 void addDataDefinitionListener(MultiHashMapDefinitionListener listener)
          Registers a listener for receiving events having to do with attribute definitions being created and deleted.
 void defineAttribute(String attributeName, byte valueType, byte[] keyTypes)
          Creates an attribute definition.
 byte[] getAttributeKeyspaceDimensionTypes(String attributeName)
          Returns information about the dimensionality and types in the key space of specified attribute.
 byte getAttributeValueType(String attributeName)
          Returns the type of attribute values that exist in specified attribute space.
 CountedIterator getDefinedAttributes()
          Returns all defined attributeNames.
 void removeDataDefinitionListener(MultiHashMapDefinitionListener listener)
          Unregisters a listener; this method has the opposite effect as addDataDefinitionListener(listener).
 boolean undefineAttribute(String attributeName)
          WARNING: All bound attribute values on objects will go away in this attribute namespace when this method is called.
 

Field Detail

TYPE_BOOLEAN

static final byte TYPE_BOOLEAN
This type corresponds to java.lang.Boolean.

See Also:
Constant Field Values

TYPE_FLOATING_POINT

static final byte TYPE_FLOATING_POINT
This type corresponds to java.lang.Double.

See Also:
Constant Field Values

TYPE_INTEGER

static final byte TYPE_INTEGER
This type corresponds to java.lang.Integer.

See Also:
Constant Field Values

TYPE_STRING

static final byte TYPE_STRING
This type corresponds to java.lang.String.

See Also:
Constant Field Values
Method Detail

defineAttribute

void defineAttribute(String attributeName,
                     byte valueType,
                     byte[] keyTypes)
Creates an attribute definition. An attribute definition must be created before binding an attribute value to an object.

Perhaps the most common type of attribute definition is one where the key space has zero dimensions. For example, if I want to identify each object as having a color, I would create an attribute definition which stores values of TYPE_STRING (for storing "red", "blue", and so on) and has no key sequence mapping color values. By "no key sequence" I mean that the input parameter keyTypes would be either null or the empty array for my color attribute definition.

The more interesting case is where the key space in an attribute definition has one or more dimensions. For example, if I wanted to create an attribute that represents measured p-values for all objects over a set of experiments ("Ideker experiment", "Salk experiment", ...) I would define a one-dimensional key space of TYPE_STRING (to represent the experiment names) and a value of TYPE_FLOATING_POINT (to represent p-values).

NOTE: No constraints on attributeName are documented by this API. In other words, as far as this API is concerned, any attributeName is acceptable, including the empty string (""). The only necessary condition is that each attributeName be unique.

Parameters:
attributeName - an identifier for this attribute definition; this value must be unique from all existing attribute definitions; ideally, the choice of name would describe values being stored by this attribute definition.
valueType - one of the TYPE_* constants defining what type of values are bound to objects in this attribute definition.
keyTypes - defines the type (TYPE_*) of each dimension in the key space; the entry at index i defines the type of key space dimension i + 1; this parameter may either be null or the empty array if an attribute definition does not use a key space (this is perhaps the most common scenario).
Throws:
IllegalStateException - if attributeName is already the name of an existing attribute definition.
NullPointerException - if attributeName is null.
IllegalArgumentException - if valueType is not one of the TYPE_* constants, or if keyTypes is [not null and] of positive length and any one of its elements is not one of the TYPE_* constants.

getDefinedAttributes

CountedIterator getDefinedAttributes()
Returns all defined attributeNames.

NOTE: The returned iterator does not support the remove() operation.

NOTE: To find out whether or not an attributeName is defined, use getAttributeValueType(attributeName) and test whether or not the return value is negative.

IMPORTANT: The returned iterator becomes invalid as soon as any attributeName is defined or undefined in this MultiHashMapDefinition. Calling methods on an invalid iterator will result in undefined behavior of that iterator.

Returns:
an iterator of java.lang.String; each returned string is an attributeName (an attribute definition name).

getAttributeValueType

byte getAttributeValueType(String attributeName)
Returns the type of attribute values that exist in specified attribute space.

Returns:
the type (TYPE_*) of values bound to objects by this attribute definition, or -1 if specified attribute definition does not exist; note that all of the TYPE_* constants are positive.
Throws:
NullPointerException - if attributeName is null.

getAttributeKeyspaceDimensionTypes

byte[] getAttributeKeyspaceDimensionTypes(String attributeName)
Returns information about the dimensionality and types in the key space of specified attribute.

Parameters:
attributeName - the attribute definition whose key space we are querying.
Returns:
a carbon copy of the array that was used to initially define attributeName (see defineAttribute()); implementations are required to instantiate and return a new array on each call to this method; if attributeName has no key space defined, the empty array is returned; null is never returned.
Throws:
IllegalStateException - if attributeName is not an existing attribute definition.
NullPointerException - if attributeName is null.

undefineAttribute

boolean undefineAttribute(String attributeName)
WARNING: All bound attribute values on objects will go away in this attribute namespace when this method is called.

Parameters:
attributeName - the attribute definition to undefine.
Returns:
true if and only if attributeName was defined prior to this method invocation.
Throws:
NullPointerException - if attributeName is null.

addDataDefinitionListener

void addDataDefinitionListener(MultiHashMapDefinitionListener listener)
Registers a listener for receiving events having to do with attribute definitions being created and deleted.

Parameters:
listener - the listener to register.

removeDataDefinitionListener

void removeDataDefinitionListener(MultiHashMapDefinitionListener listener)
Unregisters a listener; this method has the opposite effect as addDataDefinitionListener(listener).

Parameters:
listener - the listener to unregister.

www.cytoscape.org