net.walend.digraph
Class MutableLMCEDigraph
java.lang.Object
|
+--net.walend.digraph.AbstractMatrixCEDigraph
|
+--net.walend.digraph.AbstractLMCEDigraph
|
+--net.walend.digraph.MutableLMCEDigraph
- All Implemented Interfaces:
- CEDigraph, Digraph, HasState, IndexedCEDigraph, IndexedDigraph, IndexedMutableCEDigraph, MutableCEDigraph, java.io.Serializable
- public class MutableLMCEDigraph
- extends AbstractLMCEDigraph
- implements IndexedMutableCEDigraph, java.io.Serializable
- Author:
- David Walend dfw1@cornell.edu
- See Also:
- Serialized Form
Method Summary |
java.lang.Object |
addEdge(int fromIndex,
int toIndex,
java.lang.Object edge)
|
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 CEDigraph |
void |
clearEdges()
Remove all the edges from the CEDigraph. |
Bag |
removeCEDigraph(CEDigraph digraph)
Return a Bag of edges orphaned when digraph is removed |
java.lang.Object |
removeEdge(int fromIndex,
int toIndex)
|
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. |
Bag |
removeNode(int index)
|
Bag |
removeNode(java.lang.Object node)
Return the Bag of orphaned edges that are removed with node |
Bag |
removeNodes(java.util.Set nodes)
Return the Bag of edges orphaned edges when these nodes are removed. |
Bag |
retainNodes(java.util.Set nodes)
Return a Bag of orphaned edges when the nodes are removed. |
java.lang.Object |
setNode(int index,
java.lang.Object node)
|
Methods inherited from class net.walend.digraph.AbstractMatrixCEDigraph |
containsCEDigraph, containsEdge, containsEdge, containsEdge, containsEdge, containsNode, containsNode, containsNodes, countInboundEdges, countOutboundEdges, countOutboundEdges, edgeCount, edgeNodeIterator, getEdge, getEdge, getEdges, getFromNodes, getFromNodes, getInboundEdges, getNode, getNodeIndex, getNodes, getOutboundEdges, getOutboundEdges, getPrincipleInterface, getToIndices, getToNodes, getToNodes, indexedEdgeNodeIterator, indexedNodeIterator, insureCapacity, intersectWithCEDigraph, isEdgeFree, isEmpty, nodeCapacity, nodeCount, nodeIndices, 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.Digraph |
containsEdge, containsNode, containsNodes, countInboundEdges, countOutboundEdges, edgeCount, edgeNodeIterator, getFromNodes, getNodes, getToNodes, isEdgeFree, isEmpty, nodeCount, nodeIterator |
Methods inherited from interface net.walend.digraph.IndexedDigraph |
containsEdge, containsNode, countInboundEdges, countOutboundEdges, getFromIndices, getFromNodes, getNode, getNodeIndex, getToIndices, getToNodes, indexedEdgeNodeIterator, indexedNodeIterator, nodeCapacity, nodeIndices |
DEFAULTSIZE
private static final int DEFAULTSIZE
- See Also:
- Constant Field Values
MutableLMCEDigraph
public MutableLMCEDigraph()
MutableLMCEDigraph
public MutableLMCEDigraph(int nodeCapacity)
MutableLMCEDigraph
public MutableLMCEDigraph(CEDigraph digraph)
MutableLMCEDigraph
public MutableLMCEDigraph(UEDigraph digraph)
MutableLMCEDigraph
public MutableLMCEDigraph(GEDigraph digraph,
java.lang.Object edge)
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 AbstractMatrixCEDigraph
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 no existing edge is displaced by edge. Otherwise, return the edge that is displaced.
- Specified by:
addEdge
in interface MutableCEDigraph
- Overrides:
addEdge
in class AbstractMatrixCEDigraph
- Throws:
NodeMissingException
- if either node is not in the digraph.
removeNode
public Bag removeNode(java.lang.Object node)
throws NodeMissingException
- Description copied from interface:
MutableCEDigraph
- Return the Bag of orphaned edges that are removed with node
- Specified by:
removeNode
in interface MutableCEDigraph
- Overrides:
removeNode
in class AbstractMatrixCEDigraph
- 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
- 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 AbstractMatrixCEDigraph
- Throws:
NodeMissingException
- if either node is not in the digraph
addNodes
public boolean addNodes(java.util.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 AbstractMatrixCEDigraph
removeNodes
public Bag removeNodes(java.util.Set nodes)
- Description copied from interface:
MutableCEDigraph
- Return the Bag of edges orphaned edges when these nodes are removed.
- Specified by:
removeNodes
in interface MutableCEDigraph
- Overrides:
removeNodes
in class AbstractMatrixCEDigraph
removeCEDigraph
public Bag removeCEDigraph(CEDigraph digraph)
- Description copied from interface:
MutableCEDigraph
- Return a Bag of edges orphaned when digraph is removed
- Specified by:
removeCEDigraph
in interface MutableCEDigraph
- Overrides:
removeCEDigraph
in class AbstractMatrixCEDigraph
retainNodes
public Bag retainNodes(java.util.Set nodes)
- Description copied from interface:
MutableCEDigraph
- Return a Bag of orphaned edges when the nodes are removed.
- Specified by:
retainNodes
in interface MutableCEDigraph
- Overrides:
retainNodes
in class AbstractMatrixCEDigraph
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 AbstractMatrixCEDigraph
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 AbstractLMCEDigraph
setNode
public java.lang.Object setNode(int index,
java.lang.Object node)
- Specified by:
setNode
in interface IndexedMutableCEDigraph
- Overrides:
setNode
in class AbstractMatrixCEDigraph
- Throws:
java.lang.ArrayIndexOutOfBoundsException
- if index does not have a node. Use nodeIndicies() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.
addEdge
public java.lang.Object addEdge(int fromIndex,
int toIndex,
java.lang.Object edge)
- Specified by:
addEdge
in interface IndexedMutableCEDigraph
- Overrides:
addEdge
in class AbstractLMCEDigraph
- Throws:
java.lang.ArrayIndexOutOfBoundsException
- if index does not have a node. Use nodeIndicies() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.
removeNode
public Bag removeNode(int index)
- Specified by:
removeNode
in interface IndexedMutableCEDigraph
- Overrides:
removeNode
in class AbstractLMCEDigraph
- Throws:
java.lang.ArrayIndexOutOfBoundsException
- if index does not have a node. Use nodeIndicies() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.
removeEdge
public java.lang.Object removeEdge(int fromIndex,
int toIndex)
- Specified by:
removeEdge
in interface IndexedMutableCEDigraph
- Overrides:
removeEdge
in class AbstractLMCEDigraph
- Throws:
java.lang.ArrayIndexOutOfBoundsException
- if index does not have a node. Use nodeIndicies() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.
Copyright (c) 2001, 2002, David Walend