net.walend.digraph.path
Interface CEPath

All Superinterfaces:
CEDigraph, Digraph, HasState, Path
All Known Subinterfaces:
MeasuredCEPath, MutableCEPath
All Known Implementing Classes:
AbstractDelegateDigraphOfCEPaths.DigraphCEPath, AbstractListCEPath, AbstractShortestCEPaths.DigraphMeasuredCEPath, CEPathsFromShortestDistances.DigraphMeasuredCEPath, MutableListCEPath

public interface CEPath
extends CEDigraph, Path

CEPath is an interface for represtenting paths through CEDigraph. A CEPath is expressly a subgraph of a specific CEDigraph. If two CEPaths contain the same nodes and edges in the same order, but are subgraphs of different CEDigraphs, they have different states but are the sameCEDigraphAS().

All CEPaths except the EMPTY path must have at least one node.

By default, this digraph uses equals() as the method to determine identity. Persistent versions may use hasSameIdentity() instead, for example.

Direct implementations of CEDigraph should have a single constructor that takes another CEPath in the constructor, and produce an Immutable CEPath.

Since:
20010922
Author:
David Walend dfw1@cornell.edu

Field Summary
 
Fields inherited from interface net.walend.digraph.CEDigraph
EMPTY
 
Method Summary
 java.lang.Object getEdgeAtIndex(int index)
           
 java.util.List getEdgeList()
          Returns an immutable list of the edges.
 int getIndexOfEdge(java.lang.Object edge)
           
 int getLastIndexOfEdge(java.lang.Object edge)
           
 CEPath getSubpath(int startNodeIndex, int endNodeIndex)
          Returns a new path, between startNodeIndex and endNodeIndex, inclusive.
 CEPath getSubpathFirst(java.lang.Object startNode, java.lang.Object endNode)
          Returns a new path, between the first occurence of startNode and the first occurence of endNode, inclusive.
 CEPath getSubpathFirstToLast(java.lang.Object startNode, java.lang.Object endNode)
          Returns a new path, between the first occurence of startNode and the last occurence of endNode, inclusive.
 CEPath getSubpathLast(java.lang.Object startNode, java.lang.Object endNode)
          Returns a new path, between the last occurence of startNode and the last occurence of endNode, inclusive.
 CEPath getSubpathLastToFirst(java.lang.Object startNode, java.lang.Object endNode)
          Returns a new path, between the last occurence of startNode and the first occurence of endNode, inclusive.
 CEDigraph getSupergraph()
          Returns the supergraph.
 EdgeIterator pathEdgeIterator()
          Implementations should explicitly state how they interpret nodeIterator()'s remove method.
 boolean sameCEPathAs(CEPath path)
          Returns true if path is the same path as this, on the same digraph.
 
Methods inherited from interface net.walend.digraph.CEDigraph
containsCEDigraph, containsEdge, edgeIterator, getEdge, getEdges, getInboundEdges, getOutboundEdges, intersectWithCEDigraph, sameCEDigraphAs, unionCEDigraph
 
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
 
Methods inherited from interface net.walend.digraph.path.Path
getHead, getIndexOfNode, getLastIndexOfNode, getNodeAtIndex, getNodeList, getTail, pathEdgeCount, pathEdgeNodeIterator, pathNodeCount, pathNodeIterator, valid
 

Method Detail

getSupergraph

public CEDigraph getSupergraph()
Returns the supergraph.


getIndexOfEdge

public int getIndexOfEdge(java.lang.Object edge)

getLastIndexOfEdge

public int getLastIndexOfEdge(java.lang.Object edge)

getEdgeAtIndex

public java.lang.Object getEdgeAtIndex(int index)

getEdgeList

public java.util.List getEdgeList()
Returns an immutable list of the edges.


getSubpath

public CEPath getSubpath(int startNodeIndex,
                         int endNodeIndex)
                  throws InvalidSpliceException
Returns a new path, between startNodeIndex and endNodeIndex, inclusive.

InvalidSpliceException

getSubpathFirst

public CEPath getSubpathFirst(java.lang.Object startNode,
                              java.lang.Object endNode)
                       throws NodeMissingException,
                              InvalidSpliceException
Returns a new path, between the first occurence of startNode and the first occurence of endNode, inclusive.

Throws:
NodeMissingException - if the nodes are not in the path.
InvalidSpliceException - if the nodes are not in the right order.

getSubpathLast

public CEPath getSubpathLast(java.lang.Object startNode,
                             java.lang.Object endNode)
                      throws NodeMissingException,
                             InvalidSpliceException
Returns a new path, between the last occurence of startNode and the last occurence of endNode, inclusive.

Throws:
NodeMissingException - if the nodes are not in the path.
InvalidSpliceException - if the nodes are not in the right order.

getSubpathFirstToLast

public CEPath getSubpathFirstToLast(java.lang.Object startNode,
                                    java.lang.Object endNode)
                             throws NodeMissingException,
                                    InvalidSpliceException
Returns a new path, between the first occurence of startNode and the last occurence of endNode, inclusive.

Throws:
NodeMissingException - if the nodes are not in the path.
InvalidSpliceException - if the nodes are not in the right order.

getSubpathLastToFirst

public CEPath getSubpathLastToFirst(java.lang.Object startNode,
                                    java.lang.Object endNode)
                             throws NodeMissingException,
                                    InvalidSpliceException
Returns a new path, between the last occurence of startNode and the first occurence of endNode, inclusive.

Throws:
NodeMissingException - if the nodes are not in the path.
InvalidSpliceException - if the nodes are not in the right order.

pathEdgeIterator

public EdgeIterator pathEdgeIterator()
Implementations should explicitly state how they interpret nodeIterator()'s remove method. It should either throw an UnsupportedOperationException or cause a hidden side effect of removing edges. I'm not sure what those side effects should be.

The Iterator should start at the beginning of the path and iterate to the end.


sameCEPathAs

public boolean sameCEPathAs(CEPath path)
Returns true if path is the same path as this, on the same digraph. So if two paths are on different supergraphs, they may be the same digraph, but not the same path.



Copyright (c) 2001, 2002, David Walend