DatabaseLocation

public abstract class DatabaseLocation extends Location

Superclass for Locations that will be stored in the database. Since the instance field names are used directly as column names in the database, a single class cannot be used for both From and Near locations (the column names would conflict). Therefore, two separate classes, FromLocation and NearLocation are used. They are nearly identical, however, so this superclass holds methods common to both. It also imposes requirements on them to ensure that those methods can function. The database will store the IDs of the city, region, and country.

Constructors

DatabaseLocation

public DatabaseLocation(long countryId, long regionId, long cityId)

Constructor that passes all parameters to superclass constructor

Parameters:
  • countryId – ID of country
  • regionId – ID of region
  • cityId – ID of city

DatabaseLocation

public DatabaseLocation(JSONObject json)

Constructor that passes all parameters to superclass constructor

Parameters:
  • json – JSON object that defines the location. See superclass constructor documentation.
Throws:
  • JSONException – May be thrown for improperly formatted JSON

DatabaseLocation

public DatabaseLocation(JSONObject json, String cityIdKey, String regionIdKey, String countryIdKey)

Passes all parameters, maintaining order, to Location.Location(JSONObject,String,String,String)

Parameters:
  • json
  • cityIdKey
  • regionIdKey
  • countryIdKey
Throws:
  • JSONException

DatabaseLocation

public DatabaseLocation()

Empty constructor for database use only. This should never be called by our code.