pkg utilities Address - yshehab/SchoolRoomBooking GitHub Wiki
Address Class
Overview
Models an address.
Address is immutable and unique (based on house name/number and post code).
Package
Constructor
private Address(String aHouseNum, String aFirstLine, String aSecondLine, String aTown, String aCounty, String aPostCode)
Post-condition: returns an instance of Address from the supplied arguments
Static Members
private static final Map<String, Address> addresses
Static Methods
public Address createNewAddress(String aHouseNum, String aFirstLine, String aSecondLine, String aTown, String aCounty, String aPostCode)
Pre-condition: aHouseNum and aPostCode may not be null.
Post-condition: returns an instance of Address from the supplied arguments or returns an existing Address instance that has the same house name/number and post code.
Attributes
private final String houseNum
private final String firstLine
private final String secondLine
private final String town
private final String county
private final String postCode
Links
None
Protocol
public String toString()
Post-condition: returns a string representation of the receiver, the house number/name the first line of the address and the post code.
public String getHouseNum()
public String getFirstLine()
public String getSecondLine()
public String getTown()
public String getCounty()
public String getPostCode()
Inner Classes
None
Examples
Discussion
- Do we need all these getters?
- The strange toString() return is because I_ve realized that an post code/houseNum fixes an address but first line is more human readable
- Most addresses will have a telephone number