Package diva.graph.modular
Class ModularGraphModel
- java.lang.Object
-
- diva.graph.AbstractGraphModel
-
- diva.graph.modular.ModularGraphModel
-
- All Implemented Interfaces:
GraphModel
- Direct Known Subclasses:
AbstractBasicGraphModel
,MutableModularGraphModel
public abstract class ModularGraphModel extends AbstractGraphModel
A modular implementation of the graph model, whereby users with heterogeneous graphs can implement the graph model interface by implementing the simple interfaces of Graph, Node, CompositeNode, and Edge.- Version:
- $Id$
- Author:
- Michael Shilman
- Pt.AcceptedRating:
- Red
-
-
Field Summary
-
Fields inherited from class diva.graph.AbstractGraphModel
_graphListeners
-
-
Constructor Summary
Constructors Constructor Description ModularGraphModel(java.lang.Object root)
Construct an empty graph model whose root is the given semantic object.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
containsNode(java.lang.Object composite, java.lang.Object node)
Return true if this composite node contains the given node.abstract CompositeModel
getCompositeModel(java.lang.Object composite)
Return the model for the given composite object.abstract EdgeModel
getEdgeModel(java.lang.Object edge)
Return the model for the given edge object.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.abstract NodeModel
getNodeModel(java.lang.Object node)
Return the node model for the given object.java.lang.Object
getParent(java.lang.Object node)
Return the parent graph of this node, return null if there is no parent.abstract 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.abstract java.lang.Object
getSemanticObject(java.lang.Object o)
Return the semantic object corresponding to the given node, edge, or composite.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 in this model, 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 a node 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.abstract 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.abstract void
setSemanticObject(java.lang.Object o, java.lang.Object sem)
Set the semantic object corresponding to the given node, edge, or composite.-
Methods inherited from class diva.graph.AbstractGraphModel
addGraphListener, dispatchGraphEvent, removeGraphListener, setDispatchEnabled
-
-
-
-
Method Detail
-
containsNode
public boolean containsNode(java.lang.Object composite, java.lang.Object node)
Return true if this composite node contains the given node.
-
getCompositeModel
public abstract CompositeModel getCompositeModel(java.lang.Object composite)
Return the model for the given composite object. If the object is not a composite, meaning that it does not contain other nodes, then return null.
-
getEdgeModel
public abstract EdgeModel getEdgeModel(java.lang.Object edge)
Return the model for the given edge object. If the object is not an edge, then return null.
-
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.
-
getNodeModel
public abstract NodeModel getNodeModel(java.lang.Object node)
Return the node model for the given object. If the object is not a node, then return null.
-
getParent
public java.lang.Object getParent(java.lang.Object node)
Return the parent graph of this node, return null if there is no parent.
-
getProperty
public abstract java.lang.Object getProperty(java.lang.Object o, java.lang.String propertyName)
Return the property of the object associated with the given property name.
-
getRoot
public java.lang.Object getRoot()
Return the root graph of this graph model.
-
getSemanticObject
public abstract java.lang.Object getSemanticObject(java.lang.Object o)
Return the semantic object corresponding to the given node, edge, or composite.
-
getTail
public java.lang.Object getTail(java.lang.Object edge)
Return the tail node of this edge.
-
isDirected
public boolean isDirected(java.lang.Object edge)
Return whether or not this edge is directed.
-
isComposite
public boolean isComposite(java.lang.Object o)
Return true if the given object is a composite node in this model, i.e. it contains children.
-
isEdge
public boolean isEdge(java.lang.Object o)
Return true if the given object is a node 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. In this base class, this returns the same iterator as the nodes(Object) method.
-
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. In this base class, this returns an iterator over nothing.
-
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.
-
setProperty
public abstract 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 abstract void setSemanticObject(java.lang.Object o, java.lang.Object sem)
Set the semantic object corresponding to the given node, edge, or composite.
-
-