Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.port80.graph.impl
Class DirectedGraph  view DirectedGraph download DirectedGraph.java

java.lang.Object
  extended bycom.port80.util.attr.AttrTable
      extended bycom.port80.graph.impl.GraphElement
          extended bycom.port80.graph.impl.DirectedGraph
All Implemented Interfaces:
com.port80.util.attr.IAttrTable, com.port80.graph.IGraph, com.port80.graph.IGraphElement

public class DirectedGraph
extends GraphElement
implements com.port80.graph.IGraph

Basic directed graph class.


Nested Class Summary
static class DirectedGraph.NameComparator
           
 
Field Summary
private static java.lang.String CLASSNAME
           
private static boolean DEBUG
           
private  com.port80.util.attr.IAttrTable fEdgeAttrTable
          Graph wide edge attribute table to store customized attributes that applies to all edges in the graph.
private  com.port80.graph.IEdgeFactory fEdgeFactory
          Vertex factory create edges for the graph and holds the default attribute values.
protected  java.util.Set fEdgeSet
           
private  boolean fIsCluster
           
private  com.port80.graph.IGraph fParent
           
protected  java.util.List fSubGraphList
           
private  com.port80.util.attr.IAttrTable fVertexAttrTable
          Graph wide vertex attribute table to store customized attributes that applies to all vertices in the graph.
private  com.port80.graph.IVertexFactory fVertexFactory
          Vertex factory create vertices for the graph and holds the default attribute values.
protected  java.util.Map fVertexTable
           
private static java.lang.String NAME
           
private static java.lang.String PACKAGENAME
           
private static boolean VERBOSE
           
private static int VERSION
           
private static java.lang.String VERSIONNAME
           
 
Fields inherited from class com.port80.graph.impl.GraphElement
fData, fName
 
Fields inherited from class com.port80.util.attr.AttrTable
parentAttrTable
 
Constructor Summary
DirectedGraph(java.lang.String name, java.lang.Object data, com.port80.graph.IGraph parent)
           
 
Method Summary
 void addAllVertex(java.util.Collection c)
          Add a collection of IVertex.
 void addVertex(com.port80.graph.IVertex v)
           
 java.util.Set allEdges()
          All edges under this graph including thos in all its nested subgraphs.
private  java.util.Set allEdges(java.util.Set vset, java.util.Set ret)
           
 java.util.Set allVertexNameSet()
          Remove a collection of IVertex.
 java.util.Set allVertices()
          All vertices under this graph including those in all its nested subgraphs.
private  void appendAttr(java.lang.StringBuffer ret, com.port80.util.attr.IAttrTable table, java.lang.String name)
           
private  void appendAttr(java.lang.StringBuffer ret, com.port80.util.attr.IAttrTable table, java.lang.String attrname, java.lang.String name)
           
 boolean canDelete(com.port80.graph.IEdge e)
           
 void clearLayout()
          Remove all layout attributes to prepare for new layout.
 boolean containsGraph(com.port80.graph.IGraph g)
           
 boolean containsVertex(com.port80.graph.IVertex v)
           
 boolean containsVertex(java.lang.String vname)
           
 java.util.Set findEdgesWithAttr(java.lang.String attrname)
           
 java.util.Set findVerticesWithAttr(java.lang.String attrname)
          Find vertices with given attribute name.
 com.port80.util.attr.IAttrTable getEdgeAttrTable()
           
 com.port80.graph.IEdgeFactory getEdgeFactory()
           
 java.util.Set getEdgeSet()
          Edges in this graph, not including those in subgraph.
 java.lang.String getElementTypeName()
           
 com.port80.graph.IGraph getGraph(com.port80.graph.IGraph g)
           
 java.lang.String getGraphTypeName()
           
 com.port80.graph.IGraph getParent()
           
 java.util.List getSubGraphs()
           
 com.port80.graph.IVertex getVertex(com.port80.graph.IVertex v)
           
 com.port80.graph.IVertex getVertex(java.lang.String vname)
           
 com.port80.util.attr.IAttrTable getVertexAttrTable()
           
 com.port80.graph.IVertexFactory getVertexFactory()
           
 java.util.Set getVertexNameSet()
          Vertices name/vertices in this graph, not including those in subgraph.
 java.util.Set getVertexSet()
           
 boolean isCluster()
           
 boolean isValid(com.port80.graph.IVertex head, com.port80.graph.IVertex tail)
           
 com.port80.graph.IEdge newEdge(com.port80.graph.IVertex tail, com.port80.graph.IVertex head, java.lang.String ename, java.lang.Object data)
           
 com.port80.graph.IGraph newGraph(java.lang.String name, java.lang.Object data)
           
 com.port80.graph.IVertex newVertex(java.lang.String name, java.lang.Object data)
           
 com.port80.graph.IVertex newVertex(java.lang.String name, java.lang.String port, java.lang.Object data)
           
private  void printlnAttr(java.lang.StringBuffer buf, com.port80.util.attr.IAttrTable table, java.lang.String name, java.lang.String indent)
           
private  void printlnAttrs(java.lang.StringBuffer buf, com.port80.util.attr.IAttrTable table, java.util.Set keys, java.lang.String indent)
           
 boolean removeEdge(com.port80.graph.IEdge e)
           
 com.port80.graph.IVertex removeVertex(com.port80.graph.IVertex v)
           
 com.port80.graph.IVertex removeVertex(java.lang.String vname)
          Remove a vertex from the graph or its subgraph.
 boolean saveImage(java.lang.String fname, float scale)
           
 int size()
           
private  void sprintEdge(java.lang.StringBuffer ret, com.port80.graph.IEdge e)
           
 java.lang.String sprintGraph()
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class com.port80.graph.impl.GraphElement
getData, getName, setData, setName
 
Methods inherited from class com.port80.util.attr.AttrTable
attrKeySet, clearAttrs, getAttr, getAttrAsString, getAttrBool, getAttrBool, getAttrCached, getAttrDouble, getAttrDouble, getAttrFloat, getAttrFloat, getAttrInt, getAttrInt, getAttrLong, getAttrLong, getAttrRegistry, getAttrString, hasAttr, initAttr, initAttr, initAttr, initAttr, initAttr, initAttr, initAttr, initAttr, removeAttr, removeUnregisteredAttrs, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttrFromString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.port80.graph.IGraphElement
getData, getName, setData, setName
 
Methods inherited from interface com.port80.util.attr.IAttrTable
attrKeySet, clearAttrs, getAttr, getAttrAsString, getAttrBool, getAttrBool, getAttrCached, getAttrDouble, getAttrDouble, getAttrFloat, getAttrFloat, getAttrInt, getAttrInt, getAttrLong, getAttrLong, getAttrRegistry, getAttrString, hasAttr, removeAttr, removeUnregisteredAttrs, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttrFromString
 

Field Detail

NAME

private static final java.lang.String NAME
See Also:
Constant Field Values

PACKAGENAME

private static final java.lang.String PACKAGENAME
See Also:
Constant Field Values

CLASSNAME

private static final java.lang.String CLASSNAME
See Also:
Constant Field Values

VERSION

private static final int VERSION
See Also:
Constant Field Values

VERSIONNAME

private static final java.lang.String VERSIONNAME
See Also:
Constant Field Values

DEBUG

private static boolean DEBUG

VERBOSE

private static boolean VERBOSE

fVertexFactory

private com.port80.graph.IVertexFactory fVertexFactory
Vertex factory create vertices for the graph and holds the default attribute values.


fEdgeFactory

private com.port80.graph.IEdgeFactory fEdgeFactory
Vertex factory create edges for the graph and holds the default attribute values.


fVertexAttrTable

private com.port80.util.attr.IAttrTable fVertexAttrTable
Graph wide vertex attribute table to store customized attributes that applies to all vertices in the graph.


fEdgeAttrTable

private com.port80.util.attr.IAttrTable fEdgeAttrTable
Graph wide edge attribute table to store customized attributes that applies to all edges in the graph.


fParent

private com.port80.graph.IGraph fParent

fIsCluster

private boolean fIsCluster

fVertexTable

protected java.util.Map fVertexTable

fEdgeSet

protected java.util.Set fEdgeSet

fSubGraphList

protected java.util.List fSubGraphList
Constructor Detail

DirectedGraph

public DirectedGraph(java.lang.String name,
                     java.lang.Object data,
                     com.port80.graph.IGraph parent)
Method Detail

isCluster

public boolean isCluster()
Specified by:
isCluster in interface com.port80.graph.IGraph

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


newGraph

public com.port80.graph.IGraph newGraph(java.lang.String name,
                                        java.lang.Object data)
Specified by:
newGraph in interface com.port80.graph.IGraph

newVertex

public com.port80.graph.IVertex newVertex(java.lang.String name,
                                          java.lang.Object data)
                                   throws com.port80.graph.GraphException
Specified by:
newVertex in interface com.port80.graph.IGraph

newVertex

public com.port80.graph.IVertex newVertex(java.lang.String name,
                                          java.lang.String port,
                                          java.lang.Object data)
                                   throws com.port80.graph.GraphException
Specified by:
newVertex in interface com.port80.graph.IGraph

newEdge

public com.port80.graph.IEdge newEdge(com.port80.graph.IVertex tail,
                                      com.port80.graph.IVertex head,
                                      java.lang.String ename,
                                      java.lang.Object data)
                               throws com.port80.graph.GraphException
Specified by:
newEdge in interface com.port80.graph.IGraph

removeEdge

public boolean removeEdge(com.port80.graph.IEdge e)
Specified by:
removeEdge in interface com.port80.graph.IGraph

isValid

public boolean isValid(com.port80.graph.IVertex head,
                       com.port80.graph.IVertex tail)
Specified by:
isValid in interface com.port80.graph.IGraph

canDelete

public boolean canDelete(com.port80.graph.IEdge e)
Specified by:
canDelete in interface com.port80.graph.IGraph

getVertexFactory

public com.port80.graph.IVertexFactory getVertexFactory()
Specified by:
getVertexFactory in interface com.port80.graph.IGraph

getEdgeFactory

public com.port80.graph.IEdgeFactory getEdgeFactory()
Specified by:
getEdgeFactory in interface com.port80.graph.IGraph

getVertexAttrTable

public com.port80.util.attr.IAttrTable getVertexAttrTable()
Specified by:
getVertexAttrTable in interface com.port80.graph.IGraph

getEdgeAttrTable

public com.port80.util.attr.IAttrTable getEdgeAttrTable()
Specified by:
getEdgeAttrTable in interface com.port80.graph.IGraph

getGraphTypeName

public java.lang.String getGraphTypeName()
Specified by:
getGraphTypeName in interface com.port80.graph.IGraph

getParent

public com.port80.graph.IGraph getParent()
Specified by:
getParent in interface com.port80.graph.IGraph

containsVertex

public boolean containsVertex(java.lang.String vname)
Specified by:
containsVertex in interface com.port80.graph.IGraph

containsVertex

public boolean containsVertex(com.port80.graph.IVertex v)
Specified by:
containsVertex in interface com.port80.graph.IGraph

getVertex

public com.port80.graph.IVertex getVertex(java.lang.String vname)
Specified by:
getVertex in interface com.port80.graph.IGraph

getVertex

public com.port80.graph.IVertex getVertex(com.port80.graph.IVertex v)
Specified by:
getVertex in interface com.port80.graph.IGraph

getVertexNameSet

public java.util.Set getVertexNameSet()
Description copied from interface: com.port80.graph.IGraph
Vertices name/vertices in this graph, not including those in subgraph.

Specified by:
getVertexNameSet in interface com.port80.graph.IGraph

getVertexSet

public java.util.Set getVertexSet()
Specified by:
getVertexSet in interface com.port80.graph.IGraph

getEdgeSet

public java.util.Set getEdgeSet()
Description copied from interface: com.port80.graph.IGraph
Edges in this graph, not including those in subgraph.

Specified by:
getEdgeSet in interface com.port80.graph.IGraph

addVertex

public void addVertex(com.port80.graph.IVertex v)
               throws com.port80.graph.GraphException
Specified by:
addVertex in interface com.port80.graph.IGraph

addAllVertex

public void addAllVertex(java.util.Collection c)
                  throws com.port80.graph.GraphException
Add a collection of IVertex.

Specified by:
addAllVertex in interface com.port80.graph.IGraph

removeVertex

public com.port80.graph.IVertex removeVertex(java.lang.String vname)
Remove a vertex from the graph or its subgraph.

Specified by:
removeVertex in interface com.port80.graph.IGraph

removeVertex

public com.port80.graph.IVertex removeVertex(com.port80.graph.IVertex v)
Specified by:
removeVertex in interface com.port80.graph.IGraph

allVertexNameSet

public java.util.Set allVertexNameSet()
Remove a collection of IVertex.

Specified by:
allVertexNameSet in interface com.port80.graph.IGraph

allVertices

public java.util.Set allVertices()
All vertices under this graph including those in all its nested subgraphs.

Specified by:
allVertices in interface com.port80.graph.IGraph

allEdges

public java.util.Set allEdges()
All edges under this graph including thos in all its nested subgraphs.

Specified by:
allEdges in interface com.port80.graph.IGraph

allEdges

private java.util.Set allEdges(java.util.Set vset,
                               java.util.Set ret)

size

public int size()
Specified by:
size in interface com.port80.graph.IGraph

clearLayout

public void clearLayout()
Remove all layout attributes to prepare for new layout.

Specified by:
clearLayout in interface com.port80.graph.IGraph

containsGraph

public boolean containsGraph(com.port80.graph.IGraph g)
Specified by:
containsGraph in interface com.port80.graph.IGraph

getGraph

public com.port80.graph.IGraph getGraph(com.port80.graph.IGraph g)
Specified by:
getGraph in interface com.port80.graph.IGraph

getSubGraphs

public java.util.List getSubGraphs()
Specified by:
getSubGraphs in interface com.port80.graph.IGraph

findVerticesWithAttr

public java.util.Set findVerticesWithAttr(java.lang.String attrname)
Find vertices with given attribute name.

Specified by:
findVerticesWithAttr in interface com.port80.graph.IGraph

findEdgesWithAttr

public java.util.Set findEdgesWithAttr(java.lang.String attrname)
Specified by:
findEdgesWithAttr in interface com.port80.graph.IGraph

sprintGraph

public java.lang.String sprintGraph()
Specified by:
sprintGraph in interface com.port80.graph.IGraph

sprintEdge

private void sprintEdge(java.lang.StringBuffer ret,
                        com.port80.graph.IEdge e)

appendAttr

private void appendAttr(java.lang.StringBuffer ret,
                        com.port80.util.attr.IAttrTable table,
                        java.lang.String name)

appendAttr

private void appendAttr(java.lang.StringBuffer ret,
                        com.port80.util.attr.IAttrTable table,
                        java.lang.String attrname,
                        java.lang.String name)

printlnAttr

private void printlnAttr(java.lang.StringBuffer buf,
                         com.port80.util.attr.IAttrTable table,
                         java.lang.String name,
                         java.lang.String indent)

printlnAttrs

private void printlnAttrs(java.lang.StringBuffer buf,
                          com.port80.util.attr.IAttrTable table,
                          java.util.Set keys,
                          java.lang.String indent)

saveImage

public boolean saveImage(java.lang.String fname,
                         float scale)
Specified by:
saveImage in interface com.port80.graph.IGraph

getElementTypeName

public java.lang.String getElementTypeName()
Specified by:
getElementTypeName in interface com.port80.graph.IGraphElement
Overrides:
getElementTypeName in class GraphElement