Cytoscape 2.2 (c) 2004 ISB, MSKCC, UCSD

cytoscape.data.attr.util
Class ExtensibleMultiHashMapModel

java.lang.Object
  extended bycytoscape.data.attr.util.MultiHashMapModel
      extended bycytoscape.data.attr.util.ExtensibleMultiHashMapModel
All Implemented Interfaces:
MultiHashMap, MultiHashMapDefinition

Deprecated. Use MultiHashMapFactory instead.

public class ExtensibleMultiHashMapModel
extends cytoscape.data.attr.util.MultiHashMapModel

Please try to restrain from using this class. This class was created so that certain legacy applications would have an easier time integrating with the functionality provided by the MultiHashMap and MultiHashMapDefinition implementations.

See Also:
MultiHashMapFactory

Field Summary
 
Fields inherited from interface cytoscape.data.attr.MultiHashMapDefinition
TYPE_BOOLEAN, TYPE_FLOATING_POINT, TYPE_INTEGER, TYPE_STRING
 
Constructor Summary
ExtensibleMultiHashMapModel()
          Deprecated.  
 
Method Summary
 void addDataDefinitionListener(MultiHashMapDefinitionListener listener)
          Registers a listener for receiving events having to do with attribute definitions being created and deleted.
 void addDataListener(MultiHashMapListener listener)
          Registers a listener for receiving events having to do with attribute values being assigned and removed.
 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.
 CountedIterator getAttributeKeyspan(String objectKey, String attributeName, Object[] keyPrefix)
          For all key sequences, having specified prefix, that map into bound values on objectKey in attributeName, returns the [unique] representatives from dimension keyPrefix.length + 1.
 Object getAttributeValue(String objectKey, String attributeName, Object[] keyIntoValue)
          Retrieves a bound attribute value from an object.
 byte getAttributeValueType(String attributeName)
          Returns the type of attribute values that exist in specified attribute space.
 CountedIterator getDefinedAttributes()
          Returns all defined attributeNames.
 CountedIterator getObjectKeys(String attributeName)
          Returns all objectKeys that have at least one attribute value assigned in attributeName.
 boolean removeAllAttributeValues(String objectKey, String attributeName)
          Removes all values bound to objectKey in attributeName.
 Object removeAttributeValue(String objectKey, String attributeName, Object[] keyIntoValue)
          This method is the same as getAttributeValue(), only the retrieved attribute value is also deleted.
 void removeDataDefinitionListener(MultiHashMapDefinitionListener listener)
          Unregisters a listener; this method has the opposite effect as addDataDefinitionListener(listener).
 void removeDataListener(MultiHashMapListener listener)
          Unregisters a listener; this method has the opposite effect as addDataListener(listener).
 Object setAttributeValue(String objectKey, String attributeName, Object attributeValue, Object[] keyIntoValue)
          Binds an attribute value to an object.
 boolean undefineAttribute(String attributeName)
          WARNING: All bound attribute values on objects will go away in this attribute namespace when this method is called.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtensibleMultiHashMapModel

public ExtensibleMultiHashMapModel()
Deprecated. 
Method Detail

defineAttribute

public final void defineAttribute(String attributeName,
                                  byte valueType,
                                  byte[] keyTypes)
Description copied from interface: MultiHashMapDefinition
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.

Specified by:
defineAttribute in interface MultiHashMapDefinition
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).

getDefinedAttributes

public final CountedIterator getDefinedAttributes()
Description copied from interface: MultiHashMapDefinition
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.

Specified by:
getDefinedAttributes in interface MultiHashMapDefinition
Returns:
an iterator of java.lang.String; each returned string is an attributeName (an attribute definition name).

getAttributeValueType

public final byte getAttributeValueType(String attributeName)
Description copied from interface: MultiHashMapDefinition
Returns the type of attribute values that exist in specified attribute space.

Specified by:
getAttributeValueType in interface MultiHashMapDefinition
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.

getAttributeKeyspaceDimensionTypes

public final byte[] getAttributeKeyspaceDimensionTypes(String attributeName)
Description copied from interface: MultiHashMapDefinition
Returns information about the dimensionality and types in the key space of specified attribute.

Specified by:
getAttributeKeyspaceDimensionTypes in interface MultiHashMapDefinition
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.

undefineAttribute

public final boolean undefineAttribute(String attributeName)
Description copied from interface: MultiHashMapDefinition
WARNING: All bound attribute values on objects will go away in this attribute namespace when this method is called.

Specified by:
undefineAttribute in interface MultiHashMapDefinition
Parameters:
attributeName - the attribute definition to undefine.
Returns:
true if and only if attributeName was defined prior to this method invocation.

addDataDefinitionListener

public final void addDataDefinitionListener(MultiHashMapDefinitionListener listener)
Description copied from interface: MultiHashMapDefinition
Registers a listener for receiving events having to do with attribute definitions being created and deleted.

Specified by:
addDataDefinitionListener in interface MultiHashMapDefinition
Parameters:
listener - the listener to register.

removeDataDefinitionListener

public final void removeDataDefinitionListener(MultiHashMapDefinitionListener listener)
Description copied from interface: MultiHashMapDefinition
Unregisters a listener; this method has the opposite effect as addDataDefinitionListener(listener).

Specified by:
removeDataDefinitionListener in interface MultiHashMapDefinition
Parameters:
listener - the listener to unregister.

setAttributeValue

public final Object setAttributeValue(String objectKey,
                                      String attributeName,
                                      Object attributeValue,
                                      Object[] keyIntoValue)
Description copied from interface: MultiHashMap
Binds an attribute value to an object.

Specified by:
setAttributeValue in interface MultiHashMap
Parameters:
objectKey - the object to which to bind a new attribute value.
attributeName - the attribute definition in which to assign an attribute value.
attributeValue - the attribute value to bind; the type of this object must be of the appropriate type based on the value type of specified attribute definition.
keyIntoValue - an array of length equal to the dimensionality of the key space of specified attribute definition; entry at index i is a "representative" from dimension i + 1 of the key space; if specified attribute definition has a zero-dimensional key space (this is perhaps the most common scenario) then this array may either be null or the empty array.
Returns:
previous attribute value bound at specified key sequence, or null if no attribute value was previously bound.

getAttributeValue

public final Object getAttributeValue(String objectKey,
                                      String attributeName,
                                      Object[] keyIntoValue)
Description copied from interface: MultiHashMap
Retrieves a bound attribute value from an object.

Specified by:
getAttributeValue in interface MultiHashMap
Parameters:
objectKey - the object from which to retrieve a bound attribute value.
attributeName - the attribute definition in which assigned attribute value exists.
keyIntoValue - an array of length equal to the dimensionality of the key space of specified attribute definition; entry at index i is a "representative" from dimension i + 1 of the key space; if specified attribute definition has a zero-dimensional key space (this is perhaps the most commen scenario) then this array may either be null or the empty array.
Returns:
the same value that was set with setAttributeValue() with parameters specified or null if no such value is bound.

removeAttributeValue

public final Object removeAttributeValue(String objectKey,
                                         String attributeName,
                                         Object[] keyIntoValue)
Description copied from interface: MultiHashMap
This method is the same as getAttributeValue(), only the retrieved attribute value is also deleted.

Specified by:
removeAttributeValue in interface MultiHashMap
See Also:
MultiHashMap.getAttributeValue(String, String, Object[])

removeAllAttributeValues

public final boolean removeAllAttributeValues(String objectKey,
                                              String attributeName)
Description copied from interface: MultiHashMap
Removes all values bound to objectKey in attributeName. Most attribute definitions will have no key space, and such attribute definitions will bind at most one attribute value to any give objectKey; this method is useful with attribute definitions that have nonzero key spaces.

Specified by:
removeAllAttributeValues in interface MultiHashMap
Parameters:
objectKey - the object from which to delete all bound attribute values.
attributeName - the attribute definition in which to delete attribute values.
Returns:
true if and only if objectKey had at least one attribute value bound in attributeName prior to this method invocation.

getAttributeKeyspan

public final CountedIterator getAttributeKeyspan(String objectKey,
                                                 String attributeName,
                                                 Object[] keyPrefix)
Description copied from interface: MultiHashMap
For all key sequences, having specified prefix, that map into bound values on objectKey in attributeName, returns the [unique] representatives from dimension keyPrefix.length + 1. This method only makes sense for attributeNames that have nonzero key space dimensionality.

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

IMPORTANT: The returned iterator becomes invalid as soon as any attribute value is set or removed for some objectKey in attributeName. Calling methods on an invalid iterator will result in undefined behavior of that iterator.

Specified by:
getAttributeKeyspan in interface MultiHashMap
Parameters:
objectKey - the object to query.
attributeName - the attribute definition to query.
keyPrefix - an array of length K, where K is strictly less than the dimensionality of key space of attributeName; entry at index i contains a "representative" from dimension i + 1 of the key space of attributeName; keyPrefix may be either null or the empty array, in which case the iterator returned consists of the representatives in the first dimension of key space.
Returns:
an iterator of key representatives in key space dimension K + 1 along specified keyPrefix; the iterator returned is never null; the order of the returned keys is arbitrary.

getObjectKeys

public final CountedIterator getObjectKeys(String attributeName)
Description copied from interface: MultiHashMap
Returns all objectKeys that have at least one attribute value assigned in attributeName.

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

NOTE: To quickly determine whether or not a given objectKey has at least one attribute value bound to it under attributeName, test for a null return value in getAttributeValue(objectKey, attributeName, null) if attributeName has zero key space dimensionality, or test for an empty iterator return value in getAttributeKeyspan(objectKey, attributeName, null) if attributeName has nonzero key space dimensionality.

IMPORTANT: The returned iterator becomes invalid as soon as any attribute value is set or removed for some objectKey in attributeName. Calling methods on an invalid iterator will result in undefined behavior of that iterator.

Specified by:
getObjectKeys in interface MultiHashMap
Parameters:
attributeName - the attribute definition to query.
Returns:
an iterator of objectKey strings (java.lang.String) that currently have value[s] assigned to them in the specified attribute definition; the order of the returned strings is arbitrary; null is never returned.
See Also:
MultiHashMapDefinition.getAttributeValueType(String)

addDataListener

public final void addDataListener(MultiHashMapListener listener)
Description copied from interface: MultiHashMap
Registers a listener for receiving events having to do with attribute values being assigned and removed.

Specified by:
addDataListener in interface MultiHashMap
Parameters:
listener - the listener to register.

removeDataListener

public final void removeDataListener(MultiHashMapListener listener)
Description copied from interface: MultiHashMap
Unregisters a listener; this method has the opposite effect as addDataListener(listener).

Specified by:
removeDataListener in interface MultiHashMap
Parameters:
listener - the listener to unregister.

www.cytoscape.org