org.graphdrawing.graphml.reader
Interface GraphElementFactory

All Known Implementing Classes:
YGraphElementFactory

public interface GraphElementFactory

This interface defines a factory for the creation of graphs and graph elements. It contains a factory method for each graph element defined in the GraphML format. The factory methods are called along the parsing process of the input data and are supposed to return the corresponding user objects for each graph or graph element.


Field Summary
static int EDGEDEFAULT_DIRECTED
          Flag for the value directed of the edgedefault attribute of the graph element.
static int EDGEDEFAULT_UNDIRECTED
          Flag for the value undirected of the edgedefault attribute of the graph element.
static int HYPEREDGE_TYPE_INT
          Flag for the value in of the type attribute of the hyperedge element.
static int HYPEREDGE_TYPE_OUT
          Flag for the value out of the type attribute of the hyperedge element.
static int HYPEREDGE_TYPE_UNDIR
          Flag for the value undir of the type attribute of the hyperedge element.
 
Method Summary
 Object createEdge(GraphMLParseContext context, String id, Object source, Object target, Object sourceport, Object targetport, boolean directed)
          Returns a user object which represents an edge.
 Object createEndPoint(GraphMLParseContext context, String id, Object node, Object port, int type)
          Returns a user object which represents the endpoint of a hyperedge.
 Object createGraph(GraphMLParseContext context, String id, int edgedefault)
          Returns a user object which represents a graph.
 Object createGraphML(GraphMLParseContext context)
          Returns the the top-level container of all data.
 Object createHyperEdge(GraphMLParseContext context, String id)
          Returns a user object which represents a hyperedge.
 Object createNode(GraphMLParseContext context, String id)
          Returns a user object which represents a node.
 Object createPort(GraphMLParseContext context, Object owner, String name)
          Returns a user object which represents a port.
 

Field Detail

EDGEDEFAULT_DIRECTED

public static final int EDGEDEFAULT_DIRECTED
Flag for the value directed of the edgedefault attribute of the graph element.

See Also:
Constant Field Values

EDGEDEFAULT_UNDIRECTED

public static final int EDGEDEFAULT_UNDIRECTED
Flag for the value undirected of the edgedefault attribute of the graph element.

See Also:
Constant Field Values

HYPEREDGE_TYPE_INT

public static final int HYPEREDGE_TYPE_INT
Flag for the value in of the type attribute of the hyperedge element.

See Also:
Constant Field Values

HYPEREDGE_TYPE_OUT

public static final int HYPEREDGE_TYPE_OUT
Flag for the value out of the type attribute of the hyperedge element.

See Also:
Constant Field Values

HYPEREDGE_TYPE_UNDIR

public static final int HYPEREDGE_TYPE_UNDIR
Flag for the value undir of the type attribute of the hyperedge element.

See Also:
Constant Field Values
Method Detail

createGraphML

public Object createGraphML(GraphMLParseContext context)
Returns the the top-level container of all data. This method is called when the graphml element is parsed. The return value of this method will be returned by parse() method of the parser.

Parameters:
context - the current parse context.
Returns:
a user object for the entire graphml-content.

createGraph

public Object createGraph(GraphMLParseContext context,
                          String id,
                          int edgedefault)
Returns a user object which represents a graph.

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:
a user object representing a graph.

createNode

public Object createNode(GraphMLParseContext context,
                         String id)
Returns a user object which represents a node.

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.

createPort

public Object createPort(GraphMLParseContext context,
                         Object owner,
                         String name)
Returns a user object which represents a port.

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:
a user object representing a port.

createEdge

public Object createEdge(GraphMLParseContext context,
                         String id,
                         Object source,
                         Object target,
                         Object sourceport,
                         Object targetport,
                         boolean directed)
Returns a user object which represents an edge.

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.

createHyperEdge

public Object createHyperEdge(GraphMLParseContext context,
                              String id)
Returns a user object which represents a hyperedge.

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:
a user object representing a hyperedge.

createEndPoint

public Object createEndPoint(GraphMLParseContext context,
                             String id,
                             Object node,
                             Object port,
                             int type)
Returns a user object which represents the endpoint of a hyperedge.

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:
a user object representing a hyperedge.


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