Source code for PhoneRegion.java
package PhoneApp.Data;
class PhoneRegion extends DataObject {
public PhoneRegion(String newAreaCode, String newCity, String newProvince, String newCountry) {
boolean success = true;
success = success && testString(newAreaCode, VERIFY_TEXT, VERIFY_MANDATORY, 11);
success = success && testString(newCity, VERIFY_TEXT, VERIFY_MANDATORY, 100);
success = success && testString(newProvince, VERIFY_TEXT, VERIFY_MANDATORY, 30);
success = success && testString(newCountry, VERIFY_TEXT, VERIFY_MANDATORY, 50);
if ( success ) {
areaCode = newAreaCode;
city = newCity;
province = newProvince;
country = newCountry;
}
}
public String getAreaCode() {
return areaCode;
}
public String toString() {
String s = "";
s += "(" + areaCode + ") " + city + ", " + province + ", " + country;
return s;
}
private String areaCode;
private String city;
private String province;
private String country;
}