Package diva.graph
Interface GraphModel
-
- All Known Subinterfaces:
MutableGraphModel
- All Known Implementing Classes:
AbstractBasicGraphModel
,AbstractGraphModel
,ActorGraphModel
,BasicGraphModel
,BasicModularGraphModel
,FSMGraphModel
,GTFrameController.GTActorGraphModel
,GTFrameController.GTFSMGraphModel
,ModularGraphModel
,MutableModularGraphModel
,OntologyGraphModel
,OntologySolverGraphModel
public interface GraphModel
A graph model is an abstraction of a graph implementation and a registration point for GraphListeners. A graph model contains a root graph which in turn contains nodes, composite nodes (i.e. nodes that contain other nodes), and edges between nodes.A graph model provides read-only access to a graph. The getRoot() method provides access to the root of a (possibly hierarchically nested) graph. Given that object, nodes() returns an iterator over that graphs contents, and inEdges() and outEdges() can be used to traverse edges. get/setVisited() are utility functions to help with graph traversals.
For read-write access to the graph, use the sub-interface MutableGraphModel.
- Version:
- $Id$
- Author:
- Michael Shilman, John Reekie
- Pt.AcceptedRating:
- Yellow
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addGraphListener(GraphListener l)
Add a graph listener to the model.boolean
containsNode(java.lang.Object composite, java.lang.Object node)
Return true if this graph or composite node contains the given node.void
dispatchGraphEvent(GraphEvent e)
Send an graph event to all of the graph listeners.java.lang.Object
getHead(java.lang.Object edge)
Return the head node of the given edge.int
getNodeCount(java.lang.Object composite)
Return the number of nodes contained in this graph or composite node.java.lang.Object
getParent(java.lang.Object node)
Return the parent graph of this node, return null if there is no parent.java.lang.Object
getProperty(java.lang.Object o, java.lang.String propertyName)
Return the property of the object associated with the given property name.java.lang.Object
getRoot()
Return the root graph of this graph model.java.lang.Object
getSemanticObject(java.lang.Object o)
Return the visual object corresponding to the given node, composite, or edge.java.lang.Object
getTail(java.lang.Object edge)
Return the tail node of this edge.java.util.Iterator
inEdges(java.lang.Object node)
Return an iterator over the in edges of this node.boolean
isComposite(java.lang.Object o)
Return true if the given object is a composite node, i.e.boolean
isDirected(java.lang.Object edge)
Return whether or not this edge is directed.boolean
isEdge(java.lang.Object o)
Return true if the given object is an edge in this model.boolean
isNode(java.lang.Object o)
Return true if the given object is a node in this model.java.util.Iterator
nodes(java.lang.Object composite)
Provide an iterator over the nodes in the given graph or composite node.java.util.Iterator
nodesAfterEdges(java.lang.Object composite)
Provide an iterator over the nodes that should be rendered after to the edges.java.util.Iterator
nodesBeforeEdges(java.lang.Object composite)
Provide an iterator over the nodes that should be rendered prior to the edges.java.util.Iterator
outEdges(java.lang.Object node)
Return an iterator over the out edges of this node.void
removeGraphListener(GraphListener l)
Remove a graph listener from the model so that the listener will no longer be notified of changes to the graph.void
setDispatchEnabled(boolean val)
Turn on/off all event dispatches from this graph model, for use in an inner-loop algorithm.void
setProperty(java.lang.Object o, java.lang.String propertyName, java.lang.Object value)
Set the property of the object associated with the given property name.void
setSemanticObject(java.lang.Object o, java.lang.Object visual)
Set the semantic object corresponding to the given node, composite, or edge.
-
-
-
Method Detail
-
addGraphListener
void addGraphListener(GraphListener l)
Add a graph listener to the model. Graph listeners are notified with a GraphEvent any time the graph is modified.
-
containsNode
boolean containsNode(java.lang.Object composite, java.lang.Object node)
Return true if this graph or composite node contains the given node.
-
dispatchGraphEvent
void dispatchGraphEvent(GraphEvent e)
Send an graph event to all of the graph listeners. This allows manual control of sending graph graph events, or allows the user to send a STRUCTURE_CHANGED after some inner-loop operations.- See Also:
setDispatchEnabled(boolean)
-
getRoot
java.lang.Object getRoot()
Return the root graph of this graph model.
-
getHead
java.lang.Object getHead(java.lang.Object edge)
Return the head node of the given edge.
-
getNodeCount
int getNodeCount(java.lang.Object composite)
Return the number of nodes contained in this graph or composite node.
-
getParent
java.lang.Object getParent(java.lang.Object node)
Return the parent graph of this node, return null if there is no parent.
-
getTail
java.lang.Object getTail(java.lang.Object edge)
Return the tail node of this edge.
-
getProperty
java.lang.Object getProperty(java.lang.Object o, java.lang.String propertyName)
Return the property of the object associated with the given property name. If no property exists with the given name, then return null.
-
getSemanticObject
java.lang.Object getSemanticObject(java.lang.Object o)
Return the visual object corresponding to the given node, composite, or edge. If the object does not have a semantic object, then return null.
-
isComposite
boolean isComposite(java.lang.Object o)
Return true if the given object is a composite node, i.e. it can contain children.
-
isDirected
boolean isDirected(java.lang.Object edge)
Return whether or not this edge is directed.
-
isEdge
boolean isEdge(java.lang.Object o)
Return true if the given object is an edge in this model.
-
isNode
boolean isNode(java.lang.Object o)
Return true if the given object is a node in this model.
-
nodes
java.util.Iterator nodes(java.lang.Object composite)
Provide an iterator over the nodes in the given graph or composite node. This iterator does not necessarily support removal operations.
-
nodesBeforeEdges
java.util.Iterator nodesBeforeEdges(java.lang.Object composite)
Provide an iterator over the nodes that should be rendered prior to the edges. This iterator does not necessarily support removal operations.
-
nodesAfterEdges
java.util.Iterator nodesAfterEdges(java.lang.Object composite)
Provide an iterator over the nodes that should be rendered after to the edges. This iterator does not necessarily support removal operations.
-
inEdges
java.util.Iterator inEdges(java.lang.Object node)
Return an iterator over the in edges of this node. This iterator does not support removal operations. If there are no in-edges, an iterator with no elements is returned.
-
outEdges
java.util.Iterator outEdges(java.lang.Object node)
Return an iterator over the out edges of this node. This iterator does not support removal operations. If there are no out-edges, an iterator with no elements is returned.
-
removeGraphListener
void removeGraphListener(GraphListener l)
Remove a graph listener from the model so that the listener will no longer be notified of changes to the graph.
-
setDispatchEnabled
void setDispatchEnabled(boolean val)
Turn on/off all event dispatches from this graph model, for use in an inner-loop algorithm. When turning dispatch back on again, if the client has made changes that listeners should know about, he should create an appropriate STRUCTURE_CHANGED and dispatch it using the dispatchGraphEvent() method.- See Also:
dispatchGraphEvent(GraphEvent)
-
setProperty
void setProperty(java.lang.Object o, java.lang.String propertyName, java.lang.Object value)
Set the property of the object associated with the given property name.
-
setSemanticObject
void setSemanticObject(java.lang.Object o, java.lang.Object visual)
Set the semantic object corresponding to the given node, composite, or edge.
-
-