Overview Package Class Tree Deprecated Index Help
PREV CLASS NEXT CLASS FRAMES NO FRAMES All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

diva.graph
Interface GraphModel

All Known Subinterfaces:
MutableGraphModel
All Known Implementing Classes:
AbstractGraphModel, MutableModularGraphModel

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: GraphModel.java,v 1.14 2005年10月24日 19:09:04 cxh Exp $
Author:
Michael Shilman, John Reekie
Accepted Rating:
Yellow

Method Summary
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. it can contain children.
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

public 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

public boolean containsNode(java.lang.Object composite,
 java.lang.Object node)
Return true if this graph or composite node contains the given node.


dispatchGraphEvent

public 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

public java.lang.Object getRoot()
Return the root graph of this graph model.


getHead

public java.lang.Object getHead(java.lang.Object edge)
Return the head node of the given edge.


getNodeCount

public int getNodeCount(java.lang.Object composite)
Return the number of nodes contained in this graph or composite node.


getParent

public java.lang.Object getParent(java.lang.Object node)
Return the parent graph of this node, return null if there is no parent.


getTail

public java.lang.Object getTail(java.lang.Object edge)
Return the tail node of this edge.


getProperty

public 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

public 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

public boolean isComposite(java.lang.Object o)
Return true if the given object is a composite node, i.e. it can contain children.


isDirected

public boolean isDirected(java.lang.Object edge)
Return whether or not this edge is directed.


isEdge

public boolean isEdge(java.lang.Object o)
Return true if the given object is an edge in this model.


isNode

public boolean isNode(java.lang.Object o)
Return true if the given object is a node in this model.


nodes

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public void setSemanticObject(java.lang.Object o,
 java.lang.Object visual)
Set the semantic object corresponding to the given node, composite, or edge.


Overview Package Class Tree Deprecated Index Help
PREV CLASS NEXT CLASS FRAMES NO FRAMES All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

AltStyle によって変換されたページ (->オリジナル) /