Class InfluencesMap


  • public final class InfluencesMap
    extends Object
    A data structure containing a collection of influences, ordered using the target level of the influences.
    Author:
    Yoann Kubera
    • Constructor Detail

      • InfluencesMap

        public InfluencesMap()
        Builds an empty influences map.
      • InfluencesMap

        public InfluencesMap​(InfluencesMap toAdd)
        Builds an influences map as a copy of an existing influences map.
        Parameters:
        toAdd - The influences map to copy.
        Throws:
        IllegalArgumentException - if the argument is null.
      • InfluencesMap

        public InfluencesMap​(Collection<IInfluence> toAdd)
        Builds an influences map initially containing a specific collection of influences.
        Parameters:
        toAdd - The influences to include into this influence map..
        Throws:
        IllegalArgumentException - if the argument is null.
      • InfluencesMap

        public InfluencesMap​(IInfluence... toAdd)
        Builds an influences map initially containing a specific array of influences.
        Parameters:
        toAdd - The influences to include into this influence map.
        Throws:
        IllegalArgumentException - if the argument is null or contains null.
    • Method Detail

      • getDefinedKeys

        public Set<LevelIdentifier> getDefinedKeys()
        Gets an unordered set containing the keys that are defined in this influences map.
        Returns:
        The unordered set containing the keys that are defined in this influences map.
      • isEmpty

        public boolean isEmpty()
        Tells whether if this map contains at least one influence or not.
        Returns:
        true if this map contains no influences.
      • isEmpty

        public boolean isEmpty​(LevelIdentifier targetLevel)
        Check if this map contains no influences targeted at a specific level.
        Parameters:
        targetLevel - The target level for which the 'is empty' test is performed.
        Returns:
        true if this map contains no influences targeted at the targetLevel level.
      • getInfluencesForLevel

        public List<IInfluence> getInfluencesForLevel​(LevelIdentifier targetLevel)
        Gets the influences contained in this map that are targeted at a specific level.
        Parameters:
        targetLevel - The target level for which influences are fetched in this map.
        Returns:
        The influences contained in this map that are targeted at a specific level.
      • add

        public void add​(IInfluence influence)
        Adds an influence to this influence map.
        Parameters:
        influence - The influence to add to this influence map.
        Throws:
        IllegalArgumentException - If the influence parameter was null.
      • addAll

        public void addAll​(InfluencesMap toAdd)
        Adds all the influences contained in an influence map into this influence map.

        Note that if this influence map was already containing elements of the added influences, these influence will be present twice in this map.

        Parameters:
        toAdd - The influence map which content has to be added to this influence map.
        Throws:
        IllegalArgumentException - If the toAdd argument is null.
      • addAll

        public void addAll​(Collection<IInfluence> toAdd)
        Adds all the influences contained in a collection of influences into this influence map.

        Note that if this influence map was already containing elements of the added influences, these influence will be present twice in this map.

        Parameters:
        toAdd - The collection which content has to be added to this influence map.
        Throws:
        IllegalArgumentException - If the toAdd argument is null.
      • clear

        public void clear()
        Removes all of the mappings from this map. The map will be empty after this call returns