Class CitiesState


  • @Component
    @Lazy
    @DependentInitialisation(MapInitializedBean.class)
    public class CitiesState
    extends java.lang.Object
    State common to all cities.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2013 Created on Feb 1, 2013
    • Constructor Detail

      • CitiesState

        public CitiesState()
    • Method Detail

      • init

        public void init()
      • addCity

        public void addCity​(ICity city,
                            CityState cityState)
        Add a new city.
        Parameters:
        city - for which to add a CityState
        cityState - to be added
      • findCityWithMostNeededWare

        public java.util.Optional<ch.sahits.datastructure.GenericPair<ICity,​IWare>> findCityWithMostNeededWare()
        Find a possible city that has needed wares. Repeated calls to this method are not garanteed to return the same city.
        Returns:
        Optional GenericPair of city and ware.
      • findCityWithSurplusWare

        public java.util.Optional<ch.sahits.datastructure.GenericPair<ICity,​IWare>> findCityWithSurplusWare()
        Find a possible city that has needed wares. Repeated calls to this method are not garanteed to return the same city.
        Returns:
        Optional GenericPair of city and ware.
      • getCityEngineStates

        public java.util.List<CityState> getCityEngineStates()