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

cytoscape.data.readers
Class GMLNode

java.lang.Object
  extended by cytoscape.data.readers.GMLNode
All Implemented Interfaces:
Comparator

public class GMLNode
extends Object
implements Comparator

This class represents a GMLNode. A GMLNode can be either a GML terminal, or contain a mapping from string keys to other GMLNodes


Field Summary
 boolean terminal
          True if this node is a terminal.
 
Constructor Summary
GMLNode()
          This constructor creates a non-terminal GMLNode.
GMLNode(String string_value)
          This constructor create a terminal GMLNode.
 
Method Summary
 void addMapping(String key, GMLNode node)
          Add a mapping from key to node
 int compare(Object o1, Object o2)
          DOCUMENT ME!
 Double doubleValue()
          Get the value of this node as a Double
 Vector getMapping(String key)
          Return the data mapped by this key
 Integer integerValue()
          Get the value of this node as an Integer
 String stringValue()
          Get the value of this node as a String
 String toString()
          Return the string representation of this GMLNode.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

terminal

public boolean terminal
True if this node is a terminal. (A terminal node is one that just contains a piece of data (string,double,int) and not further mapping to GMLNodes

Constructor Detail

GMLNode

public GMLNode(String string_value)
This constructor create a terminal GMLNode.

Parameters:
string_value - The terminal value of the GMLNode

GMLNode

public GMLNode()
This constructor creates a non-terminal GMLNode. The mapping is initially empty. Mappings are added using addMapping

Method Detail

toString

public String toString()
Return the string representation of this GMLNode. This will recursively print out all mapped subGMLNodes if present.

Overrides:
toString in class Object

compare

public int compare(Object o1,
                   Object o2)
DOCUMENT ME!

Specified by:
compare in interface Comparator
Parameters:
o1 - DOCUMENT ME!
o2 - DOCUMENT ME!
Returns:
DOCUMENT ME!

doubleValue

public Double doubleValue()
Get the value of this node as a Double

Returns:
The value of this node as a double
Throws:
RuntimeException - if the value of this node cannot be interpreted as a Double

integerValue

public Integer integerValue()
Get the value of this node as an Integer

Returns:
The value of this node as an Integer
Throws:
RuntimeException - if the value of this node cannot be interpreted as an Integer

stringValue

public String stringValue()
Get the value of this node as a String

Returns:
The value of this node as a String

addMapping

public void addMapping(String key,
                       GMLNode node)
Add a mapping from key to node

Parameters:
key - The key for the mapping
node - The node which will map to the key

getMapping

public Vector getMapping(String key)
Return the data mapped by this key

Parameters:
key - The key to look up
Returns:
A vector of GMLNodes (may be null)

www.cytoscape.org