Graph Common

pl.psnc.graph.util
Class GraphHelper

java.lang.Object
  extended by pl.psnc.graph.util.GraphHelper

public abstract class GraphHelper
extends java.lang.Object

GraphHelper class - set of utility methods for managing graph.

Author:
Dominik Stoklosa (~osa~)
Email address
osa@man.poznan.pl

Constructor Summary
GraphHelper()
           
 
Method Summary
static void connect(org.jgraph.JGraph graph, org.jgraph.graph.PortView source, org.jgraph.graph.PortView target)
          Connect two ports
static int countConcreteVerticles(CustomGraph graph)
          Get number of vertices with defined resource.
static org.jgraph.graph.Port getPort(org.jgraph.graph.PortView portView)
          Get port from the given port view
static org.jgraph.graph.PortView getSourcePortAt(java.awt.geom.Point2D point, org.jgraph.JGraph graph)
          Get source port at the given point
static org.jgraph.graph.PortView getTargetPortAt(java.awt.geom.Point2D point, org.jgraph.JGraph graph)
          Get target port at the given point
static GraphCellObject getUserObject(java.lang.Object cell)
          Get the user object from the given cell
static boolean isEdge(java.lang.Object cell)
          Test whether the given cell is edge
static boolean isEmpty(org.jgraph.JGraph graph)
          Specifies whether graph is empty.
static boolean isPort(java.lang.Object cell)
          Test whether the given cell is port
static boolean isVertex(java.lang.Object cell)
          Test whether the given cell is vertex type
static void validateEdges(CustomGraph graph)
          Checks all the edges.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphHelper

public GraphHelper()
Method Detail

isEmpty

public static boolean isEmpty(org.jgraph.JGraph graph)
Specifies whether graph is empty.

Parameters:
graph - instance of JGraph
Returns:
TRUE when there are no nodes in the graph, false otherwise

getUserObject

public static GraphCellObject getUserObject(java.lang.Object cell)
Get the user object from the given cell

Parameters:
cell - cell object
Returns:
user object or null

validateEdges

public static void validateEdges(CustomGraph graph)
Checks all the edges. If they are not valid - they are removed

Parameters:
graph -

isVertex

public static boolean isVertex(java.lang.Object cell)
Test whether the given cell is vertex type

Parameters:
cell - graph cell
Returns:
true/false

isEdge

public static boolean isEdge(java.lang.Object cell)
Test whether the given cell is edge

Parameters:
cell - graph cell
Returns:
true/false

isPort

public static boolean isPort(java.lang.Object cell)
Test whether the given cell is port

Parameters:
cell - graph cell
Returns:
true/false

countConcreteVerticles

public static int countConcreteVerticles(CustomGraph graph)
Get number of vertices with defined resource.

Parameters:
graph - instance of CustomGraph
Returns:
number of vertices with defined resource

getPort

public static org.jgraph.graph.Port getPort(org.jgraph.graph.PortView portView)
Get port from the given port view

Parameters:
portView - instance of PortView
Returns:
port instance from the given port view, or null

getSourcePortAt

public static org.jgraph.graph.PortView getSourcePortAt(java.awt.geom.Point2D point,
                                                        org.jgraph.JGraph graph)
Get source port at the given point

Parameters:
point - point instance
graph - jgraph instance
Returns:
PortView at the given point

getTargetPortAt

public static org.jgraph.graph.PortView getTargetPortAt(java.awt.geom.Point2D point,
                                                        org.jgraph.JGraph graph)
Get target port at the given point

Parameters:
point - point instance
graph - jgraph instance
Returns:
PortView at the given point

connect

public static void connect(org.jgraph.JGraph graph,
                           org.jgraph.graph.PortView source,
                           org.jgraph.graph.PortView target)
Connect two ports

Parameters:
graph - jgraph instance
source - source port, instance of Port
target - target port, instance of Port

Graph Common

Copyright 2008 by VLAB Dominik Stoklosa