Skip to content

Commit

Permalink
[sre] Do not uninstall the same skill multiple times when it register…
Browse files Browse the repository at this point in the history
…ed for mutiple capacities.

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Feb 28, 2020
1 parent f960e27 commit 6f215c6
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -30,7 +30,8 @@ import io.sarl.lang.core.Skill
import io.sarl.lang.core.Skill.UninstallationStage
import io.sarl.sre.skills.bic.SchedulesSkill
import io.sarl.sre.skills.internal.InternalEventBusSkill
import java.util.ArrayList
import java.util.HashSet
import java.util.Set

/**
* Install and uninstall the skills.
Expand Down Expand Up @@ -80,13 +81,13 @@ class BasicSkillUninstaller implements SkillUninstaller {
*
* @return the skills.
*/
private static def getAllSkills(^agent : Agent) : Iterable<? extends Skill> {
private static def getAllSkills(^agent : Agent) : Set<? extends Skill> {
// Get the registered skills
val skills = SREutils.getSkillRepository(^agent)
if (skills !== null) {
return new ArrayList(Collections2.transform(skills.values) [it.get])
return new HashSet(Collections2.transform(skills.values) [it.get])
}
return emptyList
return emptySet
}

def uninstallSkillsBeforeDestroy(^agent : Agent) : Iterable<? extends Skill> {
Expand Down

0 comments on commit 6f215c6

Please sign in to comment.