summaryrefslogtreecommitdiff
path: root/src/main/java/tlIItools/AffixSet.java
diff options
context:
space:
mode:
authorBenjamin J. Culkin <bjculkin@mix.wvu.edu>2020-08-04 18:54:11 -0300
committerBenjamin J. Culkin <bjculkin@mix.wvu.edu>2020-08-04 18:54:11 -0300
commitfae5ad96f11bfd1d3571ffbeb58db645e7734bed (patch)
tree10ea826446402a2716fe6074906171f8ef8cf201 /src/main/java/tlIItools/AffixSet.java
parenta5da46a5ef196c23e604e3cefeecdead9f939f2d (diff)
Perform some basic ways of grouping outputted affixes
Diffstat (limited to 'src/main/java/tlIItools/AffixSet.java')
-rw-r--r--src/main/java/tlIItools/AffixSet.java20
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());
}
/**