net.walend.digraph
Interface MutableGEDigraph

All Superinterfaces:
GEDigraph, HasState
All Known Implementing Classes:
MutableHashGEDigraph

public interface MutableGEDigraph
extends GEDigraph

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

Since:
20010812
Author:
David Walend

Field Summary
 
Fields inherited from interface net.walend.digraph.GEDigraph
EMPTY
 
Method Summary
 boolean addEdge(java.lang.Object fromNode, java.lang.Object toNode)
          Return true if the digraph changes when this edge is added, false if the digraph is unchanged.
 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 GEDigraph
 void clearEdges()
          Remove all the edges from the GEDigraph.
 boolean removeEdge(java.lang.Object fromNode, java.lang.Object toNode)
          Return true if the digraph changes when the edge is removed, false if the digraph didn't have an edge between these two nodes.
 int removeGEDigraph(GEDigraph digraph)
          Return the number of edges orphaned when digraph is removed
 int removeNode(java.lang.Object node)
          Return the number of orphaned edges that were lost when this node is removed.
 int removeNodes(Set nodes)
          Return the number of edges orphaned edges when these nodes are removed.
 int retainNodes(Set nodes)
          Return the number of orphaned edges when the nodes are removed.
 
Methods inherited from interface net.walend.digraph.GEDigraph
containsEdge, containsGEDigraph, containsNode, containsNodes, countInboundEdges, countOutboundEdges, edgeCount, edgeNodeIterator, getFromNodes, getNodes, getToNodes, intersectWithGEDigraph, isEdgeFree, isEmpty, nodeCount, nodeIterator, sameGEDigraphAs, unionGEDigraph
 
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 boolean addEdge(java.lang.Object fromNode,
                       java.lang.Object toNode)
                throws NodeMissingException
Return true if the digraph changes when this edge is added, false if the digraph is unchanged.

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

removeNode

public int removeNode(java.lang.Object node)
               throws NodeMissingException
Return the number of orphaned edges that were lost when this node is removed.

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

removeEdge

public boolean removeEdge(java.lang.Object fromNode,
                          java.lang.Object toNode)
                   throws NodeMissingException
Return true if the digraph changes when the edge is removed, false if the digraph didn't have an edge between these two nodes.

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 int removeNodes(Set nodes)
Return the number of edges orphaned edges when these nodes are removed.


removeGEDigraph

public int removeGEDigraph(GEDigraph digraph)
Return the number of edges orphaned when digraph is removed


retainNodes

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


clear

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


clearEdges

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



Copyright (c) 2000, 2001, David Walend