net.sourceforge.combean.graph.containers
Class ListAsPath

Package class diagram package ListAsPath
java.lang.Object
  extended by net.sourceforge.combean.graph.containers.ListAsPath
All Implemented Interfaces:
FixedPath, Path

public class ListAsPath
extends Object
implements Path

Implement a Path using a java.util.List


Constructor Summary
ListAsPath()
          Constructor.
ListAsPath(List<Edge> edgeList)
          Constructor.
 
Method Summary
 void appendEdge(Edge e)
          Add an edge to the end of the path.
 EdgeIterator getEdgeIterator()
           
 Node getFirstNode()
           
 Node getLastNode()
           
 NodeIterator getNodeIterator()
           
 int getNumNodes()
           
 void init(NeighborhoodGraphProp g)
          This method must be called before nodes and edges are added to the path.
 void prependEdge(Edge e)
          Add an edge to the beginning of the path
 void setInitialNode(Node v)
          Sets a single first node of the path.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListAsPath

public ListAsPath()
Constructor. Use a java.util.LinkedList internally.


ListAsPath

public ListAsPath(List<Edge> edgeList)
Constructor. Use the given java.util.List internally

Parameters:
edgeList - the list to be used as representation of the path
Method Detail

init

public void init(NeighborhoodGraphProp g)
Description copied from interface: Path
This method must be called before nodes and edges are added to the path. After the call to this method the path is empty. Only nodes and edges belonging to the given graph may be added to the path.

Specified by:
init in interface Path
Parameters:
g - the graph which contains the path to be constructed

setInitialNode

public void setInitialNode(Node v)
Description copied from interface: Path
Sets a single first node of the path. This method must be called before edges are added to the path. After calling this method the path consists of a single node.

Specified by:
setInitialNode in interface Path
Parameters:
v - the node which shall be added to the path.

getNumNodes

public int getNumNodes()
Specified by:
getNumNodes in interface FixedPath
Returns:
the number of nodes in the path

appendEdge

public void appendEdge(Edge e)
Description copied from interface: Path
Add an edge to the end of the path.

Specified by:
appendEdge in interface Path
Parameters:
e - the edge to be added

prependEdge

public void prependEdge(Edge e)
Description copied from interface: Path
Add an edge to the beginning of the path

Specified by:
prependEdge in interface Path
Parameters:
e - the edge to be added

getFirstNode

public Node getFirstNode()
Specified by:
getFirstNode in interface FixedPath
Returns:
the first node in the path

getLastNode

public Node getLastNode()
Specified by:
getLastNode in interface FixedPath
Returns:
the last node in the path

getNodeIterator

public NodeIterator getNodeIterator()
Specified by:
getNodeIterator in interface FixedPath
Returns:
an iterator which traverses all nodes in the path in the ordering defined by the path.

getEdgeIterator

public EdgeIterator getEdgeIterator()
Specified by:
getEdgeIterator in interface FixedPath
Returns:
an iterator which traverses all edges in the path in the ordering defined by the path.

toString

public String toString()
Overrides:
toString in class Object