Class BlockadeState


  • public class BlockadeState
    extends java.lang.Object
    Hold the state of all current blockades
    Author:
    Andi Hotz, (c) Sahits GmbH, 2016 Created on Apr 14, 2016
    • Field Detail

      • blockadedCity

        private java.util.Map<ICity,​IBlockade> blockadedCity
    • Constructor Detail

      • BlockadeState

        public BlockadeState()
    • Method Detail

      • addBlockade

        public void addBlockade​(ICity city,
                                IBlockade blockade)
        Add a blockade for the city.
        Parameters:
        city - which is blockaded
        blockade - the blockade metadata
      • getBlockade

        public java.util.Optional<IBlockade> getBlockade​(ICity city)
        Retrieve the blockade for the city. If the city is not blockaded an Optional.empty is returned.
        Parameters:
        city - for which the blockade objecd is to be retrieved.
        Returns:
        Optional of the blockade metadata for the city. If there is no blockade, empty will be returned.
      • entrySet

        public java.util.Set<java.util.Map.Entry<ICity,​IBlockade>> entrySet()
      • finishBlockade

        public void finishBlockade​(ICity city)
        Finish the blockade.
        Parameters:
        city - for which the blockade finished