Interface DistrictOperations


public interface DistrictOperations
  • Method Details

    • insertDistrict

      int insertDistrict(String name, int cityId, int xCord, int yCord)
      Insert new district with given name, the city which that district is a part of, and coordinates of the district.
      Parameters:
      name - - district name.
      cityId - - primary key of the city.
      xCord - - x cord ("longitude") given in km.
      yCord - - y cord ("latitude") given in km.
      Returns:
      new row's primary key on success, or -1 on failure.
    • deleteDistricts

      int deleteDistricts(String... names)
      Delete districts by name.
      Parameters:
      names - - names of the districts to be deleted.
      Returns:
      number of deleted records.
    • deleteDistrict

      boolean deleteDistrict(int idDistrict)
      Delete district by primary key.
      Parameters:
      idDistrict - - primary key of the district to be deleted.
      Returns:
      success of operation.
    • deleteAllDistrictsFromCity

      int deleteAllDistrictsFromCity(String nameOfTheCity)
      Delete all district from given city.
      Parameters:
      nameOfTheCity - - the name of the city, containing all district that should be deleted.
      Returns:
      number of deleted records.
    • getAllDistrictsFromCity

      List<Integer> getAllDistrictsFromCity(int idCity)
      Get primary keys of all districts from the given.
      Parameters:
      idCity - - primary key of the desired city.
      Returns:
      List of Integer, primary keys of all districts. Should be null if there is no city with the given primary key.
    • getAllDistricts

      List<Integer> getAllDistricts()
      Get primary keys of all districts in the system.
      Returns:
      List of Integer, primary keys of all districts.