diff options
Diffstat (limited to 'src/main/java/tlIItools/AffixSet.java')
| -rw-r--r-- | src/main/java/tlIItools/AffixSet.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/main/java/tlIItools/AffixSet.java b/src/main/java/tlIItools/AffixSet.java index 569649ec..d7f14211 100644 --- a/src/main/java/tlIItools/AffixSet.java +++ b/src/main/java/tlIItools/AffixSet.java @@ -1,15 +1,23 @@ package tlIItools; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import java.util.*; + /** * Container of a set of affixes. * * @author Ben Culkin */ public class AffixSet { + private static class AffixComparator implements Comparator<Affix> { + public int compare(Affix a1, Affix a2) { + if (a1.minLevel == a2.minLevel) { + return a1.maxLevel - a2.maxLevel; + } + + return a1.minLevel - a2.minLevel; + } + } + /** * All of the affix groups contained in this set. * @@ -27,9 +35,9 @@ public class AffixSet { * Create a new blank affix set. */ public AffixSet() { - affixGroups = new HashMap<>(); + affixGroups = new TreeMap<>(); - ungroupedAffixes = new HashSet<>(); + ungroupedAffixes = new TreeSet<>(new AffixComparator()); } /** |
