common
Class AbstractDGraph

java.lang.Object
  extended by common.AbstractDGraph
All Implemented Interfaces:
DGraph
Direct Known Subclasses:
DefaultDGraph, ObjGenGraph, ParentUpdateDGraph

public abstract class AbstractDGraph
extends java.lang.Object
implements DGraph

Abstract implementation of the DGraph interface.


Field Summary
 
Fields inherited from interface common.DGraph
EMPTY_GRAPH
 
Constructor Summary
AbstractDGraph()
           
 
Method Summary
 void addEdge(java.lang.Object parent, java.lang.Object child)
          Throws an UnsupportedOperationException.
 boolean addNode(java.lang.Object v)
          Throws an UnsupportedOperationException.
 java.util.Set getAncestors(java.lang.Object v)
          Returns the set of ancestors of the given node, including the node itself.
 java.util.Set getDescendants(java.lang.Object v)
          Returns the set of descendants of the given node, including the node itself.
 java.util.Set getRoots()
          Returns the set of nodes in this graph that have no parents.
 void print(java.io.PrintStream s)
          Prints a description of this graph to the given stream.
 void removeEdge(java.lang.Object parent, java.lang.Object child)
          Throws an UnsupportedOperationException.
 boolean removeNode(java.lang.Object v)
          Throws an UnsupportedOperationException.
 void setParents(java.lang.Object v, java.util.Set newParents)
          Implements setParents in terms of addEdge and removeEdge.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface common.DGraph
getChildren, getParents, nodes
 

Constructor Detail

AbstractDGraph

public AbstractDGraph()
Method Detail

addNode

public boolean addNode(java.lang.Object v)
Throws an UnsupportedOperationException.

Specified by:
addNode in interface DGraph
Returns:
true if the node was actually added; false if it was already in the graph

removeNode

public boolean removeNode(java.lang.Object v)
Throws an UnsupportedOperationException.

Specified by:
removeNode in interface DGraph
Returns:
true if the node was actually removed; false if it was not in the graph

addEdge

public void addEdge(java.lang.Object parent,
                    java.lang.Object child)
Throws an UnsupportedOperationException.

Specified by:
addEdge in interface DGraph

removeEdge

public void removeEdge(java.lang.Object parent,
                       java.lang.Object child)
Throws an UnsupportedOperationException.

Specified by:
removeEdge in interface DGraph

setParents

public void setParents(java.lang.Object v,
                       java.util.Set newParents)
Implements setParents in terms of addEdge and removeEdge.

Specified by:
setParents in interface DGraph

getRoots

public java.util.Set getRoots()
Description copied from interface: DGraph
Returns the set of nodes in this graph that have no parents.

Specified by:
getRoots in interface DGraph
Returns:
unmodifiable Set of Object

getAncestors

public java.util.Set getAncestors(java.lang.Object v)
Description copied from interface: DGraph
Returns the set of ancestors of the given node, including the node itself.

Specified by:
getAncestors in interface DGraph
Returns:
unmodifiable Set of Object

getDescendants

public java.util.Set getDescendants(java.lang.Object v)
Description copied from interface: DGraph
Returns the set of descendants of the given node, including the node itself.

Specified by:
getDescendants in interface DGraph
Returns:
unmodifiable Set of Object

print

public void print(java.io.PrintStream s)
Description copied from interface: DGraph
Prints a description of this graph to the given stream.

Specified by:
print in interface DGraph