com.tensegrity.graph.model
Interface Subgraph

All Superinterfaces:
Attributable, AttributableOnSet, GraphObject, GraphObjectContainer, Node

public interface Subgraph
extends Node, GraphObjectContainer

This interface defines a nested Graph that appears to be a single Node from the perspective of its parent. This technique allows unlimited nesting of graphs inside graphs.

Constructing a Subgraph is done by means of a GraphModelFactory, which will hide the particular implementation classes from client code.

Although this interface defines its own operations, instances may be treated as a GraphObject, GraphObjectContainer or Node.

While Subgraphs are Nodes they also have a close similarity to Graphs. They provide a lot of the same methods like GraphObjectContainer.getNodes(), GraphObjectContainer.getEdges() and so on, which work on the underlying graph that is represented by each Subgraph.

Nodes and Edges can be programmatically added to a Subgraph by invoking the methods GraphObjectContainer.addNode(Node) or GraphObjectContainer.addEdge(Edge) respectively.

Since Subgraphs are actually Nodes they can be added to Graphs and to Subgraphss as well. There is no limit on the depth of nesting, except for inevitable memory and resource limits.

The behavior that is specified in Graph concerning the adding and removing of Nodes and Edges applies to any Subgraph as well.

Many methods in this interface specification are inherited from the more generic super-interface GraphObjectContainer, which allows generic handling of both Graphs and Subgraphs.

Version:
$Id: Subgraph.java,v 1.25 2006/02/01 12:28:31 MichaelKegel Exp $
Author:
MichaelKegel, Stepan Rutz
See Also:
Graph, Node, Edge, GraphObjectContainer

Field Summary
 
Fields inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
TREE_SUBSET_POSTFIX
 
Method Summary
 void addGraphListener(GraphListener listener)
          Adds the GraphListener given by listener to the Subgraph's internal structure.
 Subgraph deepCopy(Graph graph)
          Returns a deep copy of the subgraph.
 Graph deepCopyGraph()
          Returns a deep copy of the subgraphs underlying Graph
 Graph getGraphInternal()
          This method is for internal use only.
 Port getPortByWrappedPortID(long id)
          Internal helper method that querries the wrapped ports.
 void removeGraphListener(GraphListener listener)
          Removes the GraphListener given by listener form the Subgraph's internal structure.
 
Methods inherited from interface com.tensegrity.graph.model.Node
addNodeListener, deepCopy, getAdjacentEdges, getAdjacentNodes, getDegree, getInboundEdges, getInboundNodes, getIndegree, getNodeInfo, getOutboundEdges, getOutboundNodes, getOutdegree, getPortByID, getPorts, internalResetPortNumbers, isConnectedFromNode, isConnectedToNode, removeNodeListener, setID, setNodeInfo, setPorts
 
Methods inherited from interface com.tensegrity.graph.model.GraphObject
addCustomAttribute, assertCustomAttribute, assertCustomAttribute, fillInDump, getCustomAttributes, getDescription, getID, getLabel, getParentContainer, getUniqueID, registerEventMediator, registerEventMediatorInternal, registerVetoableEventMediator, removeCustomAttribute, setCustomAttributes, setDescription, setLabel
 
Methods inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
addAttributableOnSetListener, areAttributableEventsEnabled, disableAttributableEvents, enableAttributableEvents, getAttributes, getAttributesTree, removeAttributableOnSetListener, setAttributes, setAttributesTree
 
Methods inherited from interface com.tensegrity.generic.attribute.Attributable
getAttribute, getAttributeType, getAttributeValue, setAttribute, setAttributeValue
 
Methods inherited from interface com.tensegrity.graph.model.GraphObjectContainer
addEdge, addEdges, addNode, addNodes, buildAdjacencyMatrix, disableGraphEvents, disableGraphEventsInternal, enableGraphEvents, enableGraphEventsInternal, findMultiEdge, fireCascadeNodeDeleteInternal, fireEdgeSplitInternal, fireNodePreRemove, fireNodeRemoved, firePreCascadeNodeDeleteInternal, firePreEdgeSplitInternal, getEdgeArray, getEdgeByID, getEdgeCount, getEdges, getEventmask, getEventmaskInternal, getNodeArray, getNodeByID, getNodeCount, getNodes, getObjectByID, getParentContainer, getRootContainer, isDirected, isMultiEdge, isMultiGraph, removeEdge, removeNode, setDirected, setMultiGraph
 

Method Detail

getPortByWrappedPortID

public Port getPortByWrappedPortID(long id)
Internal helper method that querries the wrapped ports.

Parameters:
id - the wrapped id to search for.
Returns:
the found Port or null if none was found.

addGraphListener

public void addGraphListener(GraphListener listener)
Adds the GraphListener given by listener to the Subgraph's internal structure. The GraphListener instance is notified on every event that occurs at the Subgraph

Parameters:
listener - the GraphListener instance to add

removeGraphListener

public void removeGraphListener(GraphListener listener)
Removes the GraphListener given by listener form the Subgraph's internal structure. The GraphListener instance is no longer be notified on the events that occurs at the Subgraph

Parameters:
listener - the GraphListener instance to remove

deepCopy

public Subgraph deepCopy(Graph graph)
Returns a deep copy of the subgraph.

Parameters:
graph - the graph the copy is assoicated with.
Returns:
deep copy of the subgraph.

deepCopyGraph

public Graph deepCopyGraph()
Returns a deep copy of the subgraphs underlying Graph

Returns:
Graph deep copy of the underlying Graph

getGraphInternal

public Graph getGraphInternal()
This method is for internal use only.

Returns:
internal use only.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.