yext.graphml.reader
Class YGraphElementFactory

java.lang.Object
  extended byyext.graphml.reader.YGraphElementFactory
All Implemented Interfaces:
AttributeConstants, AttributeFactory, GraphElementFactory
Direct Known Subclasses:
DotnetGraphElementFactory, YHierarchyGraphElementFactory

public class YGraphElementFactory
extends Object
implements GraphElementFactory, AttributeFactory

Implementation of GraphElementFactory for yfiles.


Nested Class Summary
protected  class YGraphElementFactory.AttributeData
          Data class for attributes.
 
Field Summary
protected  YList attributeList
           
protected  Map attributeMap
           
protected  YList createdGraphList
           
protected  Class graphImpl
           
protected  YList graphList
           
 
Fields inherited from interface org.graphdrawing.graphml.reader.GraphElementFactory
EDGEDEFAULT_DIRECTED, EDGEDEFAULT_UNDIRECTED, HYPEREDGE_TYPE_INT, HYPEREDGE_TYPE_OUT, HYPEREDGE_TYPE_UNDIR
 
Fields inherited from interface org.graphdrawing.graphml.attr.AttributeConstants
TYPE_BOOLEAN, TYPE_COMPLEX, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT, TYPE_LONG, TYPE_STRING
 
Constructor Summary
YGraphElementFactory(Class _graphImpl)
          Creates a new factory.
YGraphElementFactory(Graph _graph)
          Creates a new factory using a given graph instance to store the data.
 
Method Summary
 void createAttribute(GraphMLParseContext context, String name, String value)
          This method is called when an attribute value is encountered.
 Object createEdge(GraphMLParseContext context, String id, Object source, Object target, Object sourceport, Object targetport, boolean directed)
          This method creates an edge on the graph, between nodes source and target.
 Object createEndPoint(GraphMLParseContext context, String id, Object node, Object port, int type)
          Not implemented.
 Object createGraph(GraphMLParseContext context, String id, int edgedefault)
          Creates the graph, should set up data with attributes.
 Object createGraphML(GraphMLParseContext context)
          Not implemented.
 Object createHyperEdge(GraphMLParseContext context, String id)
          Not implemented.
 Object createNode(GraphMLParseContext context, String id)
          Creates a node on the passed graph, could be set up with attributes passed by.
 Object createPort(GraphMLParseContext context, Object owner, String name)
          Not implemented.
 void defineAttribute(String name, int contentType, int scopeType)
          This method is called when an attribute definition is encountered.
 YList getGraphList()
          Returns the list of graphs read from the input.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

graphList

protected YList graphList

createdGraphList

protected YList createdGraphList

graphImpl

protected Class graphImpl

attributeList

protected YList attributeList

attributeMap

protected Map attributeMap
Constructor Detail

YGraphElementFactory

public YGraphElementFactory(Class _graphImpl)
Creates a new factory.

Parameters:
_graphImpl - Defines the class which is instantiated for every graph in the input. The class must provide a constructor without arguments and must be a subclass of Graph.

YGraphElementFactory

public YGraphElementFactory(Graph _graph)
Creates a new factory using a given graph instance to store the data.

Parameters:
_graph - the data of the first graph in the input is stored here.
Method Detail

getGraphList

public YList getGraphList()
Returns the list of graphs read from the input.


createGraphML

public Object createGraphML(GraphMLParseContext context)
Not implemented.

Specified by:
createGraphML in interface GraphElementFactory
Parameters:
context - the current parse context.
Returns:
null.

createGraph

public Object createGraph(GraphMLParseContext context,
                          String id,
                          int edgedefault)
Creates the graph, should set up data with attributes.

Specified by:
createGraph in interface GraphElementFactory
Parameters:
context - the current parse context.
id - the identifier of the graph as defined in the input data. May be null if no id has been specified.
edgedefault - indicating if edges are per default directed or undirected.
Returns:
java.lang.Object

createNode

public Object createNode(GraphMLParseContext context,
                         String id)
Creates a node on the passed graph, could be set up with attributes passed by.

Specified by:
createNode in interface GraphElementFactory
Parameters:
context - the current parse context.
id - the identifier of the node as defined in the input data.
Returns:
a user object representing a node.

createEdge

public Object createEdge(GraphMLParseContext context,
                         String id,
                         Object source,
                         Object target,
                         Object sourceport,
                         Object targetport,
                         boolean directed)
This method creates an edge on the graph, between nodes source and target. Moreover the attributes are passed with the creation-request, so the application could set up all data, gaining from this parameter.

Specified by:
createEdge in interface GraphElementFactory
Parameters:
context - the current parse context.
id - the identifier of the edge as defined in the input data. May be null if no id has been specified.
source - the user object representing the source node of the edge.
target - the user object representing the target node of the edge.
sourceport - the user object representing the source port of the edge.
targetport - the user object representing the target port of the edge.
directed - indicates whether the edge is directed or not.
Returns:
a user object representing an edge.

createPort

public Object createPort(GraphMLParseContext context,
                         Object owner,
                         String name)
Not implemented.

Specified by:
createPort in interface GraphElementFactory
Parameters:
context - the current parse context.
owner - the owner of the port (a node or another port)
name - the identifier of the port as defined in the input data.
Returns:
null

createHyperEdge

public Object createHyperEdge(GraphMLParseContext context,
                              String id)
Not implemented.

Specified by:
createHyperEdge in interface GraphElementFactory
Parameters:
context - the current parse context.
id - the identifier of the hyperedge as defined in the input data. May be null if no id has been specified.
Returns:
null

createEndPoint

public Object createEndPoint(GraphMLParseContext context,
                             String id,
                             Object node,
                             Object port,
                             int type)
Not implemented.

Specified by:
createEndPoint in interface GraphElementFactory
Parameters:
context - the current parse context.
id - the identifier of the endpoint as defined in the input data. May be null if no id has been specified.
node - the user object representing the associated node of the endpoint.
type - the direction type of the endpoint.
Returns:
null

defineAttribute

public void defineAttribute(String name,
                            int contentType,
                            int scopeType)
Description copied from interface: AttributeFactory
This method is called when an attribute definition is encountered.

Specified by:
defineAttribute in interface AttributeFactory
Parameters:
name - the name of the attribute
contentType - one of AttributeConstants.TYPE_INT, AttributeConstants.TYPE_LONG, AttributeConstants.TYPE_FLOAT, AttributeConstants.TYPE_DOUBLE, AttributeConstants.TYPE_STRING, AttributeConstants.TYPE_BOOLEAN.

createAttribute

public void createAttribute(GraphMLParseContext context,
                            String name,
                            String value)
Description copied from interface: AttributeFactory
This method is called when an attribute value is encountered.

Specified by:
createAttribute in interface AttributeFactory
Parameters:
context - the context in which the parser is.
name - the name of the attribute.
value - the value of the attribute.


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