Class ArmoryRegistry

  • All Implemented Interfaces:
    java.lang.Iterable<java.util.Map.Entry<ICity,​IArmory>>

    public class ArmoryRegistry
    extends java.lang.Object
    implements java.lang.Iterable<java.util.Map.Entry<ICity,​IArmory>>
    Registry for mapping the armory to the city.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2017 Created on Jul 27, 2017
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.HashMap<ICity,​IArmory> armoryMap  
    • Constructor Summary

      Constructors 
      Constructor Description
      ArmoryRegistry()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(ICity city, IArmory armory)
      Add a new armory for a city.
      IArmory getArmory​(ICity city)
      Retrieve the armory of the city.
      java.util.Iterator<java.util.Map.Entry<ICity,​IArmory>> iterator()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • armoryMap

        private final java.util.HashMap<ICity,​IArmory> armoryMap
    • Constructor Detail

      • ArmoryRegistry

        public ArmoryRegistry()
    • Method Detail

      • add

        public void add​(ICity city,
                        IArmory armory)
        Add a new armory for a city.
        Parameters:
        city - for which to add the armory
        armory - to be added
      • getArmory

        public IArmory getArmory​(ICity city)
        Retrieve the armory of the city.
        Parameters:
        city - for which to retrieve the armory
        Returns:
        amrory in the respective city
      • iterator

        public java.util.Iterator<java.util.Map.Entry<ICity,​IArmory>> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.util.Map.Entry<ICity,​IArmory>>