diff options
| author | Ben Culkin <scorpress@gmail.com> | 2020-10-05 16:58:24 -0400 |
|---|---|---|
| committer | Ben Culkin <scorpress@gmail.com> | 2020-10-05 16:58:24 -0400 |
| commit | 3a140a48b3e8e3d0f7667c17bd2ed40933645385 (patch) | |
| tree | cab59d0437a426eec9103aa02e923bb26466f352 /src/main/java/tlIItools/AffixSet.java | |
| parent | 27d67d6aa21ec4979701ab044383bdc09a13eb3a (diff) | |
| parent | fae5ad96f11bfd1d3571ffbeb58db645e7734bed (diff) | |
Merge branch 'master' of git@github.com:bculkin2442/tlIItools.git
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()); } /** |
