ps3.graph
Interface Path<N,P extends Path<N,P>>

All Superinterfaces:
Comparable<Path<?,?>>, Iterable<N>
All Known Implementing Classes:
NodeCountingPath, WeightedNodePath

public interface Path<N,P extends Path<N,P>>
extends Iterable<N>, Comparable<Path<?,?>>

A Path models a sequence of nodes and the cost for travelling along such a sequence.

Paths are immutable.

Specification Fields

Method Summary
 double cost()
           
 N end()
           
 P extend(N n)
          Creates an extended path by adding a new node to its end.
 Iterator<N> iterator()
           
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

extend

P extend(N n)
Creates an extended path by adding a new node to its end.

Returns:
a new Path p such that p.elements = this.elements + [ n ] && p.cost >= this.cost
Requires:
n != null && n is a valid node type for this particular path implementation

cost

double cost()
Returns:
this.cost

end

N end()
Returns:
the end of the path

iterator

Iterator<N> iterator()
Specified by:
iterator in interface Iterable<N>
Returns:
an Iterator over the elements in the path in order from start to end.