agl2
Class GraphBuilder

java.lang.Object
  |
  +--agl2.GraphBuilder
All Implemented Interfaces:
Graph, GraphTag, MutableGraph
Direct Known Subclasses:
BigraphBuilder, DigraphBuilder, UngraphBuilder

public abstract class GraphBuilder
extends java.lang.Object
implements MutableGraph, GraphTag

The GraphBuilder builds a representation of a graph.


Nested Class Summary
 
Nested classes inherited from class agl2.GraphTag
GraphTag.MapTag, GraphTag.Tag
 
Field Summary
protected  GraphEventMulticast listeners
           
protected  GraphProperties properties
           
protected  EdgeRep rep
           
protected  int vertexCount
           
 
Fields inherited from interface agl2.GraphTag
allTags, BIGRAPH, DIGRAPH, EDGE_DATA, EDGE_INDEX, EDGE_WEIGHT, GRAPH_ACYLIC, GRAPH_NAME, GRAPH_ROOT, GRAPH_TRAITS, MULTIGRAPH, OBJECT_VERTEX, UNGRAPH, VERTEX_COLOR, VERTEX_DATA, VERTEX_DISTANCE, VERTEX_EDGEMAP, VERTEX_INDEX
 
Constructor Summary
GraphBuilder()
          Construct a graph Builder for the rep.
GraphBuilder(EdgeRep r)
           
GraphBuilder(GraphTag[] tags)
           
 
Method Summary
 Edge addEdge(java.lang.Object v1, java.lang.Object v2, java.lang.Object et)
          Add an edge to the graph.
 void addListener(GraphListener gl)
           
 java.lang.Object addVertex(java.lang.Object o)
          add a vertex label to the graph returning a vertex object.
 java.util.Set getEdges()
           
abstract  Graph getGraph()
           
 java.util.Set getVertices()
           
 boolean hasEdge(java.lang.Object v1, java.lang.Object v2)
           
 boolean hasVertex(java.lang.Object o)
           
protected  void initializeTags(GraphTag[] tags)
           
 void remEdge(Edge e)
           
 void remEdge(java.lang.Object v1, java.lang.Object v2)
          Add an edge to the graph.
 void remListener(GraphListener gl)
           
 void remVertex(java.lang.Object o)
          Remove a vertex (and all edges emanating or arriving) A vertex or labelling object may be passed.
 void setRoot(java.lang.Object root)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rep

protected EdgeRep rep

properties

protected GraphProperties properties

listeners

protected GraphEventMulticast listeners

vertexCount

protected int vertexCount
Constructor Detail

GraphBuilder

public GraphBuilder()
Construct a graph Builder for the rep.


GraphBuilder

public GraphBuilder(GraphTag[] tags)

GraphBuilder

public GraphBuilder(EdgeRep r)
Method Detail

initializeTags

protected void initializeTags(GraphTag[] tags)

getGraph

public abstract Graph getGraph()

getVertices

public java.util.Set getVertices()
Specified by:
getVertices in interface Graph
Returns:
Set v in V

getEdges

public java.util.Set getEdges()
Specified by:
getEdges in interface Graph
Returns:
Set e in E

addVertex

public java.lang.Object addVertex(java.lang.Object o)
Description copied from interface: MutableGraph
add a vertex label to the graph returning a vertex object. This may or may not be the Object argument passed (this depends on the type of Graph representation being used. A map is provided to translate between label objects and vertex objects.

Specified by:
addVertex in interface MutableGraph
Returns:
a Vertex object or label object
See Also:
GrapTag, PropertyMap

remVertex

public void remVertex(java.lang.Object o)
Description copied from interface: MutableGraph
Remove a vertex (and all edges emanating or arriving) A vertex or labelling object may be passed. If a labelling objects is passes it will translated internally

Specified by:
remVertex in interface MutableGraph
Parameters:
o - The vertex

hasVertex

public boolean hasVertex(java.lang.Object o)

addEdge

public Edge addEdge(java.lang.Object v1,
                    java.lang.Object v2,
                    java.lang.Object et)
Description copied from interface: MutableGraph
Add an edge to the graph.

Specified by:
addEdge in interface MutableGraph
Parameters:
v1 - a label or vertex
v2 - a label or vertex
et - an edge label or object (placed EDGE_NAMES map)
Returns:
an edge
See Also:
GraphTag

remEdge

public void remEdge(java.lang.Object v1,
                    java.lang.Object v2)
Description copied from interface: MutableGraph
Add an edge to the graph.

Specified by:
remEdge in interface MutableGraph
Parameters:
v1 - a label or vertex
v2 - a label or vertex
Returns:
an edge
See Also:
GraphTag

remEdge

public void remEdge(Edge e)
Specified by:
remEdge in interface MutableGraph

hasEdge

public boolean hasEdge(java.lang.Object v1,
                       java.lang.Object v2)

setRoot

public void setRoot(java.lang.Object root)

addListener

public void addListener(GraphListener gl)
Specified by:
addListener in interface MutableGraph

remListener

public void remListener(GraphListener gl)
Specified by:
remListener in interface MutableGraph

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object