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

cytoscape.data
Class NetworkData

java.lang.Object
  extended by cytoscape.data.NetworkData

public abstract class NetworkData
extends Object

There is an event fired anytime that a value is modified, you need to be listener to the attribute name though.


Field Summary
static int ATTRIBUTE_ALREADY_ASSIGNED
           
static int DOUBLE_TYPE
           
static String EDGE_ATTRIBUTE_ADDED
           
static String EDGE_ATTRIBUTE_REMOVED
           
static int INSANE_ATTRIBUTE_ID
           
static int INSANE_ATTRIBUTE_TYPE
           
static int NO_SUCH_ATTRIBUTE
           
static String NODE_ATTRIBUTE_ADDED
           
static String NODE_ATTRIBUTE_REMOVED
           
static int OBJECT_TYPE
           
static int STRING_TYPE
           
static int VALUE_NOT_A_DOUBLE
           
static int WRONG_ATTRIBUTE_TYPE
           
 
Constructor Summary
NetworkData()
           
 
Method Summary
static int addNodeAttribute(String attribute_name)
          Attempts to add a new Attribute name, of Object type for nodes.
static int addNodeAttribute(String attribute_name, int attribute_type)
          Attempts to add a new Attribute name, of given type for nodes.
static double getNodeAttributeDoubleValue(int node_index, String attribute)
           
static double getNodeAttributeDoubleValue(Node node, String attribute)
           
static int getNodeAttributeID(String attribute)
           
static Object getNodeAttributeObjectValue(int node_index, String attribute)
           
static Object getNodeAttributeObjectValue(Node node, String attribute)
           
static String[] getNodeAttributes(int[] node_indices)
          Returns all Attributes that one or more of the given nodes have values for.
static String getNodeAttributeStringValue(int node_index, String attribute)
           
static String getNodeAttributeStringValue(Node node, String attribute)
           
static int getNodeAttributeType(String attribute)
           
static Object getNodeAttributeValue(int node_index, int att_id)
           
static Object getNodeAttributeValue(Node node, String attribute)
           
static int setNodeAttributeDoubleValue(int node_index, int att_id, double value)
           
static int setNodeAttributeDoubleValue(int node_index, String attribute, double value)
           
static int setNodeAttributeDoubleValue(Node node, String attribute, double value)
           
static int setNodeAttributeObjectValue(int node_index, int att_id, Object value)
           
static int setNodeAttributeObjectValue(int node_index, String attribute, Object value)
           
static int setNodeAttributeObjectValue(Node node, String attribute, Object value)
           
static int setNodeAttributeStringValue(int node_index, int att_id, String value)
           
static int setNodeAttributeStringValue(int node_index, String attribute, String value)
           
static int setNodeAttributeStringValue(Node node, String attribute, String value)
           
static int setNodeAttributeValue(Node node, String attribute, Object value)
           
static int setNodeAttributeValue(Node node, String attribute, Object value, int attribute_type)
          Attempts to set the value for a node, for a given attribute.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_ATTRIBUTE_ADDED

public static String NODE_ATTRIBUTE_ADDED

NODE_ATTRIBUTE_REMOVED

public static String NODE_ATTRIBUTE_REMOVED

EDGE_ATTRIBUTE_ADDED

public static String EDGE_ATTRIBUTE_ADDED

EDGE_ATTRIBUTE_REMOVED

public static String EDGE_ATTRIBUTE_REMOVED

DOUBLE_TYPE

public static int DOUBLE_TYPE

STRING_TYPE

public static int STRING_TYPE

OBJECT_TYPE

public static int OBJECT_TYPE

NO_SUCH_ATTRIBUTE

public static int NO_SUCH_ATTRIBUTE

VALUE_NOT_A_DOUBLE

public static int VALUE_NOT_A_DOUBLE

INSANE_ATTRIBUTE_TYPE

public static int INSANE_ATTRIBUTE_TYPE

WRONG_ATTRIBUTE_TYPE

public static int WRONG_ATTRIBUTE_TYPE

INSANE_ATTRIBUTE_ID

public static int INSANE_ATTRIBUTE_ID

ATTRIBUTE_ALREADY_ASSIGNED

public static int ATTRIBUTE_ALREADY_ASSIGNED
Constructor Detail

NetworkData

public NetworkData()
Method Detail

addNodeAttribute

public static int addNodeAttribute(String attribute_name)
Attempts to add a new Attribute name, of Object type for nodes.

Parameters:
attribute_name - the name of the new attribute
Returns:
the ID of the attribute, if assinged, or -1 if already assigned/not a good name.

addNodeAttribute

public static int addNodeAttribute(String attribute_name,
                                   int attribute_type)
Attempts to add a new Attribute name, of given type for nodes. Available types are: OBJECT_TYPE, DOUBLE_TYPE, and STRING_TYPE

Parameters:
attribute_name - the name of the new attribute
Returns:
the ID of the attribute, if assinged, or -1 if already assigned/not a good name.

getNodeAttributeType

public static int getNodeAttributeType(String attribute)

getNodeAttributeID

public static int getNodeAttributeID(String attribute)

setNodeAttributeValue

public static int setNodeAttributeValue(Node node,
                                        String attribute,
                                        Object value)

setNodeAttributeValue

public static int setNodeAttributeValue(Node node,
                                        String attribute,
                                        Object value,
                                        int attribute_type)
Attempts to set the value for a node, for a given attribute. However, there a few checks that happen along the way. First the Node must be part of the CytoscapeRootGraph, also the value must match the attribute type, which must match the overall attribute type. No problem if the attribute is not initialized, but if has been initialized, and the types don't match, then you have a problem.

Parameters:
node - the node who should be part of Cytoscape
attribute - the name of this attribute
value - the value, which must match the attribute type
attribute_type - if this attribute has been previosly initialized, then this musht match that type. Otherwise the attribute will get initialized with this type.
Returns:
"1" or a positive value if all went well, otherwise a negative value that corresponds to the error. See the "throws" keeping in mind that these are not really exceptions...
Throws:
{@link - VALUE_NOT_A_DOUBLE} if the attribute_type was double and the value could be put into a Double.
{@link - INSANE_ATTRIBUTE_TYPE} if the given attribute_type is not a supported one
{@link - WRONG_ATTRIBUTE_TYPE} if the given attribute_type does not match the attribute_type of the attribute
{@link - INSANE_ATTRIBUTE_ID} if the attribute does not exist

setNodeAttributeObjectValue

public static int setNodeAttributeObjectValue(int node_index,
                                              String attribute,
                                              Object value)

setNodeAttributeObjectValue

public static int setNodeAttributeObjectValue(Node node,
                                              String attribute,
                                              Object value)

setNodeAttributeObjectValue

public static int setNodeAttributeObjectValue(int node_index,
                                              int att_id,
                                              Object value)

setNodeAttributeDoubleValue

public static int setNodeAttributeDoubleValue(int node_index,
                                              String attribute,
                                              double value)

setNodeAttributeDoubleValue

public static int setNodeAttributeDoubleValue(Node node,
                                              String attribute,
                                              double value)

setNodeAttributeDoubleValue

public static int setNodeAttributeDoubleValue(int node_index,
                                              int att_id,
                                              double value)

setNodeAttributeStringValue

public static int setNodeAttributeStringValue(int node_index,
                                              String attribute,
                                              String value)

setNodeAttributeStringValue

public static int setNodeAttributeStringValue(Node node,
                                              String attribute,
                                              String value)

setNodeAttributeStringValue

public static int setNodeAttributeStringValue(int node_index,
                                              int att_id,
                                              String value)

getNodeAttributeValue

public static Object getNodeAttributeValue(Node node,
                                           String attribute)

getNodeAttributeValue

public static Object getNodeAttributeValue(int node_index,
                                           int att_id)

getNodeAttributeObjectValue

public static Object getNodeAttributeObjectValue(Node node,
                                                 String attribute)

getNodeAttributeStringValue

public static String getNodeAttributeStringValue(Node node,
                                                 String attribute)

getNodeAttributeDoubleValue

public static double getNodeAttributeDoubleValue(Node node,
                                                 String attribute)

getNodeAttributeObjectValue

public static Object getNodeAttributeObjectValue(int node_index,
                                                 String attribute)

getNodeAttributeStringValue

public static String getNodeAttributeStringValue(int node_index,
                                                 String attribute)

getNodeAttributeDoubleValue

public static double getNodeAttributeDoubleValue(int node_index,
                                                 String attribute)

getNodeAttributes

public static String[] getNodeAttributes(int[] node_indices)
Returns all Attributes that one or more of the given nodes have values for.


www.cytoscape.org