ps2
Class WalkingRouteFormatter

java.lang.Object
  extended by ps2.RouteFormatter
      extended by ps2.WalkingRouteFormatter

public class WalkingRouteFormatter
extends RouteFormatter

A WalkingRouteFormatter class knows how to create a textual description of directions from one location to another suitable for a pedestrian.

Calling computeDirections should produce directions in the following form:

 Turn right onto Baker Street and walk for 20 minutes.
 Turn slight left onto MacGregor Street and walk for 8 minutes.
 Turn sharp right onto Burton street and walk for 3 minutes.
 Continue onto Connor Street and walk for 12 minutes.
 

Each line should correspond to a single geographic feature of the route. In the first line, "Baker Street" is the name of the first geographical feature of the route, and "20 minutes" is the length of time that it would take to walk along the geographic feature, assuming a walking speed of 20 minutes per mile. The time in minutes should be reported to the nearest minute. Each line should be terminated by a newline and should include no extra spaces other than those shown above.


Constructor Summary
WalkingRouteFormatter()
           
 
Method Summary
 String computeLine(GeoFeature geoFeature, double origHeading)
           Computes a single line of a multi-line directions String that represents the instructions for walking along a single geographical feature.
 
Methods inherited from class ps2.RouteFormatter
computeDirections, getTurnString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WalkingRouteFormatter

public WalkingRouteFormatter()
Method Detail

computeLine

public String computeLine(GeoFeature geoFeature,
                          double origHeading)

Computes a single line of a multi-line directions String that represents the instructions for walking along a single geographical feature.

Calling computeLine with a GeoFeature instance and an initial heading should produce a newline-terminated String in the following form:

 Turn sharp left onto MacGregor Street and walk for 18 minutes.
 

In the output above, "MacGregor Street" represents the name of the geographical feature, and "18 minutes" is the length of time that it would take to walk along the geographic feature, assuming a walking speed of 20 minutes per mile. The time in minutes should be reported to the nearest minute. Each line should be terminated by a newline and should include no extra spaces other than those shown above.

Specified by:
computeLine in class RouteFormatter
Parameters:
geoFeature - The geographical feature to traverse.
origHeading - The initial heading
Returns:
A newline-terminated String that gives directions on how to walk along this geographical feature.
Requires:
0 <= origHeading < 360