net.sourceforge.fluxion.graph
Interface Graph

All Known Subinterfaces:
OWLGraph
All Known Implementing Classes:
AbstractGraph, DefaultGraph

public interface Graph

A graph structure to represent an underlying object model.

Version:
0.1
Author:
Tony Burdett
See Also:
Node

Method Summary
 void accept(GraphVisitor visitor)
          Accept a visit from a GraphVisitor.
 void add(Edge edge)
          Adds the Edge to this graph.
 void add(Node node)
          Adds the Node to this graph
 void addGraphListener(GraphListener listener)
          Add a GraphListener to report on changes to the Graph.
 void cascadeChanges()
          Cascades any changes made to this graph down to the underlying object model.
 boolean contains(Edge edge)
          Returns true if this graph contains the given edge, or false otherwise
 boolean contains(Node node)
          Returns true if this graph contains the given Node, or false otherwise
 java.util.Collection<Node> getAllNodes()
          Returns every Node present within this graph
 java.util.Collection<Edge> getLeadingEdges(Node node)
          Returns the set of edges leading into a given node.
 java.lang.String getName()
          Gets the name of this graph
 Node getNode(java.lang.String name)
          Returns the Node with the given name present within this graph.
 java.util.Collection<Node> getRootNodes()
          Returns all the nodes which are "root" nodes of this graph.
 java.util.Collection<Edge> getTailingEdges(Node node)
          Returns the set of edges which lead out of the given node.
 void remove(Edge edge)
          Removes this Edge from the graph.
 void remove(Node node)
          Removes the Node from this graph.
 void removeAll()
          Removes all Nodes and Edges from this graph
 void removeGraphListener(GraphListener listener)
          Remove a GraphListener from the Graph
 void setAsRoot(Node node)
          Sets this node as the root.
 void setName(java.lang.String name)
          Sets the name of this graph
 

Method Detail

setName

void setName(java.lang.String name)
Sets the name of this graph

Parameters:
name - the name of the graph

getName

java.lang.String getName()
Gets the name of this graph

Returns:
the graph name

add

void add(Node node)
Adds the Node to this graph

Parameters:
node - the Node to be added

remove

void remove(Node node)
Removes the Node from this graph.

Parameters:
node - the Node to be removed

add

void add(Edge edge)
Adds the Edge to this graph. In order to be sucessfully added, the parent and child Nodes of the given Edge should already be present in the graph.

Parameters:
edge - the Edge to be added

remove

void remove(Edge edge)
Removes this Edge from the graph. If these leaves any Nodes without a leading edge, the positional information of this Node will be lost.

Parameters:
edge - the Edge to be removed

removeAll

void removeAll()
Removes all Nodes and Edges from this graph


contains

boolean contains(Node node)
Returns true if this graph contains the given Node, or false otherwise

Parameters:
node - check if this Node exists in the graph
Returns:
true if the graph contains this node

contains

boolean contains(Edge edge)
Returns true if this graph contains the given edge, or false otherwise

Parameters:
edge - check if this Edge exists in the graph
Returns:
returns true if this edge is present in the graph, false otherwise

setAsRoot

void setAsRoot(Node node)
Sets this node as the root. Multiple roots are allowed.

Parameters:
node - the Node to set as a root node.

getRootNodes

java.util.Collection<Node> getRootNodes()
Returns all the nodes which are "root" nodes of this graph. In other words, the nodes which aren't attached to the tail of an edge.

Returns:
the root nodes

getLeadingEdges

java.util.Collection<Edge> getLeadingEdges(Node node)
Returns the set of edges leading into a given node. Normally, it makes sense for there to be only one edge leading into a node, but this is not compulsory. This is a convenience method to allow easy retrieval of the "parent" edges on a node.

Parameters:
node - all edges leading into a node
Returns:
the leading edges

getTailingEdges

java.util.Collection<Edge> getTailingEdges(Node node)
Returns the set of edges which lead out of the given node. This is a convenience method to allow easy retrieval of the "child" edges leading out of any node.

Parameters:
node - gets all tailing edges leading out of this Node
Returns:
the tailing edges

getNode

Node getNode(java.lang.String name)
Returns the Node with the given name present within this graph. If no such node is present, this method will return null.

Parameters:
name - the node name
Returns:
the node with the given name

getAllNodes

java.util.Collection<Node> getAllNodes()
Returns every Node present within this graph

Returns:
all nodes in this graph

cascadeChanges

void cascadeChanges()
Cascades any changes made to this graph down to the underlying object model. This allows the graph model to be changed independently from the underlying object model, and changes only cacaded down when the user is happy with these changes.


accept

void accept(GraphVisitor visitor)
Accept a visit from a GraphVisitor.

Parameters:
visitor - the GraphVisitor visiting this graph

addGraphListener

void addGraphListener(GraphListener listener)
Add a GraphListener to report on changes to the Graph.

Parameters:
listener - the listener to add

removeGraphListener

void removeGraphListener(GraphListener listener)
Remove a GraphListener from the Graph

Parameters:
listener - the listener to remove


Copyright © 2010. All Rights Reserved.