

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object jlink.flowchart.graph.JLGraph
public class JLGraph
Implementaion of a graph structure. Used at the core of JLink
to represent the data model of any JLFlowchart
.
A JLGraph
is an ordered pair such that:
JLGraph : (JLVertexSet, JLEdgeSet)
.
JLVertexSet
contains all the vertices associated with this particular graph. JLEdgeSet
contains all the edges
in this current graph (which are ordered pairs of vertices).
The primary focus of JLink
is flow charts. Since flow charts show the flow of a process, the underlying model
is essentially a digraph (directed graph). This is why the JLEdge
class is an ordered pair of vertices. Note
that although this is the default model in JLink
, you can set the JLGraph
property to be undirected. When this is
done, the drawing treats the model as though it was an undirected graph. If you have a digraph that you want
some edges to be undirected, you can try setting individual edge properties in JLEdge
to display no arrow heads
or arrow heads to both head and tail vertices.
JLGraph
keeps an eye on its vertices and edges within the JLVertexSet
and JLEdgeSet
, and provides a model which
JLFlowchart
can use to display a drawing. This drawing is the corresponding Flow Chart representation of the
graph model.
As the JLGraph
component contains all the information about the placing of vertices and edges, layout algorithms
can use it to intelligently place all the elements inside the container of a JLFlowchart
.
JLGraph()
,
JLGraph(int graphType)
,
JLGraph(JLVertexSet v, JLEdgeSet e)
,
JLGraph(int graphType, JLVertexSet v, JLEdgeSet e)
,
JLFlowchart
,
JLVertexSet
,
JLVertex
,
JLEdgeSet
,
JLEdge
Field Summary  

protected boolean 
digraph
Whether this graph is directed or undirected. 
static int 
DIRECTED_GRAPH
Integer constant to set JLGraph to be directed. 
protected JLEdgeSet 
edges
The complete set of edges for this JLGraph . 
static int 
UNDIRECTED_GRAPH
Integer constant to set JLGraph to be undirected. 
protected JLVertexSet 
vertices
The complete set of vertices for this JLGraph 
Constructor Summary  

JLGraph()
Creates a new instance of JLGraph with graph type defaulting to digraph (ie. 

JLGraph(int graphType)
Creates a new instance of JLGraph with user defined graph type (either graph or digraph). 

JLGraph(int graphType,
JLVertexSet v,
JLEdgeSet e)
Fully customisable constructor for JLGraph . 

JLGraph(JLVertexSet v,
JLEdgeSet e)
Creates a new instance of JLGraph with user defined vertices and edges. 
Method Summary  

JLEdge 
createJLEdge(JLVertex headVertex,
JLVertex tailVertex)

JLVertex 
createJLVertex()
Creates a JLVertex and registers it with this JLGraph while providing a
handle to the calling program for the JLVertex that was created. 
void 
createJLVertex(JLVertex v)
While this method can be useful to create a JLVertex and register it inside this JLGraph ,
it is not the preferred method to do so. 
JLEdgeSet 
getJLEdgeSet()
Used to retrieve an edge set ( JLEdgeSet ) from this JLGraph . 
int 
getJLGraphType()
Alternative method to testing whether JLGraph is directed or undirected. 
JLVertexSet 
getJLVertexSet()
Used to retrieve a vertex set ( JLVertexSet ) from this JLGraph . 
boolean 
isDirected()
Tests JLGraph to see if it is a directed graph (digraph) or undirected. 
void 
setDirected(boolean value)
Sets this JLGraph to be directed or undirected. 
void 
setJLEdgeSet(JLEdgeSet edgeSet)
Sets the JLEdgeSet of this JLGraph to the user defined edge set. 
void 
setJLGraphType(int graphType)
Sets this JLGraph type to either a directed or undirected graph depending on which integer
constant is fed into the arguments. 
void 
setJLVertexSet(JLVertexSet vertexSet)
Sets the vertex set of this JLGraph to a user defined JLVertexSet . 
java.lang.String 
toString()
Construct a string representation of this JLGraph . 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 
Field Detail 

protected JLVertexSet vertices
JLGraph
edges
protected JLEdgeSet edges
JLGraph
.The edges stored in this are ordered pairs of vertices by default.
vertices
protected boolean digraph
isDirected()
,
setDirected(boolean value)
public static final int DIRECTED_GRAPH
JLGraph
to be directed.
JLGraph(int graphType)
,
JLGraph(int graphType, JLVertexSet v, JLEdgeSet e)
,
getJLGraphType()
,
setJLGraphType(int graphType)
,
UNDIRECTED_GRAPH
,
Constant Field Valuespublic static final int UNDIRECTED_GRAPH
JLGraph
to be undirected.
JLGraph(int graphType)
,
JLGraph(int graphType, JLVertexSet v, JLEdgeSet e)
,
getJLGraphType()
,
setJLGraphType(int graphType)
,
DIRECTED_GRAPH
,
Constant Field ValuesConstructor Detail 

public JLGraph()
JLGraph
with graph type defaulting to digraph (ie. Directed Graph)
JLGraph(int graphType)
,
JLGraph(JLVertexSet v, JLEdgeSet e)
,
JLGraph(int graphType, JLVertexSet v, JLEdgeSet e)
public JLGraph(int graphType)
JLGraph
with user defined graph type (either graph or digraph).
Use this if you wish to create an undirected graph using the JLink
libraries.
graphType
 Either JLGraph.DIRECTED_GRAPH
or JLGraph.UNDIRECTED_GRAPH
JLGraph()
,
JLGraph(JLVertexSet v, JLEdgeSet e)
,
JLGraph(int graphType, JLVertexSet v, JLEdgeSet e)
,
DIRECTED_GRAPH
,
UNDIRECTED_GRAPH
public JLGraph(JLVertexSet v, JLEdgeSet e)
JLGraph
with user defined vertices and edges.Use this if you wish to create a directed graph using existing vertices and edges.
v
 The user defined vertex set to use in this JLGraph
e
 The user defined edge set to use in this JLGraph
JLGraph()
,
JLGraph(int graphType, JLVertexSet v, JLEdgeSet e)
,
DIRECTED_GRAPH
,
UNDIRECTED_GRAPH
public JLGraph(int graphType, JLVertexSet v, JLEdgeSet e)
JLGraph
. This lets the user specify the vertices, edges and graph type.
graphType
 Either JLGraph.DIRECTED_GRAPH
or JLGraph.UNDIRECTED_GRAPH
v
 The set of vertices to use for this graph (JLGraph
).e
 The set of edges (ordered pairs of vertices) to use for this graph (JLGraph
).JLGraph()
,
JLGraph(int graphType)
,
JLVertexSet
,
JLEdgeSet
,
DIRECTED_GRAPH
,
UNDIRECTED_GRAPH
Method Detail 

public boolean isDirected()
JLGraph
to see if it is a directed graph (digraph) or undirected.
true
if JLGraph
is directed, false
if undirected.public void setDirected(boolean value)
JLGraph
to be directed or undirected.
An alternative method to the above is the setJLGraphType(int graphType)
method which enables
the user to set the graph type using integer constants instead.
value
 If true
this JLGraph
is set to being directed, and if false
undirected.isDirected()
,
setJLGraphType(int graphType)
,
digraph
,
DIRECTED_GRAPH
,
UNDIRECTED_GRAPH
public void setJLGraphType(int graphType)
JLGraph
type to either a directed or undirected graph depending on which integer
constant is fed into the arguments.
graphType
 Either JLGraph.DIRECTED
or JLGraph.UNDIRECTED
setDirected(boolean value)
,
DIRECTED_GRAPH
,
UNDIRECTED_GRAPH
public int getJLGraphType()
JLGraph
is directed or undirected.
JLGraph
integer constant according to the current status of the graphisDirected()
,
DIRECTED_GRAPH
,
UNDIRECTED_GRAPH
,
setJLGraphType(int graphType)
,
setDirected(boolean value)
public void setJLEdgeSet(JLEdgeSet edgeSet)
JLEdgeSet
of this JLGraph
to the user defined edge set.
edgeSet
 The user defined edge set to make as this JLGraph
JLEdgeSetgetJLEdgeSet()
,
setJLVertexSet(JLVertexSet vertexSet)
,
JLEdgeSet
public JLEdgeSet getJLEdgeSet()
JLEdgeSet
) from this JLGraph
.
JLEdgeSet
of this JLGraph
.setJLEdgeSet(JLEdgeSet edgeSet)
,
getJLVertexSet()
,
JLEdgeSet
public void setJLVertexSet(JLVertexSet vertexSet)
JLGraph
to a user defined JLVertexSet
.
vertexSet
 The user defined JLVertexSet
getJLVertexSet()
,
setJLEdgeSet(JLEdgeSet edgeSet)
,
JLVertexSet
public JLVertexSet getJLVertexSet()
JLVertexSet
) from this JLGraph
.
JLVertexSet
)setJLVertexSet(JLVertexSet vertexSet)
,
getJLEdgeSet()
,
JLVertexSet
public JLVertex createJLVertex()
JLVertex
and registers it with this JLGraph
while providing a
handle to the calling program for the JLVertex
that was created.
This is the preferred way of using JLink
to create vertices.
JLVertex
that has been appended to the JLVertexSet
.createJLVertex(JLVertex v)
public void createJLVertex(JLVertex v) throws DuplicateJLVertexException
JLVertex
and register it inside this JLGraph
,
it is not the preferred method to do so. The main reason for this is to clean your code up by
using less exceptions. You are welcome to use it (it is stable) if you don't mind the use of exceptions,
but you will have a bit more typing to do so if you use this method.
v
 The JLVertex
to register with this JLGraph
.
DuplicateJLVertexException
 If a duplicate vertex was found.createJLVertex()
public JLEdge createJLEdge(JLVertex headVertex, JLVertex tailVertex) throws IncompleteJLEdgeException
IncompleteJLEdgeException
public java.lang.String toString()
JLGraph
.
toString
in class java.lang.Object
JLGraph
.


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 