public final class CellNumber extends Object implements Comparable<CellNumber>
Constructor and Description |
---|
CellNumber(CellNumber other)
Initialize this cell number by copying the area, exchange, and
station codes of another cell number.
|
CellNumber(int areaCode,
int exchangeCode,
int stationCode)
Initialize this cell number given its area code, its exchange code, and
its station code.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(CellNumber other)
Compares two cell numbers for order.
|
boolean |
equals(Object obj)
Compares two cell numbers for equality.
|
int |
getAreaCode()
Returns the area code.
|
int |
getExchangeCode()
Returns the exchange code.
|
int |
getStationCode()
Returns the station code.
|
int |
hashCode()
Returns a hash code for this cell number.
|
String |
toString()
Returns a string representation of this cell number.
|
public CellNumber(int areaCode, int exchangeCode, int stationCode)
areaCode
- the area code; must be in the range 0-999exchangeCode
- the exchange code; must be in the range 0-999stationCode
- the station code; must be in the range 0-9999IllegalArgumentException
- if any of the area code, exchange code or station code are
out of rangepublic CellNumber(CellNumber other)
other
- the cell number to copypublic int getAreaCode()
public int getExchangeCode()
public int getStationCode()
public String toString()
public int hashCode()
public boolean equals(Object obj)
public int compareTo(CellNumber other)
compareTo
in interface Comparable<CellNumber>
other
- the cell number to be compared