y.io.gml
Class GraphParser

java.lang.Object
  |
  +--y.io.gml.ItemParser
        |
        +--y.io.gml.GraphParser
All Implemented Interfaces:
GMLTokenizer.Callback
Direct Known Subclasses:
HierarchicGraphParser

public class GraphParser
extends ItemParser

This class works together with NodeParser and EdgeParser instances. It can parse the .graph scope It will store the mapping between element ids (Integer) to element instances in the graph.


Field Summary
protected  Graph2D graph
           
protected  Map id2Edge
           
protected  Map id2Node
           
 
Fields inherited from class y.io.gml.ItemParser
attributes, childMap, delegate, level
 
Constructor Summary
GraphParser(Graph2D graph)
           
 
Method Summary
 void addAttribute(String key, Object value)
          Puts the key value pair into the local attribute map
 void end()
          this method will be called as soon as the parser leaves the scope.
 Map getId2Edge()
          Getter for property id2Edge.
 Map getId2Node()
          Getter for property id2Node.
 Object getItem()
          Returns the "product" of this scope.
 
Methods inherited from class y.io.gml.ItemParser
addChild, attribute, attribute, begin, beginScope, childFinished, endScope, getAttributes, getBoolean, getDouble, getDouble, getInt, getInt, getLevel, getString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

graph

protected Graph2D graph

id2Node

protected Map id2Node

id2Edge

protected Map id2Edge
Constructor Detail

GraphParser

public GraphParser(Graph2D graph)
Method Detail

getItem

public Object getItem()
Description copied from class: ItemParser
Returns the "product" of this scope. This method should be called after this parser has left the scope, i.e. after ItemParser.end() has been called. The latter should construct the resulting item from the collected data and this item should be returned by this method. By default, this method return the map of the attributes.

Overrides:
getItem in class ItemParser
Returns:
the result of the parsing, in this case a Map

getId2Edge

public Map getId2Edge()
Getter for property id2Edge.

Returns:
Value of property id2Edge.

getId2Node

public Map getId2Node()
Getter for property id2Node.

Returns:
Value of property id2Node.

addAttribute

public void addAttribute(String key,
                         Object value)
Description copied from class: ItemParser
Puts the key value pair into the local attribute map

Overrides:
addAttribute in class ItemParser
Parameters:
key - the key
value - the value

end

public void end()
Description copied from class: ItemParser
this method will be called as soon as the parser leaves the scope. This implementation does nothing. Subclasses should nevertheless make a super call.

Overrides:
end in class ItemParser

© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003