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

cytoscape.data
Class CyAttributesImpl

java.lang.Object
  extended by cytoscape.data.CyAttributesImpl
All Implemented Interfaces:
CyAttributes

public class CyAttributesImpl
extends Object
implements CyAttributes


Field Summary
 
Fields inherited from interface cytoscape.data.CyAttributes
TYPE_BOOLEAN, TYPE_COMPLEX, TYPE_FLOATING, TYPE_INTEGER, TYPE_SIMPLE_LIST, TYPE_SIMPLE_MAP, TYPE_STRING, TYPE_UNDEFINED
 
Constructor Summary
CyAttributesImpl()
           
 
Method Summary
 boolean deleteAttribute(String attributeName)
          Deletes the specified attribute.
 boolean deleteAttribute(String id, String attributeName)
          Deletes the id/attributeName pair.
 String getAttributeDescription(String attributeName)
          Gets the human readable description of a specific attribute.
 List getAttributeList(String id, String attributeName)
           
 Map getAttributeMap(String id, String attributeName)
           
 String[] getAttributeNames()
          Gets an array of all attribute names.
 Boolean getBooleanAttribute(String id, String attributeName)
          Gets a Boolean value at the specified id/attributeName.
 Double getDoubleAttribute(String id, String attributeName)
          Gets a Double value at the specified id/attributeName.
 Integer getIntegerAttribute(String id, String attributeName)
          Gets an Integer value at the specified id/attributeName.
 List getListAttribute(String id, String attributeName)
          Gets a 'simple' list of attributes for the id/attributeName pair.
 Map getMapAttribute(String id, String attributeName)
          Gets a 'simple' map of attribute values.
 MultiHashMap getMultiHashMap()
          Gets the MultiHashMap Object, where we store attribute values.
 MultiHashMapDefinition getMultiHashMapDefinition()
          Gets the MultiHashMapDefinition Object, where we store attribute definitions.
 String getStringAttribute(String id, String attributeName)
          Gets a String value at the specified id/attributeName.
 byte getType(String attributeName)
          Gets the data type of the specified attribute.
 boolean getUserEditable(String attributeName)
          Returns the boolean indicating whether this attribute should be editable by the end user or not.
 boolean getUserVisible(String attributeName)
          Returns the boolean indicating whether the specified attribute should be made visible to the end user or not.
 boolean hasAttribute(String id, String attributeName)
          Determines if the specified id/attributeName pair exists.
 void setAttribute(String id, String attributeName, Boolean value)
          Sets an id/attributeName pair of type Boolean.
 void setAttribute(String id, String attributeName, Double value)
          Sets an id/attributeName pair of type Double.
 void setAttribute(String id, String attributeName, Integer value)
          Sets an id/attributeName pair of type Integer.
 void setAttribute(String id, String attributeName, String value)
          Sets an id/attributeName pair of type String.
 void setAttributeDescription(String attributeName, String description)
          Sets a human readable description of a specific attribute.
 void setAttributeList(String id, String attributeName, List list)
           
 void setAttributeMap(String id, String attributeName, Map map)
           
 void setListAttribute(String id, String attributeName, List list)
          Sets a simple list of attributes.
 void setMapAttribute(String id, String attributeName, Map map)
          Sets a 'simple' map of attribute values.
 void setUserEditable(String attributeName, boolean value)
          Sets the specified boolean to indicate whether or not the specified attribute should be editable by the end user.
 void setUserVisible(String attributeName, boolean value)
          Sets the specified boolean to indicate whether or not the specified attribute should be made visible to the end user.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CyAttributesImpl

public CyAttributesImpl()
Method Detail

setAttributeDescription

public void setAttributeDescription(String attributeName,
                                    String description)
Description copied from interface: CyAttributes
Sets a human readable description of a specific attribute.

Specified by:
setAttributeDescription in interface CyAttributes
Parameters:
attributeName - attribute name.
description - human readable description of attribute. used for display to end-user.

getAttributeDescription

public String getAttributeDescription(String attributeName)
Description copied from interface: CyAttributes
Gets the human readable description of a specific attribute.

Specified by:
getAttributeDescription in interface CyAttributes
Parameters:
attributeName - attribute name.
Returns:
human readable description of attribute or null (if no description has been specified).

setUserVisible

public void setUserVisible(String attributeName,
                           boolean value)
Description copied from interface: CyAttributes
Sets the specified boolean to indicate whether or not the specified attribute should be made visible to the end user.

By default, all attributes are visible.

Note: CyAttributes does not actually enforce user visibility. Rather, relevant user interface (UI) element(s) must query CyAttributes, and enforce the visibility flag themselves.

Specified by:
setUserVisible in interface CyAttributes
Parameters:
attributeName - Attribute name.
value - the boolean to be set. true indicates that the attribute should be made visible to the end user. false indicates that the attribute should not be made visible to the end user.

getUserVisible

public boolean getUserVisible(String attributeName)
Description copied from interface: CyAttributes
Returns the boolean indicating whether the specified attribute should be made visible to the end user or not.

By default, all attributes are visible.

Note: CyAttributes does not actually enforce user visibility. Rather, relevant user interface (UI) element(s) must query CyAttributes, and enforce the visibility flag themselves.

Specified by:
getUserVisible in interface CyAttributes
Parameters:
attributeName - Attribute name.
Returns:
true indicates that the attribute should be made visible to the end user. false indicates that the attribute should not be made visible to the end user.

setUserEditable

public void setUserEditable(String attributeName,
                            boolean value)
Description copied from interface: CyAttributes
Sets the specified boolean to indicate whether or not the specified attribute should be editable by the end user.

By default, all attributes are editable.

Note: CyAttributes does not actually enforce restrictions on user editing of attributes. Rather, relevant user interface (UI) element(s) must query CyAttributes, and enforce the editing requirements themselves.

Specified by:
setUserEditable in interface CyAttributes
Parameters:
attributeName - Attribute name.
value - the boolean to be set. true indicates that the attribute should be editable by the end user. false indicates that the attribute should not be editable by the end user.

getUserEditable

public boolean getUserEditable(String attributeName)
Description copied from interface: CyAttributes
Returns the boolean indicating whether this attribute should be editable by the end user or not.

By default, all attributes are editable.

Note: CyAttributes does not actually enforce restrictions on user editing of attributes. Rather, relevant user interface (UI) element(s) must query CyAttributes, and enforce the editing requirements themselves.

Specified by:
getUserEditable in interface CyAttributes
Parameters:
attributeName - Attribute name.
Returns:
true indicates that the attribute should be editable by the end user. false indicates that the attribute should not be editable by the end user.

getAttributeNames

public String[] getAttributeNames()
Description copied from interface: CyAttributes
Gets an array of all attribute names.

Specified by:
getAttributeNames in interface CyAttributes
Returns:
an array of String Objects.

hasAttribute

public boolean hasAttribute(String id,
                            String attributeName)
Description copied from interface: CyAttributes
Determines if the specified id/attributeName pair exists.

Specified by:
hasAttribute in interface CyAttributes
Parameters:
id - unique identifier.
attributeName - attribute name.
Returns:
true or false.

setAttribute

public void setAttribute(String id,
                         String attributeName,
                         Boolean value)
Description copied from interface: CyAttributes
Sets an id/attributeName pair of type Boolean.

Specified by:
setAttribute in interface CyAttributes
Parameters:
id - unique identifier.
attributeName - attribute name.
value - boolean value.

setAttribute

public void setAttribute(String id,
                         String attributeName,
                         Integer value)
Description copied from interface: CyAttributes
Sets an id/attributeName pair of type Integer.

Specified by:
setAttribute in interface CyAttributes
Parameters:
id - unique identifier.
attributeName - attribute name.
value - integer value.

setAttribute

public void setAttribute(String id,
                         String attributeName,
                         Double value)
Description copied from interface: CyAttributes
Sets an id/attributeName pair of type Double.

Specified by:
setAttribute in interface CyAttributes
Parameters:
id - unique identifier.
attributeName - attribute name.
value - double value.

setAttribute

public void setAttribute(String id,
                         String attributeName,
                         String value)
Description copied from interface: CyAttributes
Sets an id/attributeName pair of type String.

Specified by:
setAttribute in interface CyAttributes
Parameters:
id - unique identifier.
attributeName - attribute name.
value - string value.

getBooleanAttribute

public Boolean getBooleanAttribute(String id,
                                   String attributeName)
Description copied from interface: CyAttributes
Gets a Boolean value at the specified id/attributeName.

Specified by:
getBooleanAttribute in interface CyAttributes
Parameters:
id - unique identifier.
attributeName - attribute name.
Returns:
Boolean object, or null if no id/attributeName pair is found.

getIntegerAttribute

public Integer getIntegerAttribute(String id,
                                   String attributeName)
Description copied from interface: CyAttributes
Gets an Integer value at the specified id/attributeName.

Specified by:
getIntegerAttribute in interface CyAttributes
Parameters:
id - unique identifier.
attributeName - attribute name.
Returns:
Integer object, or null if no id/attributeName pair is found.

getDoubleAttribute

public Double getDoubleAttribute(String id,
                                 String attributeName)
Description copied from interface: CyAttributes
Gets a Double value at the specified id/attributeName.

Specified by:
getDoubleAttribute in interface CyAttributes
Parameters:
id - unique identifier.
attributeName - attribute name.
Returns:
Double object, or null if no id/attributeName pair is found..

getStringAttribute

public String getStringAttribute(String id,
                                 String attributeName)
Description copied from interface: CyAttributes
Gets a String value at the specified id/attributeName.

Specified by:
getStringAttribute in interface CyAttributes
Parameters:
id - unique identifier.
attributeName - attribute name.
Returns:
String object, or null if no id/attributeName pair is found.

getType

public byte getType(String attributeName)
Description copied from interface: CyAttributes
Gets the data type of the specified attribute.

Specified by:
getType in interface CyAttributes
Parameters:
attributeName - Attribute Name.
Returns:
one of: TYPE_BOOLEAN, TYPE_INTEGER, TYPE_FLOATING, TYPE_STRING, TYPE_SIMPLE_LIST, TYPE_SIMPLE_MAP, TYPE_COMPLEX, TYPE_UNDEFINED.

deleteAttribute

public boolean deleteAttribute(String id,
                               String attributeName)
Description copied from interface: CyAttributes
Deletes the id/attributeName pair.

Specified by:
deleteAttribute in interface CyAttributes
Parameters:
id - unique identifier.
attributeName - attribute name.
Returns:
true indicates attribute was successfully removed.

deleteAttribute

public boolean deleteAttribute(String attributeName)
Description copied from interface: CyAttributes
Deletes the specified attribute.

Calling this method deletes all id/attributeName pairs with this attributeName, and resets the specified attribute data type to: TYPE_UNDEFINED. Please use with caution!

Specified by:
deleteAttribute in interface CyAttributes
Parameters:
attributeName - attribute name.
Returns:
true indicates attribute was successfully reset.

setAttributeList

public void setAttributeList(String id,
                             String attributeName,
                             List list)
Specified by:
setAttributeList in interface CyAttributes

setListAttribute

public void setListAttribute(String id,
                             String attributeName,
                             List list)
Description copied from interface: CyAttributes
Sets a simple list of attributes.

A simple list is defined as follows:

If the above requirements are not met, an IllegalArgumentException will be thrown.

Implementation note: calling this method results in many calls to the MultiHashMap back-end data store. For example, if you have five elements in a List, the implementation code makes five calls to the MultiHashMap. Therefore, if you are listening to MultiHashMap events, you will be notified of five separate events, rather than one global list event.

Specified by:
setListAttribute in interface CyAttributes
Parameters:
id - unique identifier.
list - attribute name.

getAttributeList

public List getAttributeList(String id,
                             String attributeName)
Specified by:
getAttributeList in interface CyAttributes

getListAttribute

public List getListAttribute(String id,
                             String attributeName)
Description copied from interface: CyAttributes
Gets a 'simple' list of attributes for the id/attributeName pair.

A 'simple' list is defined as follows:

Note: The returned List is useful for read operations only. If you add, edit, or delete elements within this list, these changes will not be stored, unless you explicitly call setListAttribute() again. For example:

 List list = nodeAttributes.getListAttribute(id, attributeName);

 //  Add new item
 list.add(new String("Hello, World");

 //  Save modified list back
 nodeAttributes.setListAttribute(id, attributeName, list);
 

Specified by:
getListAttribute in interface CyAttributes
Parameters:
id - unique identifier.
attributeName - attribute name.
Returns:
List object.

setAttributeMap

public void setAttributeMap(String id,
                            String attributeName,
                            Map map)
Specified by:
setAttributeMap in interface CyAttributes

setMapAttribute

public void setMapAttribute(String id,
                            String attributeName,
                            Map map)
Description copied from interface: CyAttributes
Sets a 'simple' map of attribute values.

A 'simple' map is defined as follows:

If the above requirements are not met, an IllegalArgumentException will be thrown.

Implementation note: calling this method results in many calls to the MultiHashMap back-end data store. For example, if you have five elements in a Map, the implementation code makes five calls to the MultiHashMap. Therefore, if you are listening to MultiHashMap events, you will be notified of five separate events, rather than one global map event.

Specified by:
setMapAttribute in interface CyAttributes
Parameters:
id - unique identifier.
attributeName - attribute name.
map - Map Object.

getAttributeMap

public Map getAttributeMap(String id,
                           String attributeName)
Specified by:
getAttributeMap in interface CyAttributes

getMapAttribute

public Map getMapAttribute(String id,
                           String attributeName)
Description copied from interface: CyAttributes
Gets a 'simple' map of attribute values.

A 'simple' map is defined as follows:

Note: The returned Map is useful for read operations only. If you add, edit, or delete elements within this Map, these changes will not be stored, unless you explicitly call setMapAttribute() again. For example:

 Map map = nodeAttributes.getMapAttribute(id, attributeName);

 //  Add new item
 map.put(new String("Message"), new String("Hello, World"));

 //  Save modified map back
 nodeAttributes.setMapAttribute(id, attributeName, map);
 

Specified by:
getMapAttribute in interface CyAttributes
Parameters:
id - unique identifier.
attributeName - attribute name.
Returns:
Map Object.

getMultiHashMap

public MultiHashMap getMultiHashMap()
Description copied from interface: CyAttributes
Gets the MultiHashMap Object, where we store attribute values.

By using MultiHashMap and MultiHashMapDefinition directly, you can store arbitrarily complex data structures. Recommended for advanced coders only.

Specified by:
getMultiHashMap in interface CyAttributes
Returns:
MultiHashMap Object.

getMultiHashMapDefinition

public MultiHashMapDefinition getMultiHashMapDefinition()
Description copied from interface: CyAttributes
Gets the MultiHashMapDefinition Object, where we store attribute definitions.

By using MultiHashMap and MultiHashMapDefinition directly, you can store arbitrarily complex data structures (e.g. anything more complicated that 'simple' lists and 'simple' maps). Recommended for advanced coders only.

Specified by:
getMultiHashMapDefinition in interface CyAttributes
Returns:
MultiHashMapDefinition Object.

www.cytoscape.org