net.walend.digraph
Class MutableHashCEDigraph

java.lang.Object
  |
  +--net.walend.digraph.AbstractHashCEDigraph
        |
        +--net.walend.digraph.MutableHashCEDigraph
All Implemented Interfaces:
CEDigraph, HasState, MutableCEDigraph

public class MutableHashCEDigraph
extends AbstractHashCEDigraph
implements MutableCEDigraph

Author:
David Walend

Nested Class Summary
 
Nested classes inherited from class net.walend.digraph.AbstractHashCEDigraph
AbstractHashCEDigraph.HashEdgeIterator, AbstractHashCEDigraph.IteratorWrapper, AbstractHashCEDigraph.NodePair
 
Field Summary
private static int DEFAULTSIZE
           
 
Fields inherited from class net.walend.digraph.AbstractHashCEDigraph
 
Fields inherited from interface net.walend.digraph.CEDigraph
EMPTY
 
Constructor Summary
MutableHashCEDigraph()
           
MutableHashCEDigraph(CEDigraph digraph)
           
MutableHashCEDigraph(int nodeCapacity, int edgeCapacity)
           
 
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 class net.walend.digraph.AbstractHashCEDigraph
containsCEDigraph, containsEdge, containsEdge, containsNode, containsNodes, countInboundEdges, countOutboundEdges, edgeCount, edgeIterator, getEdge, getFromNodes, getInboundEdges, getNodes, getOutboundEdges, getPrincipleInterface, getToNodes, intersectWithCEDigraph, isEdgeFree, isEmpty, nodeCount, nodeIterator, sameCEDigraphAs, sameStateAs, toString, unionCEDigraph
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
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
 

Field Detail

DEFAULTSIZE

private static final int DEFAULTSIZE
Constructor Detail

MutableHashCEDigraph

public MutableHashCEDigraph()

MutableHashCEDigraph

public MutableHashCEDigraph(int nodeCapacity,
                            int edgeCapacity)

MutableHashCEDigraph

public MutableHashCEDigraph(CEDigraph digraph)
Method Detail

addNode

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

Specified by:
addNode in interface MutableCEDigraph
Overrides:
addNode in class AbstractHashCEDigraph

addEdge

public java.lang.Object addEdge(java.lang.Object fromNode,
                                java.lang.Object toNode,
                                java.lang.Object edge)
                         throws NodeMissingException
Description copied from interface: MutableCEDigraph
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.

Specified by:
addEdge in interface MutableCEDigraph
Overrides:
addEdge in class AbstractHashCEDigraph

removeNode

public Set removeNode(java.lang.Object node)
               throws NodeMissingException
Description copied from interface: MutableCEDigraph
Return the Set of orphaned edges that are removed with node

Specified by:
removeNode in interface MutableCEDigraph
Overrides:
removeNode in class AbstractHashCEDigraph

removeEdge

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

Specified by:
removeEdge in interface MutableCEDigraph
Overrides:
removeEdge in class AbstractHashCEDigraph

addNodes

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

Specified by:
addNodes in interface MutableCEDigraph
Overrides:
addNodes in class AbstractHashCEDigraph

removeNodes

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

Specified by:
removeNodes in interface MutableCEDigraph
Overrides:
removeNodes in class AbstractHashCEDigraph

removeCEDigraph

public Set removeCEDigraph(CEDigraph digraph)
Description copied from interface: MutableCEDigraph
Return a Set of edges orphaned when digraph is removed

Specified by:
removeCEDigraph in interface MutableCEDigraph
Overrides:
removeCEDigraph in class AbstractHashCEDigraph

retainNodes

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

Specified by:
retainNodes in interface MutableCEDigraph
Overrides:
retainNodes in class AbstractHashCEDigraph

clear

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

Specified by:
clear in interface MutableCEDigraph
Overrides:
clear in class AbstractHashCEDigraph

clearEdges

public void clearEdges()
Description copied from interface: MutableCEDigraph
Remove all the edges from the CEDigraph.

Specified by:
clearEdges in interface MutableCEDigraph
Overrides:
clearEdges in class AbstractHashCEDigraph


Copyright (c) 2000, 2001, David Walend