com.mizar.usaddress
Class USAddressRange

java.lang.Object
  extended by com.mizar.usaddress.USAddressRange

public class USAddressRange
extends java.lang.Object


Field Summary
protected  Polyline geometry
           
protected  double interval
           
static int LEFT_FROM
           
static int LEFT_HIGH_ADDRESS
           
static int LEFT_LOW_ADDRESS
           
static int LEFT_TO
           
protected  long leftFrom
           
protected  boolean leftOdd
           
protected  long leftTo
           
static int RIGHT_FROM
           
static int RIGHT_HIGH_ADDRESS
           
static int RIGHT_LOW_ADDRESS
           
static int RIGHT_TO
           
protected  long rightFrom
           
protected  long rightTo
           
 
Constructor Summary
USAddressRange()
           
USAddressRange(Polyline geometry, long leftFrom, long leftTo, long rightFrom, long rightTo, boolean leftOdd, double interval)
           
 
Method Summary
 void combine(USAddressRange addr)
          combines the to and from addresss from the 2 ranges
static long[] compute(long leftFrom, long rightFrom, double length, boolean leftIsOdd, double interval)
          Calculates the address range.
 Polyline getGeometry()
           
 double getInterval()
           
 long getLeftFrom()
           
 long getLeftTo()
           
 long getRightFrom()
           
 long getRightTo()
           
static boolean isEven(long toTest)
           
 boolean isLeftOdd()
           
static boolean isOdd(long toTest)
           
 void setGeometry(Polyline geometry)
           
 void setInterval(double leftInterval)
           
 void setLeftFrom(long leftLow)
           
 void setLeftOdd(boolean leftIsOdd)
           
 void setLeftTo(long leftHigh)
           
 void setRightFrom(long rightLow)
           
 void setRightTo(long rightHigh)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT_FROM

public static int LEFT_FROM

LEFT_TO

public static int LEFT_TO

RIGHT_FROM

public static int RIGHT_FROM

RIGHT_TO

public static int RIGHT_TO

LEFT_LOW_ADDRESS

public static final int LEFT_LOW_ADDRESS
See Also:
Constant Field Values

LEFT_HIGH_ADDRESS

public static final int LEFT_HIGH_ADDRESS
See Also:
Constant Field Values

RIGHT_LOW_ADDRESS

public static final int RIGHT_LOW_ADDRESS
See Also:
Constant Field Values

RIGHT_HIGH_ADDRESS

public static final int RIGHT_HIGH_ADDRESS
See Also:
Constant Field Values

geometry

protected Polyline geometry

leftFrom

protected long leftFrom

leftTo

protected long leftTo

rightFrom

protected long rightFrom

rightTo

protected long rightTo

leftOdd

protected boolean leftOdd

interval

protected double interval
Constructor Detail

USAddressRange

public USAddressRange()

USAddressRange

public USAddressRange(Polyline geometry,
                      long leftFrom,
                      long leftTo,
                      long rightFrom,
                      long rightTo,
                      boolean leftOdd,
                      double interval)
Method Detail

getLeftFrom

public long getLeftFrom()

setLeftOdd

public void setLeftOdd(boolean leftIsOdd)

getGeometry

public Polyline getGeometry()
                     throws GeometryException
Throws:
GeometryException

setGeometry

public void setGeometry(Polyline geometry)

getRightFrom

public long getRightFrom()

setRightFrom

public void setRightFrom(long rightLow)

setLeftTo

public void setLeftTo(long leftHigh)

isLeftOdd

public boolean isLeftOdd()

getLeftTo

public long getLeftTo()

getRightTo

public long getRightTo()

setRightTo

public void setRightTo(long rightHigh)

setInterval

public void setInterval(double leftInterval)

getInterval

public double getInterval()

setLeftFrom

public void setLeftFrom(long leftLow)

compute

public static long[] compute(long leftFrom,
                             long rightFrom,
                             double length,
                             boolean leftIsOdd,
                             double interval)
                      throws AddressingException
Calculates the address range.

Parameters:
leftFrom - low Left address
rightFrom - low right address
length - area of range
leftIsOdd - true if lefts is odd
interval - addressing interval
Returns:
An array of longs with leftFrom, leftTo, rightFrom, rightTo
Throws:
AddressingException - if there is an address parity problem

isEven

public static boolean isEven(long toTest)
Parameters:
toTest - value to test
Returns:
true if toTest is even

isOdd

public static boolean isOdd(long toTest)
Parameters:
toTest - value to test
Returns:
true if toTest is Odd

combine

public void combine(USAddressRange addr)
combines the to and from addresss from the 2 ranges

Parameters:
addr -