diva.graph.modular
Class ModularGraphModel

java.lang.Object
  extended by diva.graph.AbstractGraphModel
      extended by diva.graph.modular.ModularGraphModel
All Implemented Interfaces:
GraphModel
Direct Known Subclasses:
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:
$Revision: 1.14 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu)

Field Summary
 
Fields inherited from class diva.graph.AbstractGraphModel
_graphListeners
 
Constructor Summary
ModularGraphModel(Object root)
          Construct an empty graph model whose root is the given semantic object.
 
Method Summary
 boolean containsNode(Object composite, Object node)
          Return true if this composite node contains the given node.
abstract  CompositeModel getCompositeModel(Object composite)
          Return the model for the given composite object.
abstract  EdgeModel getEdgeModel(Object edge)
          Return the model for the given edge object.
 Object getHead(Object edge)
          Return the head node of the given edge.
 int getNodeCount(Object composite)
          Return the number of nodes contained in this graph or composite node.
abstract  NodeModel getNodeModel(Object node)
          Return the node model for the given object.
 Object getParent(Object node)
          Return the parent graph of this node, return null if there is no parent.
abstract  Object getProperty(Object o, String propertyName)
          Return the property of the object associated with the given property name.
 Object getRoot()
          Return the root graph of this graph model.
abstract  Object getSemanticObject(Object o)
          Return the semantic object correspoding to the given node, edge, or composite.
 Object getTail(Object edge)
          Return the tail node of this edge.
 Iterator inEdges(Object node)
          Return an iterator over the in edges of this node.
 boolean isComposite(Object o)
          Return true if the given object is a composite node in this model, i.e.
 boolean isDirected(Object edge)
          Return whether or not this edge is directed.
 boolean isEdge(Object o)
          Return true if the given object is a node in this model.
 boolean isNode(Object o)
          Return true if the given object is a node in this model.
 Iterator nodes(Object composite)
          Provide an iterator over the nodes in the given graph or composite node.
 Iterator outEdges(Object node)
          Return an iterator over the out edges of this node.
abstract  void setProperty(Object o, String propertyName, Object value)
          Set the property of the object associated with the given property name.
abstract  void setSemanticObject(Object o, Object sem)
          Set the semantic object correspoding to the given node, edge, or composite.
 
Methods inherited from class diva.graph.AbstractGraphModel
addGraphListener, dispatchGraphEvent, removeGraphListener, setDispatchEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModularGraphModel

public ModularGraphModel(Object root)
Construct an empty graph model whose root is the given semantic object.

Method Detail

containsNode

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


getCompositeModel

public abstract CompositeModel getCompositeModel(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(Object edge)
Return the model for the given edge object. If the object is not an edge, then return null.


getHead

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


getNodeCount

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


getNodeModel

public abstract NodeModel getNodeModel(Object node)
Return the node model for the given object. If the object is not a node, then return null.


getParent

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


getProperty

public abstract Object getProperty(Object o,
                                   String propertyName)
Return the property of the object associated with the given property name.


getRoot

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


getSemanticObject

public abstract Object getSemanticObject(Object o)
Return the semantic object correspoding to the given node, edge, or composite.


getTail

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


isDirected

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


isComposite

public boolean isComposite(Object o)
Return true if the given object is a composite node in this model, i.e. it contains children.


isEdge

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


isNode

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


nodes

public Iterator nodes(Object composite)
Provide an iterator over the nodes in the given graph or composite node. This iterator does not necessarily support removal operations.


inEdges

public Iterator inEdges(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 Iterator outEdges(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(Object o,
                                 String propertyName,
                                 Object value)
Set the property of the object associated with the given property name.


setSemanticObject

public abstract void setSemanticObject(Object o,
                                       Object sem)
Set the semantic object correspoding to the given node, edge, or composite.



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.