Search this API

y.io.gml
Class EdgeParser

java.lang.Object
  extended by y.io.gml.ItemParser
      extended by y.io.gml.EdgeParser
All Implemented Interfaces:
GMLTokenizer.Callback

public class EdgeParser
extends ItemParser

This class is used by GraphParser. It can parse the .edge scope It will create an Edge in a graph for each run.

 
Your browser does not support SVG content.

Field Summary
protected  EdgeGraphicsParser edgeGraphicsParser
          The parser instance that parses the graphics section.
protected  EdgeRealizer er
          The current realizer that is parsed.
protected  Graph2D graph
          The graph instance for which the nodes will be created.
protected  java.util.Map id2Edge
          The mapping between the gml IDs and the edges.
protected  java.util.Map id2Node
          The mapping between the gml IDs and the nodes.
protected  LabelGraphicsParser labelGraphics
          The parser for the label graphics section
 
Fields inherited from class y.io.gml.ItemParser
attributes, childMap, delegate, level
 
Constructor Summary
EdgeParser(Graph2D graph, java.util.Map id2Node, java.util.Map id2Edge)
          Creates an edge parser, which is capable of parsing the top level attributes of the .graph.edge scope.
 
Method Summary
 void begin()
          this method will be called as soon as the parser enters the scope.
 void childFinished(ItemParser child)
          this method will be called, as soon as the a child ItemParser finished and returned from its end() method.
 void end()
          this method will be called as soon as the parser leaves the scope.
 java.lang.Object getItem()
          Returns the "product" of this scope.
protected  void handleLabels()
          Applies the parsed edge label attributes to the edge labels of this edges.
 
Methods inherited from class y.io.gml.ItemParser
addAttribute, addChild, attribute, attribute, beginScope, 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
The graph instance for which the nodes will be created.


id2Node

protected java.util.Map id2Node
The mapping between the gml IDs and the nodes.


id2Edge

protected java.util.Map id2Edge
The mapping between the gml IDs and the edges.


edgeGraphicsParser

protected EdgeGraphicsParser edgeGraphicsParser
The parser instance that parses the graphics section.


er

protected EdgeRealizer er
The current realizer that is parsed.


labelGraphics

protected LabelGraphicsParser labelGraphics
The parser for the label graphics section

Constructor Detail

EdgeParser

public EdgeParser(Graph2D graph,
                  java.util.Map id2Node,
                  java.util.Map id2Edge)
Creates an edge parser, which is capable of parsing the top level attributes of the .graph.edge scope.

Parameters:
graph - the graph, for which an edge will be parsed
id2Node - a map, which contains mappings between node ids (Integer) and Node instances
id2Edge - a map, that will be filled by this class with mappings between edge ids (Integer) to edge instances
Method Detail

begin

public void begin()
Description copied from class: ItemParser
this method will be called as soon as the parser enters the scope. This implementation will clear the attribute map. Subclasses should therefore make a super call.

Overrides:
begin in class ItemParser

childFinished

public void childFinished(ItemParser child)
Description copied from class: ItemParser
this method will be called, as soon as the a child ItemParser finished and returned from its end() method. This implementation does nothing. Subclasses should nevertheless make a super call.

Overrides:
childFinished in class ItemParser
Parameters:
child - the child ItemParser, which just finished

handleLabels

protected void handleLabels()
Applies the parsed edge label attributes to the edge labels of this edges.


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

getItem

public java.lang.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

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