public interface GraphModel
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.
Modifier and Type | Method and 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. 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.
|
void addGraphListener(GraphListener l)
boolean containsNode(java.lang.Object composite, java.lang.Object node)
void dispatchGraphEvent(GraphEvent e)
setDispatchEnabled(boolean)
java.lang.Object getRoot()
java.lang.Object getHead(java.lang.Object edge)
int getNodeCount(java.lang.Object composite)
java.lang.Object getParent(java.lang.Object node)
java.lang.Object getTail(java.lang.Object edge)
java.lang.Object getProperty(java.lang.Object o, java.lang.String propertyName)
java.lang.Object getSemanticObject(java.lang.Object o)
boolean isComposite(java.lang.Object o)
boolean isDirected(java.lang.Object edge)
boolean isEdge(java.lang.Object o)
boolean isNode(java.lang.Object o)
java.util.Iterator nodes(java.lang.Object composite)
java.util.Iterator nodesBeforeEdges(java.lang.Object composite)
java.util.Iterator nodesAfterEdges(java.lang.Object composite)
java.util.Iterator inEdges(java.lang.Object node)
java.util.Iterator outEdges(java.lang.Object node)
void removeGraphListener(GraphListener l)
void setDispatchEnabled(boolean val)
dispatchGraphEvent(GraphEvent)
void setProperty(java.lang.Object o, java.lang.String propertyName, java.lang.Object value)
void setSemanticObject(java.lang.Object o, java.lang.Object visual)