net.walend.digraph
Class MutableHashUEDigraph

java.lang.Object
  |
  +--net.walend.digraph.AbstractHashUEDigraph
        |
        +--net.walend.digraph.MutableHashUEDigraph
All Implemented Interfaces:
Digraph, HasState, MutableUEDigraph, java.io.Serializable, UEDigraph

public class MutableHashUEDigraph
extends AbstractHashUEDigraph
implements MutableUEDigraph, java.io.Serializable

Author:
David Walend dfw1@cornell.edu
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class net.walend.digraph.AbstractHashUEDigraph
AbstractHashUEDigraph.HashEdgeIterator, AbstractHashUEDigraph.NodeIterator, AbstractHashUEDigraph.NodePair
 
Field Summary
private static int DEFAULTSIZE
           
 
Fields inherited from class net.walend.digraph.AbstractHashUEDigraph
 
Fields inherited from interface net.walend.digraph.UEDigraph
EMPTY
 
Constructor Summary
MutableHashUEDigraph()
           
MutableHashUEDigraph(int nodeCapacity, int edgeCapacity)
           
MutableHashUEDigraph(UEDigraph digraph)
           
 
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 class net.walend.digraph.AbstractHashUEDigraph
containsEdge, containsEdge, containsEdge, containsEdges, containsNode, containsNodes, containsUEDigraph, countInboundEdges, countOutboundEdges, edgeCount, edgeIterator, edgeNodeIterator, getEdge, getEdges, getFromNode, getFromNodes, getInboundEdges, getNodes, getOutboundEdges, getPrincipleInterface, getToNode, getToNodes, intersectWithUEDigraph, isEdgeFree, isEmpty, nodeCount, nodeIterator, sameStateAs, sameUEDigraphAs, toString, unionUEDigraph
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
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
 

Field Detail

DEFAULTSIZE

private static final int DEFAULTSIZE
See Also:
Constant Field Values
Constructor Detail

MutableHashUEDigraph

public MutableHashUEDigraph()

MutableHashUEDigraph

public MutableHashUEDigraph(int nodeCapacity,
                            int edgeCapacity)

MutableHashUEDigraph

public MutableHashUEDigraph(UEDigraph digraph)
Method Detail

addNode

public boolean addNode(java.lang.Object node)
Description copied from interface: MutableUEDigraph
Return true if the node is added successfully, false if the digraph does not change.

Specified by:
addNode in interface MutableUEDigraph
Overrides:
addNode in class AbstractHashUEDigraph

addEdge

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

Specified by:
addEdge in interface MutableUEDigraph
Overrides:
addEdge in class AbstractHashUEDigraph
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
Description copied from interface: MutableUEDigraph
Return the Set of orphaned edges that are removed with node

Specified by:
removeNode in interface MutableUEDigraph
Overrides:
removeNode in class AbstractHashUEDigraph
Throws:
NodeMissingException - if the node is not in the digraph

removeEdge

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

Specified by:
removeEdge in interface MutableUEDigraph
Overrides:
removeEdge in class AbstractHashUEDigraph

removeEdge

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

Specified by:
removeEdge in interface MutableUEDigraph
Overrides:
removeEdge in class AbstractHashUEDigraph
Throws:
NodeMissingException - if either node is not in the digraph

addNodes

public boolean addNodes(java.util.Set nodes)
Description copied from interface: MutableUEDigraph
Return true if adding the nodes changes the digraph.

Specified by:
addNodes in interface MutableUEDigraph
Overrides:
addNodes in class AbstractHashUEDigraph

removeNodes

public java.util.Set removeNodes(java.util.Set nodes)
Description copied from interface: MutableUEDigraph
Return the Set of edges orphaned edges when these nodes are removed.

Specified by:
removeNodes in interface MutableUEDigraph
Overrides:
removeNodes in class AbstractHashUEDigraph

removeEdges

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

Specified by:
removeEdges in interface MutableUEDigraph
Overrides:
removeEdges in class AbstractHashUEDigraph

removeUEDigraph

public java.util.Set removeUEDigraph(UEDigraph digraph)
Description copied from interface: MutableUEDigraph
Return a Set of edges orphaned when digraph is removed

Specified by:
removeUEDigraph in interface MutableUEDigraph
Overrides:
removeUEDigraph in class AbstractHashUEDigraph

retainNodes

public java.util.Set retainNodes(java.util.Set nodes)
Description copied from interface: MutableUEDigraph
Return a Set of orphaned edges when the nodes are removed.

Specified by:
retainNodes in interface MutableUEDigraph
Overrides:
retainNodes in class AbstractHashUEDigraph

retainEdges

public boolean retainEdges(java.util.Set edges)
Description copied from interface: MutableUEDigraph
Return true if this UEDigraph chages at all, false if not.

Specified by:
retainEdges in interface MutableUEDigraph
Overrides:
retainEdges in class AbstractHashUEDigraph

clear

public void clear()
Description copied from interface: MutableUEDigraph
Remove all nodes and edges from the UEDigraph

Specified by:
clear in interface MutableUEDigraph
Overrides:
clear in class AbstractHashUEDigraph

clearEdges

public void clearEdges()
Description copied from interface: MutableUEDigraph
Remove all the edges from the UEDigraph.

Specified by:
clearEdges in interface MutableUEDigraph
Overrides:
clearEdges in class AbstractHashUEDigraph


Copyright (c) 2001, 2002, David Walend