| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectps2.Route
public class Route
A Route is a path that traverses arbitrary GeoSegments, regardless of their names.
Routes are immutable. New Routes can be constructed by adding a segment to the end of a Route. An added segment must be properly oriented; that is, its p1 field must correspond to the end of the original Route, and its p2 field corresponds to the end of the new Route.
Because a Route is not necessarily straight, its length -- the distance traveled by following the path from start to end -- is not necessarily the same as the distance along a straight line between its endpoints.
 Lastly, a Route may be viewed as a sequence of geographical
 features, using the getGeoFeatures() method which returns
 a List
start -  : GeoPoint         // location of the start of the route
  end -  : GeoPoint           // location of the end of the route
  startHeading -  : angle     // direction of travel at the start of the route, in degrees
  endHeading -  : angle       // direction of travel at the end of the route, in degrees
  geoFeatures -  : sequence   // a sequence of geographic features that make up this Route
  geoSegments -  : sequence   // a sequence of segments that make up this Route
 length : real         // total length of the route, in miles
  endingGeoSegment : GeoSegment   // last GeoSegment of the route
 | Constructor Summary | |
|---|---|
Route(GeoSegment gs)
 | 
|
| Method Summary | |
|---|---|
 Route | 
addSegment(GeoSegment gs)
Creates a new route that is equal to this route with gs appended to its end.  | 
 boolean | 
equals(Object o)
Compares the specified Object with this Route for equality.  | 
 GeoPoint | 
getEnd()
 | 
 double | 
getEndHeading()
 | 
 GeoSegment | 
getEndingGeoSegment()
 | 
 List<GeoFeature> | 
getGeoFeatures()
Returns a List of GeoFeature objects.  | 
 List<GeoSegment> | 
getGeoSegments()
Returns a List of GeoSegment objects.  | 
 double | 
getLength()
 | 
 GeoPoint | 
getStart()
 | 
 double | 
getStartHeading()
 | 
 int | 
hashCode()
 | 
 String | 
toString()
 | 
| Methods inherited from class java.lang.Object | 
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public Route(GeoSegment gs)
| Method Detail | 
|---|
public GeoPoint getStart()
public GeoPoint getEnd()
public GeoSegment getEndingGeoSegment()
public double getStartHeading()
public double getEndHeading()
public double getLength()
public Route addSegment(GeoSegment gs)
public List<GeoFeature> getGeoFeatures()
      this.start        = a.get(0).start
   && this.startHeading = a.get(0).startHeading
   && this.end          = a.get(a.length - 1).end
   && this.endHeading   = a.get(a.length - 1).endHeading
   && this.length       =  sum (0 ≤ i < a.size) . a.get(i).length
   && for all integers i .
          (0 ≤ i < a.size - 1 ⇒ (a.get(i).name != a.get(i+1).name &&
                                       a.get(i).end   = a.get(i+1).start))
 GeoFeaturepublic List<GeoSegment> getGeoSegments()
      this.start        = a.get(0).p1
   && this.startHeading = a.get(0).heading
   && this.end          = a.get( a.size - 1 ).p2
   && this.endHeading   = a.get( a.size - 1 ).heading
   && this.length       =  sum (0 ≤ i < a.size) . a.get(i).length
   && for all integers i .
          (0 ≤ i < a.size-1 ⇒ (a.get(i).p2 = a.get(i+1).p1))
 GeoSegmentpublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||