net.walend.digraph.path
Interface UEPath

All Superinterfaces:
Digraph, HasState, Path, UEDigraph
All Known Subinterfaces:
MutableUEPath
All Known Implementing Classes:
AbstractListUEPath, MutableListUEPath

public interface UEPath
extends UEDigraph, Path

UEPath is an interface for represtenting paths through UEDigraph. A UEPath is expressly a subgraph of a specific UEDigraph. If two UEPaths contain the same nodes and edges in the same order, but are subgraphs of different UEDigraphs, they have different states but are the sameUEDigraphAS().

All UEPaths 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 UEDigraph should have a single constructor that takes another UEPath in the constructor, and produce an Immutable UEPath.

Author:
David Walend dfw1@cornell.edu

Field Summary
 
Fields inherited from interface net.walend.digraph.UEDigraph
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)
           
 UEPath getSubpath(int startNodeIndex, int endNodeIndex)
          Returns a new path, between startNodeIndex and endNodeIndex, inclusive.
 UEPath 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.
 UEPath 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.
 UEPath 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.
 UEPath 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.
 UEDigraph getSupergraph()
          Returns the supergraph.
 EdgeIterator pathEdgeIterator()
          Implementations should explicitly state how they interpret nodeIterator()'s remove method.
 boolean sameUEPathAs(UEPath path)
          Returns true if path is the same path as this, on the same digraph.
 
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
 
Methods inherited from interface net.walend.digraph.path.Path
getHead, getIndexOfNode, getLastIndexOfNode, getNodeAtIndex, getNodeList, getTail, pathEdgeCount, pathEdgeNodeIterator, pathNodeCount, pathNodeIterator, valid
 

Method Detail

getSupergraph

public UEDigraph 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 UEPath getSubpath(int startNodeIndex,
                         int endNodeIndex)
                  throws InvalidSpliceException
Returns a new path, between startNodeIndex and endNodeIndex, inclusive.

InvalidSpliceException

getSubpathFirst

public UEPath 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 UEPath 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 UEPath 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 UEPath 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.


sameUEPathAs

public boolean sameUEPathAs(UEPath 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