geography
Class StreetSegment

java.lang.Object
  |
  +--geography.StreetSegment

class StreetSegment
extends java.lang.Object

A street segment corresponding to a line in a .map file. This class exists specifically to read the data in .map files. Such files were constructed just for this homework, by taking a simple subset of the TIGER/Line data publicly available from the US Census Bureau. This class is not public. It is only visible within the geography package.


Field Summary
(package private)  java.lang.Integer housenumLeftEnd
           
(package private)  java.lang.Integer housenumLeftStart
          House numbers nearest the pStart end of this segment, on the left and right sides.
(package private)  java.lang.Integer housenumRightEnd
           
(package private)  java.lang.Integer housenumRightStart
          House numbers nearest the pStart end of this segment, on the left and right sides.
(package private)  java.lang.String name
          Name of the street, e.g., "N Charles St".
(package private)  java.lang.String nameSuper
          Base name of the "superstreet" that this is part of, e.g., "Charles St".
(package private)  geography.Point pEnd
          Physical start and end points of this segment
(package private)  geography.Point pStart
          Physical start and end points of this segment
 
Constructor Summary
StreetSegment(geography.StreetSegment ss)
          Copy constructor.
StreetSegment(java.lang.String line)
          Constructs a StreetSegment from a line in a .map file.
 
Method Summary
private  java.lang.Integer houseNum(java.lang.String s)
          Converts a house number string like "323" or "" into an Integer like 323 or null, respectively.
private  double longlat(java.lang.String s)
          Converts a longitude or latitude string like +39210703 into a double like 39.210703.
 geography.StreetSegment makeSuperStreetSegment()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

java.lang.String name
Name of the street, e.g., "N Charles St". May be "" if unknown.


nameSuper

java.lang.String nameSuper
Base name of the "superstreet" that this is part of, e.g., "Charles St". Will be null for most streets.


pStart

geography.Point pStart
Physical start and end points of this segment


pEnd

geography.Point pEnd
Physical start and end points of this segment


housenumLeftStart

java.lang.Integer housenumLeftStart
House numbers nearest the pStart end of this segment, on the left and right sides. Similarly for the pEnd end of this segment. May be null if there are no buildings on that side of the street.


housenumRightStart

java.lang.Integer housenumRightStart
House numbers nearest the pStart end of this segment, on the left and right sides. Similarly for the pEnd end of this segment. May be null if there are no buildings on that side of the street.


housenumLeftEnd

java.lang.Integer housenumLeftEnd

housenumRightEnd

java.lang.Integer housenumRightEnd
Constructor Detail

StreetSegment

public StreetSegment(java.lang.String line)
              throws DataFormatException
Constructs a StreetSegment from a line in a .map file.


StreetSegment

public StreetSegment(geography.StreetSegment ss)
Copy constructor.

Method Detail

makeSuperStreetSegment

public geography.StreetSegment makeSuperStreetSegment()

longlat

private double longlat(java.lang.String s)
                throws java.lang.NumberFormatException
Converts a longitude or latitude string like +39210703 into a double like 39.210703.

java.lang.NumberFormatException

houseNum

private java.lang.Integer houseNum(java.lang.String s)
                            throws java.lang.NumberFormatException
Converts a house number string like "323" or "" into an Integer like 323 or null, respectively. Occasionally a number may be a hyphenated range, like "5916-5900", in which case we arbitrarily take the start of the range, i.e., 5916.

java.lang.NumberFormatException