BoardUtil - Missing NoChange Detection and TODO Comments.

This commit is contained in:
Olof Larsson 2016-05-12 07:27:12 +02:00
parent 03e71c3dfa
commit c98c562bc9
No known key found for this signature in database
GPG Key ID: BBEF14F97DA52474

View File

@ -802,11 +802,13 @@ public class BoardUtil extends Engine
public static void addTeamMember(Team team, Object key)
{
if (isTeamMember(team, key)) return;
team.addEntry(getKey(key));
}
public static void removeTeamMember(Team team, Object key)
{
if ( ! isTeamMember(team, key)) return;
team.removeEntry(getKey(key));
}
@ -855,6 +857,8 @@ public class BoardUtil extends Engine
{
Team before = getKeyTeam(board, key);
if (MUtil.equals(before, team)) return;
// TODO: Do we really need to remove from the old team first?
// TODO: Chances are this would be done automatically.
if (before != null) removeTeamMember(before, key);
if (team != null) addTeamMember(team, key);
}