Interface CityOperations


  • public interface CityOperations
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int connectCities​(int cityId1, int cityId2, int distance)
      Connects two cities.
      int createCity​(java.lang.String name)
      Creates new city.
      java.util.List<java.lang.Integer> getCities()
      Gets all cities
      java.util.List<java.lang.Integer> getConnectedCities​(int cityId)
      Get connected cities.
      java.util.List<java.lang.Integer> getShops​(int cityId)
      Get shops in the city.
    • Method Detail

      • createCity

        int createCity​(java.lang.String name)
        Creates new city.
        Parameters:
        name - the name of the city. Name of the cities must be unique.
        Returns:
        city id, or -1 on failure
      • getCities

        java.util.List<java.lang.Integer> getCities()
        Gets all cities
        Returns:
        ids of cities, null if failure
      • connectCities

        int connectCities​(int cityId1,
                          int cityId2,
                          int distance)
        Connects two cities. There can be max one line between cities.
        Parameters:
        cityId1 - id of the first city
        cityId2 - id of the second city
        distance - distance between cities (distance is measured in days)
        Returns:
        line id, or -1 on failure
      • getConnectedCities

        java.util.List<java.lang.Integer> getConnectedCities​(int cityId)
        Get connected cities.
        Parameters:
        cityId - id of the city that connections are asked for
        Returns:
        list of connected cities ids
      • getShops

        java.util.List<java.lang.Integer> getShops​(int cityId)
        Get shops in the city.
        Parameters:
        cityId - id of the city
        Returns:
        list of ids of shops, null if failure