net.walend.digraph
Interface MutableCEDigraph

All Superinterfaces:
CEDigraph, HasState
All Known Implementing Classes:
MutableHashCEDigraph

public interface MutableCEDigraph
extends CEDigraph

MutableCEDigraph adds mutators to the CEDigraph 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 CEDigraph, a constructor that supplies arguments for the initial number of nodes and edges as appropriate, and a copy constructor that has a single CEDigraph as a parameter. This last constructor should copy the digraph into itself.

Since:
20010612
Author:
David Walend

Field Summary
 
Fields inherited from interface net.walend.digraph.CEDigraph
EMPTY
 
Method Summary
 java.lang.Object addEdge(java.lang.Object fromNode, java.lang.Object toNode, java.lang.Object edge)
          Return null if fromNode or toNode are not in this CEDigraph, or 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(Set nodes)
          Return true if adding the nodes changes the digraph.
 void clear()
          Remove all nodes and edges from the CEDigraph
 void clearEdges()
          Remove all the edges from the CEDigraph.
 Set removeCEDigraph(CEDigraph digraph)
          Return a Set of edges orphaned when digraph is removed
 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.
 Set removeNode(java.lang.Object node)
          Return the Set of orphaned edges that are removed with node
 Set removeNodes(Set nodes)
          Return the Set of edges orphaned edges when these nodes are removed.
 Set retainNodes(Set nodes)
          Return a Set of orphaned edges when the nodes are removed.
 
Methods inherited from interface net.walend.digraph.CEDigraph
containsCEDigraph, containsEdge, containsEdge, containsNode, containsNodes, countInboundEdges, countOutboundEdges, edgeCount, edgeIterator, getEdge, getFromNodes, getInboundEdges, getNodes, getOutboundEdges, getToNodes, intersectWithCEDigraph, isEdgeFree, isEmpty, nodeCount, nodeIterator, sameCEDigraphAs, unionCEDigraph
 
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
Return null if fromNode or toNode are not in this CEDigraph, or 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.

removeNode

public 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 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(Set nodes)
Return true if adding the nodes changes the digraph.


removeNodes

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


removeCEDigraph

public Set removeCEDigraph(CEDigraph digraph)
Return a Set of edges orphaned when digraph is removed


retainNodes

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


clear

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


clearEdges

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



Copyright (c) 2000, 2001, David Walend