ps6
Class DirectionsFinder

java.lang.Object
  extended by ps6.DirectionsFinder

public class DirectionsFinder
extends Object

A DirectionsFinder produces directions for traveling from one address to another in a particular geographical area.

Specification Fields:
segments - : set[StreetSegment] // the set of StreetSegments which represents the geographical area for which this DirectionsFinder produces directions

Method Summary
 Directions getDirections(Address start, Address end, ps2.RouteFormatter routeFormat)
          Gets directions from start to end.
static DirectionsFinder getDirectionsFinder(String databaseName, Collection<String> zf)
          Produces a DirectionsFinder for a given database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDirectionsFinder

public static DirectionsFinder getDirectionsFinder(String databaseName,
                                                   Collection<String> zf)
                                            throws InvalidDatabaseException
Produces a DirectionsFinder for a given database.

Parameters:
databaseName - the database to find directions in
zf - a collection of zipcodes used for zipcode filtering. Only matching zipcodes will be used. If zf is empty or null then there is no zipcode filtering for the database.
Returns:
A DirectionsFinder whose set of segments is { s | s in (new StreetSegReader(databaseName)).streetSegs () && (s.leftZip in zf || s.rightZip in zf || (s.leftZip.trim () == s.rightZip.trim () == "") || zf == null) }
Throws:
InvalidDatabaseException - if databaseName does not refer to a valid tiger database.

getDirections

public Directions getDirections(Address start,
                                Address end,
                                ps2.RouteFormatter routeFormat)
                         throws InvalidAddressException,
                                NoPathException
Gets directions from start to end.

Returns:
A Directions providing directions of travel from start to end.
Throws:
InvalidAddressException - if start or end is not in the geographical area covered by this DirectionsFinder.
NoPathException - if no path could be found from start to end.