Class InfluencesMap
- java.lang.Object
-
- fr.univ_artois.lgi2a.similar.microkernel.influences.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 Summary
Constructors Constructor Description InfluencesMap()
Builds an empty influences map.InfluencesMap(IInfluence... toAdd)
Builds an influences map initially containing a specific array of influences.InfluencesMap(InfluencesMap toAdd)
Builds an influences map as a copy of an existing influences map.InfluencesMap(Collection<IInfluence> toAdd)
Builds an influences map initially containing a specific collection of influences.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(IInfluence influence)
Adds an influence to this influence map.void
addAll(InfluencesMap toAdd)
Adds all the influences contained in an influence map into this influence map.void
addAll(Collection<IInfluence> toAdd)
Adds all the influences contained in a collection of influences into this influence map.void
clear()
Removes all of the mappings from this map.Set<LevelIdentifier>
getDefinedKeys()
Gets an unordered set containing the keys that are defined in this influences map.List<IInfluence>
getInfluencesForLevel(LevelIdentifier targetLevel)
Gets the influences contained in this map that are targeted at a specific level.boolean
isEmpty()
Tells whether if this map contains at least one influence or not.boolean
isEmpty(LevelIdentifier targetLevel)
Check if this map contains no influences targeted at a specific level.
-
-
-
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 isnull
.
-
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 isnull
.
-
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 isnull
or containsnull
.
-
-
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 thetargetLevel
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 theinfluence
parameter wasnull
.
-
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 thetoAdd
argument isnull
.
-
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 thetoAdd
argument isnull
.
-
clear
public void clear()
Removes all of the mappings from this map. The map will be empty after this call returns
-
-