|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--net.walend.digraph.path.AbstractDelegateDigraphOfGEPaths
This class implements the DigraphOfGEPaths by delegating to an underlying IndexedMutableCEDigraph. Use it for the results of algorithms like the Floyd-Warshall algorithm that rely on quick manipulation of data in the matrix.
| Nested Class Summary | |
protected class |
AbstractDelegateDigraphOfGEPaths.ADDOCEPIndexedEdgeIterator
|
protected static class |
AbstractDelegateDigraphOfGEPaths.DigraphGEPath
|
protected static class |
AbstractDelegateDigraphOfGEPaths.Edge
|
| Field Summary | |
private IndexedGEDigraph |
base
|
private IndexedMutableCEDigraph |
delegate
|
| Fields inherited from interface net.walend.digraph.CEDigraph |
EMPTY |
| Constructor Summary | |
AbstractDelegateDigraphOfGEPaths(IndexedGEDigraph ceDigraph)
|
|
AbstractDelegateDigraphOfGEPaths(IndexedGEDigraph ceDigraph,
IndexedMutableCEDigraph delegate)
|
|
| Method Summary | |
protected AbstractDelegateDigraphOfGEPaths.Edge |
addEdge(java.lang.Object fromNode,
java.lang.Object toNode,
AbstractDelegateDigraphOfGEPaths.Edge edge)
If no existing edge is displaced by edge. |
protected void |
clearEdges()
Remove all the edges from the CEDigraph. |
boolean |
containsCEDigraph(CEDigraph digraph)
Returns true if digraph is a subgraph of this CEDigraph. |
boolean |
containsEdge(int fromIndex,
int toIndex)
|
boolean |
containsEdge(int fromIndex,
int toIndex,
java.lang.Object edge)
|
boolean |
containsEdge(java.lang.Object fromNode,
java.lang.Object toNode)
Returns true if the digraph contains any edge from fromNode to toNode |
boolean |
containsEdge(java.lang.Object fromNode,
java.lang.Object toNode,
java.lang.Object edge)
Returns true if edge links fromNode to toNode |
boolean |
containsNode(int index)
|
boolean |
containsNode(java.lang.Object node)
|
boolean |
containsNodes(java.util.Set nodes)
|
int |
countInboundEdges(int index)
|
int |
countInboundEdges(java.lang.Object node)
|
int |
countOutboundEdges(int index)
|
int |
countOutboundEdges(java.lang.Object node)
|
int |
edgeCount()
|
EdgeIterator |
edgeIterator()
|
EdgeNodeIterator |
edgeNodeIterator()
Returns an iterator that iterates across pairs of nodes that make edges. |
IndexedGEDigraph |
getBase()
|
protected IndexedMutableCEDigraph |
getDelegate()
|
java.lang.Object |
getEdge(int fromIndex,
int toIndex)
|
java.lang.Object |
getEdge(java.lang.Object fromNode,
java.lang.Object toNode)
Returns null if no edge links fromNode to toNode |
Bag |
getEdges()
|
int[] |
getFromIndices(int index)
|
java.util.Set |
getFromNodes(int index)
|
java.util.Set |
getFromNodes(java.lang.Object node)
Returns the set of nodes that can reach this node by crossing one edge. |
Bag |
getInboundEdges(int index)
|
Bag |
getInboundEdges(java.lang.Object node)
Returns the empty set if node has no inbound edges. |
java.lang.Object |
getNode(int index)
|
int |
getNodeIndex(java.lang.Object node)
|
java.util.Set |
getNodes()
|
Bag |
getOutboundEdges(int index)
|
Bag |
getOutboundEdges(java.lang.Object node)
Returns the empty set if node has no outbound edges. |
GEPath |
getPath(int fromIndex,
int toIndex)
|
GEPath |
getPath(java.lang.Object fromNode,
java.lang.Object toNode)
|
java.lang.Class |
getPrincipleInterface()
Returns the class's principle interface for state comparisons. |
int[] |
getToIndices(int index)
|
java.util.Set |
getToNodes(int index)
|
java.util.Set |
getToNodes(java.lang.Object node)
Returns the set of nodes that can be reached from this node by crossing one edge. |
IndexedEdgeIterator |
indexedEdgeIterator()
|
IndexedEdgeNodeIterator |
indexedEdgeNodeIterator()
|
IndexedIterator |
indexedNodeIterator()
|
protected void |
initWithNodesFrom(IndexedGEDigraph digraph)
Initialize this with the nodes from digraph at the same index values as in digraph. |
CEDigraph |
intersectWithCEDigraph(CEDigraph digraph)
Returns a new digraph that is the intersection of this with digraph. |
boolean |
isEdgeFree()
Returns true if this Digraph has no edges. |
boolean |
isEmpty()
|
int |
nodeCapacity()
Returns the maximum capacity for nodes in this IndexedDigraph. |
int |
nodeCount()
|
int[] |
nodeIndices()
Returns an array if ints that show which node indices are being used. |
java.util.Iterator |
nodeIterator()
Implementations should explicitly state how they interpret nodeIterator()'s remove method. |
boolean |
sameCEDigraphAs(CEDigraph digraph)
Returns true if digraph is the same as this that is, if this.containsCEDigraph(digraph) and digraph.containsCEDigraph(this). |
boolean |
sameStateAs(HasState victim)
If two HasStates have the same internal state, return true. |
CEDigraph |
unionCEDigraph(CEDigraph digraph)
Returns a new digraph that is the union of this with digraph. |
boolean |
valid()
Checks to make sure all the nodes and edges in the path still exist in the base digraph. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private IndexedGEDigraph base
private IndexedMutableCEDigraph delegate
| Constructor Detail |
public AbstractDelegateDigraphOfGEPaths(IndexedGEDigraph ceDigraph)
public AbstractDelegateDigraphOfGEPaths(IndexedGEDigraph ceDigraph,
IndexedMutableCEDigraph delegate)
| Method Detail |
protected void initWithNodesFrom(IndexedGEDigraph digraph)
protected IndexedMutableCEDigraph getDelegate()
public GEPath getPath(java.lang.Object fromNode,
java.lang.Object toNode)
throws NodeMissingException
getPath in interface DigraphOfGEPathsNodeMissingException
public GEPath getPath(int fromIndex,
int toIndex)
getPath in interface DigraphOfGEPathspublic boolean valid()
DigraphOfGEPaths
valid in interface DigraphOfGEPathspublic IndexedGEDigraph getBase()
getBase in interface DigraphOfGEPaths
protected AbstractDelegateDigraphOfGEPaths.Edge addEdge(java.lang.Object fromNode,
java.lang.Object toNode,
AbstractDelegateDigraphOfGEPaths.Edge edge)
throws NodeMissingException,
EdgeNotUniqueException
NodeMissingException - if either node is not in the digraph.
EdgeNotUniqueException - if the edge is already in the digraph.protected void clearEdges()
public int nodeCapacity()
nodeCapacity in interface IndexedDigraphpublic int[] nodeIndices()
nodeIndices in interface IndexedDigraphpublic boolean containsNode(int index)
containsNode in interface IndexedDigraphjava.lang.ArrayIndexOutOfBoundsException - if index does not have a node. Use nodeIndices() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.public java.lang.Object getNode(int index)
getNode in interface IndexedDigraphjava.lang.ArrayIndexOutOfBoundsException - if index does not have a node. Use nodeIndices() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.
public int getNodeIndex(java.lang.Object node)
throws NodeMissingException
getNodeIndex in interface IndexedDigrapha - NodeMissingException if the node is not in the digraph.
NodeMissingException
public boolean containsEdge(int fromIndex,
int toIndex)
containsEdge in interface IndexedDigraphjava.lang.ArrayIndexOutOfBoundsException - if index does not have a node. Use nodeIndices() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.public int countInboundEdges(int index)
countInboundEdges in interface IndexedDigraphjava.lang.ArrayIndexOutOfBoundsException - if index does not have a node. Use nodeIndices() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.public int countOutboundEdges(int index)
countOutboundEdges in interface IndexedDigraphjava.lang.ArrayIndexOutOfBoundsException - if index does not have a node. Use nodeIndices() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.public java.util.Set getFromNodes(int index)
getFromNodes in interface IndexedDigraphjava.lang.ArrayIndexOutOfBoundsException - if index does not have a node. Use nodeIndices() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.public int[] getFromIndices(int index)
getFromIndices in interface IndexedDigraphpublic java.util.Set getToNodes(int index)
getToNodes in interface IndexedDigraphjava.lang.ArrayIndexOutOfBoundsException - if index does not have a node. Use nodeIndices() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.public int[] getToIndices(int index)
getToIndices in interface IndexedDigraphpublic IndexedEdgeNodeIterator indexedEdgeNodeIterator()
indexedEdgeNodeIterator in interface IndexedDigraphpublic IndexedIterator indexedNodeIterator()
indexedNodeIterator in interface IndexedDigraph
public boolean containsEdge(int fromIndex,
int toIndex,
java.lang.Object edge)
containsEdge in interface IndexedCEDigraphjava.lang.ArrayIndexOutOfBoundsException - if index does not have a node. Use nodeIndices() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.public Bag getInboundEdges(int index)
getInboundEdges in interface IndexedCEDigraphjava.lang.ArrayIndexOutOfBoundsException - if index does not have a node. Use nodeIndices() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.public Bag getOutboundEdges(int index)
getOutboundEdges in interface IndexedCEDigraphjava.lang.ArrayIndexOutOfBoundsException - if index does not have a node. Use nodeIndices() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.
public java.lang.Object getEdge(int fromIndex,
int toIndex)
getEdge in interface IndexedCEDigraphjava.lang.ArrayIndexOutOfBoundsException - if index does not have a node. Use nodeIndices() or getNodeIndex() to avoid these. In your code, catch ArrayIndexOutOfBoundsException and throw a ConcurrentModificationException if you think that's the problem.public IndexedEdgeIterator indexedEdgeIterator()
indexedEdgeIterator in interface IndexedCEDigraph
public boolean containsEdge(java.lang.Object fromNode,
java.lang.Object toNode,
java.lang.Object edge)
throws NodeMissingException
containsEdge in interface CEDigraphNodeMissingException - if either node is missing from the digraph.
public Bag getInboundEdges(java.lang.Object node)
throws NodeMissingException
getInboundEdges in interface CEDigraphNodeMissingException - if node is not in the digraph.
public Bag getOutboundEdges(java.lang.Object node)
throws NodeMissingException
getOutboundEdges in interface CEDigraphNodeMissingException - if node is not in the digraph.
public java.lang.Object getEdge(java.lang.Object fromNode,
java.lang.Object toNode)
throws NodeMissingException
getEdge in interface CEDigraphNodeMissingException - if either node is missing from the digraph.public EdgeIterator edgeIterator()
edgeIterator in interface CEDigraphpublic Bag getEdges()
getEdges in interface CEDigraphpublic boolean containsCEDigraph(CEDigraph digraph)
containsCEDigraph in interface CEDigraphpublic boolean sameCEDigraphAs(CEDigraph digraph)
sameCEDigraphAs in interface CEDigraphpublic CEDigraph intersectWithCEDigraph(CEDigraph digraph)
intersectWithCEDigraph in interface CEDigraphpublic CEDigraph unionCEDigraph(CEDigraph digraph)
unionCEDigraph in interface CEDigraphpublic int nodeCount()
nodeCount in interface Digraphpublic int edgeCount()
edgeCount in interface Digraphpublic boolean isEmpty()
isEmpty in interface Digraphpublic boolean containsNode(java.lang.Object node)
containsNode in interface Digraph
public boolean containsEdge(java.lang.Object fromNode,
java.lang.Object toNode)
throws NodeMissingException
containsEdge in interface DigraphNodeMissingException - if either node is missing from the digraph.
public int countInboundEdges(java.lang.Object node)
throws NodeMissingException
countInboundEdges in interface DigraphNodeMissingException - if node is not in the digraph.
public int countOutboundEdges(java.lang.Object node)
throws NodeMissingException
countOutboundEdges in interface DigraphNodeMissingException - if node is not in the digraph.
public java.util.Set getFromNodes(java.lang.Object node)
throws NodeMissingException
getFromNodes in interface DigraphNodeMissingException - if node is not in the digraph.
public java.util.Set getToNodes(java.lang.Object node)
throws NodeMissingException
getToNodes in interface DigraphNodeMissingException - if node is not in the digraph.public java.util.Iterator nodeIterator()
Digraph
nodeIterator in interface Digraphpublic EdgeNodeIterator edgeNodeIterator()
edgeNodeIterator in interface Digraphpublic java.util.Set getNodes()
getNodes in interface Digraphpublic boolean isEdgeFree()
isEdgeFree in interface Digraphpublic boolean containsNodes(java.util.Set nodes)
containsNodes in interface Digraphpublic java.lang.Class getPrincipleInterface()
HasState
getPrincipleInterface in interface HasStatepublic boolean sameStateAs(HasState victim)
HasStateFor objects with subobjects, Generally this method should only return true if the internal objects are equal. Implement a contentsHaveSameState() method to determine if the contents have the same state.
sameStateAs in interface HasState
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||