net.walend.digraph
Interface MutableUEDigraph

All Superinterfaces:
Digraph, HasState, UEDigraph
All Known Implementing Classes:
MutableHashUEDigraph, MutableMatrixUEDigraph

public interface MutableUEDigraph
extends UEDigraph

MutableUEDigraph adds mutators to the UEDigraph interface so that a developer can add and remove edges and nodes.

Implementations should provide three constructors: a constructor with no arguments that creates a reasonably small UEDigraph, a constructor that supplies arguments for the initial number of nodes and edges as appropriate, and a copy constructor that has a single UEDigraph as a parameter. This last constructor should copy the digraph into itself.

Since:
20010612
Author:
David Walend dfw1@cornell.edu

Field Summary
 
Fields inherited from interface net.walend.digraph.UEDigraph
EMPTY
 
Method Summary
 java.lang.Object addEdge(java.lang.Object fromNode, java.lang.Object toNode, java.lang.Object edge)
          Return null if no existing edge is displaced by edge.
 boolean addNode(java.lang.Object node)
          Return true if the node is added successfully, false if the digraph does not change.
 boolean addNodes(java.util.Set nodes)
          Return true if adding the nodes changes the digraph.
 void clear()
          Remove all nodes and edges from the UEDigraph
 void clearEdges()
          Remove all the edges from the UEDigraph.
 boolean removeEdge(java.lang.Object edge)
          Return true if this edge existed in the digraph, false if this operation doesn't change the digraph at all.
 java.lang.Object removeEdge(java.lang.Object fromNode, java.lang.Object toNode)
          Return the edge that connected fromNode to toNode, or null if no edge existed.
 boolean removeEdges(java.util.Set edges)
          Return true if any edges were removed from the digraph.
 java.util.Set removeNode(java.lang.Object node)
          Return the Set of orphaned edges that are removed with node
 java.util.Set removeNodes(java.util.Set nodes)
          Return the Set of edges orphaned edges when these nodes are removed.
 java.util.Set removeUEDigraph(UEDigraph digraph)
          Return a Set of edges orphaned when digraph is removed
 boolean retainEdges(java.util.Set edges)
          Return true if this UEDigraph chages at all, false if not.
 java.util.Set retainNodes(java.util.Set nodes)
          Return a Set of orphaned edges when the nodes are removed.
 
Methods inherited from interface net.walend.digraph.UEDigraph
containsEdge, containsEdge, containsEdges, containsUEDigraph, edgeIterator, getEdge, getEdges, getFromNode, getInboundEdges, getOutboundEdges, getToNode, intersectWithUEDigraph, sameUEDigraphAs, unionUEDigraph
 
Methods inherited from interface net.walend.digraph.Digraph
containsEdge, containsNode, containsNodes, countInboundEdges, countOutboundEdges, edgeCount, edgeNodeIterator, getFromNodes, getNodes, getToNodes, isEdgeFree, isEmpty, nodeCount, nodeIterator
 
Methods inherited from interface net.walend.collection.HasState
getPrincipleInterface, sameStateAs
 

Method Detail

addNode

public boolean addNode(java.lang.Object node)
Return true if the node is added successfully, false if the digraph does not change.


addEdge

public java.lang.Object addEdge(java.lang.Object fromNode,
                                java.lang.Object toNode,
                                java.lang.Object edge)
                         throws NodeMissingException,
                                EdgeNotUniqueException
Return null if no existing edge is displaced by edge. Otherwise, return the edge that is displaced.

Throws:
NodeMissingException - if either node is not in the digraph.
EdgeNotUniqueException - if the edge is already in the digraph.

removeNode

public java.util.Set removeNode(java.lang.Object node)
                         throws NodeMissingException
Return the Set of orphaned edges that are removed with node

Throws:
NodeMissingException - if the node is not in the digraph

removeEdge

public boolean removeEdge(java.lang.Object edge)
Return true if this edge existed in the digraph, false if this operation doesn't change the digraph at all.


removeEdge

public java.lang.Object removeEdge(java.lang.Object fromNode,
                                   java.lang.Object toNode)
                            throws NodeMissingException
Return the edge that connected fromNode to toNode, or null if no edge existed.

Throws:
NodeMissingException - if either node is not in the digraph

addNodes

public boolean addNodes(java.util.Set nodes)
Return true if adding the nodes changes the digraph.


removeNodes

public java.util.Set removeNodes(java.util.Set nodes)
Return the Set of edges orphaned edges when these nodes are removed.


removeEdges

public boolean removeEdges(java.util.Set edges)
Return true if any edges were removed from the digraph. False if not.


removeUEDigraph

public java.util.Set removeUEDigraph(UEDigraph digraph)
Return a Set of edges orphaned when digraph is removed


retainNodes

public java.util.Set retainNodes(java.util.Set nodes)
Return a Set of orphaned edges when the nodes are removed.


retainEdges

public boolean retainEdges(java.util.Set edges)
Return true if this UEDigraph chages at all, false if not.


clear

public void clear()
Remove all nodes and edges from the UEDigraph


clearEdges

public void clearEdges()
Remove all the edges from the UEDigraph.



Copyright (c) 2001, 2002, David Walend