geography
Class AddressFinder.Street

java.lang.Object
  |
  +--geography.AddressFinder.Street
Enclosing class:
AddressFinder

protected class AddressFinder.Street
extends java.lang.Object

A class that represents information about a particular street. This class is only used by AddressFinder, and might go away if AddressFinder changed. So it's convenient to define it right here inside AddressFinder! This is called an "inner class." Its full name is actually AddressFinder.Street.

At present, the only real information that we store is the "little map" of addresses along that street. But this class could be expanded later, for example to make it possible to look up intersections by their cross streets ("Charles and 34th St" as well as "3400 Charles St").


Field Summary
(package private)  geography.Intersection isctArbitrary
           
(package private)  java.util.SortedMap smIntersections
          Maps house numbers to Intersections along this street.
(package private)  geography.StreetSegment ssArbitrary
          One arbitrary segment of the street.
(package private)  AddressFinder.Street superStreet
          A street of which this street is a mere segment.
 
Constructor Summary
AddressFinder.Street(geography.StreetSegment ss)
          Constructor: New street, no information about it yet.
 
Method Summary
 void addIntersection(geography.Point p, java.lang.Integer housenum)
          Add a new house number near the intersection at point p.
 geography.Intersection findIntersectionNear(int housenum)
          Finds the intersection closest to the given house number on this street.
 int numKnownAddresses()
          Total number of addresses known for this street.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ssArbitrary

geography.StreetSegment ssArbitrary
One arbitrary segment of the street. We keep this around to get details of the street name.


isctArbitrary

geography.Intersection isctArbitrary

superStreet

AddressFinder.Street superStreet
A street of which this street is a mere segment. Null if there is no such street.


smIntersections

java.util.SortedMap smIntersections
Maps house numbers to Intersections along this street. The numbers are sorted in their "natural" (numerical) order using compareTo().

Constructor Detail

AddressFinder.Street

public AddressFinder.Street(geography.StreetSegment ss)
Constructor: New street, no information about it yet.

Method Detail

addIntersection

public void addIntersection(geography.Point p,
                            java.lang.Integer housenum)
Add a new house number near the intersection at point p. We also do this for the superstreet, if any. If the house number is null, then we return immediately without adding anything.


findIntersectionNear

public geography.Intersection findIntersectionNear(int housenum)
Finds the intersection closest to the given house number on this street. If this street doesn't have any known numbered intersections, try an unnumbered one.


numKnownAddresses

public int numKnownAddresses()
Total number of addresses known for this street.