net.walend.digraph.path
Interface MutableUEPath

All Superinterfaces:
Digraph, HasState, Path, UEDigraph, UEPath
All Known Implementing Classes:
MutableListUEPath

public interface MutableUEPath
extends UEPath

MutableUEPath is an interface for represtenting mutable paths through UEDigraph.

Direct implementations of UEDigraph should have a copy constructor that takes a UEPath, and a constructor that requires a UEDigraph and a start node.

Author:
David Walend dfw1@cornell.edu

Field Summary
 
Fields inherited from interface net.walend.digraph.UEDigraph
EMPTY
 
Method Summary
 void addToHead(java.lang.Object edge, java.lang.Object node)
          Adds an edge and node to the beginning of the path.
 void addToTail(java.lang.Object edge, java.lang.Object node)
          Adds an edge and node to the end of the path.
 void graftToHead(UEPath path)
          Adds a path to the beginning of this path.
 void graftToTail(UEPath path)
          Adds a path to the end of this path.
 UEPath pruneHead(int index)
          Removes from the head to the edge at index.
 UEPath pruneHeadFromFirst(java.lang.Object node)
          Removes from the head to the first occurance of node.
 UEPath pruneHeadFromLast(java.lang.Object node)
          Removes from the head to the last occurance of node.
 UEPath pruneTail(int index)
          Removes from the edge at index to the tail.
 UEPath pruneTailFromFirst(java.lang.Object node)
          Removes from the first occurance of node to the tail.
 UEPath pruneTailFromLast(java.lang.Object node)
          Removes from the last occurance of node to the tail.
 java.lang.Object removeHead()
          Removes the head node from the path.
 java.lang.Object removeTail()
          Removes the tail node from the path.
 UEPath splice(UEPath path, int startNodeIndex, int endNodeIndex)
          Splices in path between the startNodeIndex and endNodeIndex.
 UEPath spliceFirst(UEPath path)
          Splices in path between the first occurence of path's head and the first occurence of path's tail.
 UEPath spliceFirstToLast(UEPath path)
          Splices in path between the first occurence of path's head and the last occurence of path's tail.
 UEPath spliceLast(UEPath path)
          Splices in path between the last occurence of path's head and the last occurence of path's tail.
 UEPath spliceLastToFirst(UEPath path)
          Splices in path between the last occurence of path's head and the first occurence of path's tail.
 
Methods inherited from interface net.walend.digraph.path.UEPath
getEdgeAtIndex, getEdgeList, getIndexOfEdge, getLastIndexOfEdge, getSubpath, getSubpathFirst, getSubpathFirstToLast, getSubpathLast, getSubpathLastToFirst, getSupergraph, pathEdgeIterator, sameUEPathAs
 
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

addToTail

public void addToTail(java.lang.Object edge,
                      java.lang.Object node)
               throws EdgeMissingException,
                      NodeMissingException
Adds an edge and node to the end of the path.

Throws:
EdgeMissingException - if the edge is not in the digraph between the tail node and node.
NodeMissingException - if the node is not in the digraph.

addToHead

public void addToHead(java.lang.Object edge,
                      java.lang.Object node)
               throws EdgeMissingException,
                      NodeMissingException
Adds an edge and node to the beginning of the path.

Throws:
EdgeMissingException - if the edge is not in the digraph between the head node and node.
NodeMissingException - if the node is not in the digraph.

graftToHead

public void graftToHead(UEPath path)
                 throws EdgeMissingException,
                        NodeMissingException,
                        InvalidSpliceException
Adds a path to the beginning of this path.

Throws:
EdgeMissingException - if the any edge in path is missing from the digraph.
NodeMissingException - if any node in path not in the digraph.
InvalidSpliceException - if path's tail node is not this' head node.

graftToTail

public void graftToTail(UEPath path)
                 throws EdgeMissingException,
                        NodeMissingException,
                        InvalidSpliceException
Adds a path to the end of this path.

Throws:
EdgeMissingException - if the any edge in path is missing from the digraph.
NodeMissingException - if any node in path not in the digraph.
InvalidSpliceException - if path's head node is not this' tail node.

removeHead

public java.lang.Object removeHead()
                            throws LastNodeException
Removes the head node from the path.

returns the orphaned edge.

LastNodeException

removeTail

public java.lang.Object removeTail()
                            throws LastNodeException
Removes the tail node from the path.

returns the orphaned edge.

LastNodeException

pruneTail

public UEPath pruneTail(int index)
Removes from the edge at index to the tail.

Returns:
the path from the node at index to the tail.

pruneHead

public UEPath pruneHead(int index)
Removes from the head to the edge at index.

Returns:
the path from the head to the node at index.

pruneTailFromFirst

public UEPath pruneTailFromFirst(java.lang.Object node)
                          throws NodeMissingException
Removes from the first occurance of node to the tail.

Returns:
a path from the first occurance of node to the tail.
Throws:
NodeMissingException - if the node is not in the digraph.

pruneTailFromLast

public UEPath pruneTailFromLast(java.lang.Object node)
                         throws NodeMissingException
Removes from the last occurance of node to the tail.

Returns:
a path from the last occurance of node to the tail.
Throws:
NodeMissingException - if the node is not in the digraph.

pruneHeadFromFirst

public UEPath pruneHeadFromFirst(java.lang.Object node)
                          throws NodeMissingException
Removes from the head to the first occurance of node.

Returns:
a path from the head to the first occurance of node.
Throws:
NodeMissingException - if the node is not in the digraph.

pruneHeadFromLast

public UEPath pruneHeadFromLast(java.lang.Object node)
                         throws NodeMissingException
Removes from the head to the last occurance of node.

Returns:
a path from the head to the last occurance of node.
Throws:
NodeMissingException - if the node is not in the digraph.

splice

public UEPath splice(UEPath path,
                     int startNodeIndex,
                     int endNodeIndex)
              throws EdgeMissingException,
                     NodeMissingException,
                     InvalidSpliceException
Splices in path between the startNodeIndex and endNodeIndex.

Returns:
the orphaned path

Throws:
EdgeMissingException - if the any edge in path is missing from the digraph.
NodeMissingException - if any node in path not in the digraph.
InvalidSpliceException - if path's head node is not the node in this at startNodeIndex, or if the path's tail node is not the node in this at endNodeIndex.

spliceFirst

public UEPath spliceFirst(UEPath path)
                   throws EdgeMissingException,
                          NodeMissingException,
                          InvalidSpliceException
Splices in path between the first occurence of path's head and the first occurence of path's tail.

Returns:
the orphaned path

Throws:
EdgeMissingException - if the any edge in path is missing from the digraph.
NodeMissingException - if any node in path not in the digraph.
InvalidSpliceException - if path's head node is not the node in this at startNodeIndex, or if the path's tail node is not the node in this at endNodeIndex.

spliceLast

public UEPath spliceLast(UEPath path)
                  throws EdgeMissingException,
                         NodeMissingException,
                         InvalidSpliceException
Splices in path between the last occurence of path's head and the last occurence of path's tail.

Returns:
the orphaned path

Throws:
EdgeMissingException - if the any edge in path is missing from the digraph.
NodeMissingException - if any node in path not in the digraph.
InvalidSpliceException - if path's head node is not the node in this at startNodeIndex, or if the path's tail node is not the node in this at endNodeIndex.

spliceFirstToLast

public UEPath spliceFirstToLast(UEPath path)
                         throws EdgeMissingException,
                                NodeMissingException,
                                InvalidSpliceException
Splices in path between the first occurence of path's head and the last occurence of path's tail.

Returns:
the orphaned path

Throws:
EdgeMissingException - if the any edge in path is missing from the digraph.
NodeMissingException - if any node in path not in the digraph.
InvalidSpliceException - if path's head node is not the node in this at startNodeIndex, or if the path's tail node is not the node in this at endNodeIndex.

spliceLastToFirst

public UEPath spliceLastToFirst(UEPath path)
                         throws EdgeMissingException,
                                NodeMissingException,
                                InvalidSpliceException
Splices in path between the last occurence of path's head and the first occurence of path's tail.

Returns:
the orphaned path

Throws:
EdgeMissingException - if the any edge in path is missing from the digraph.
NodeMissingException - if any node in path not in the digraph.
InvalidSpliceException - if path's head node is not the node in this at startNodeIndex, or if the path's tail node is not the node in this at endNodeIndex.


Copyright (c) 2001, 2002, David Walend