diff options
Diffstat (limited to 'src/main/java/sevenUnitsGUI/PrefixSearchRule.java')
-rw-r--r-- | src/main/java/sevenUnitsGUI/PrefixSearchRule.java | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main/java/sevenUnitsGUI/PrefixSearchRule.java b/src/main/java/sevenUnitsGUI/PrefixSearchRule.java index a5034c9..69f09e6 100644 --- a/src/main/java/sevenUnitsGUI/PrefixSearchRule.java +++ b/src/main/java/sevenUnitsGUI/PrefixSearchRule.java @@ -46,7 +46,7 @@ public final class PrefixSearchRule implements */ public static final PrefixSearchRule NO_PREFIXES = getUniversalRule( Set.of()); - + /** * A rule that gives every unit a common set of prefixes. * @@ -54,7 +54,7 @@ public final class PrefixSearchRule implements */ public static final PrefixSearchRule COMMON_PREFIXES = getCoherentOnlyRule( Set.of(Metric.MILLI, Metric.KILO)); - + /** * A rule that gives every unit all metric prefixes. * @@ -62,7 +62,7 @@ public final class PrefixSearchRule implements */ public static final PrefixSearchRule ALL_METRIC_PREFIXES = getCoherentOnlyRule( Metric.ALL_PREFIXES); - + /** * Gets a rule that applies the provided prefixes to coherent units only (as * defined by {@link LinearUnit#isCoherent}), except the kilogram @@ -78,7 +78,7 @@ public final class PrefixSearchRule implements return new PrefixSearchRule(prefixes, u -> u.isCoherent() && !u.getName().equals("kilogram")); } - + /** * Gets a rule that applies the provided prefixes to all units. * @@ -91,17 +91,17 @@ public final class PrefixSearchRule implements Set<UnitPrefix> prefixes) { return new PrefixSearchRule(prefixes, u -> true); } - + /** * The set of prefixes that will be applied to the unit. */ private final Set<UnitPrefix> prefixes; - + /** * Determines which units are given prefixes. */ private final Predicate<LinearUnit> prefixableUnitRule; - + /** * @param prefixes prefixes to add to units * @param prefixableUnitRule function that determines which units get @@ -114,7 +114,7 @@ public final class PrefixSearchRule implements this.prefixes = Collections.unmodifiableSet(new HashSet<>(prefixes)); this.prefixableUnitRule = prefixableUnitRule; } - + @Override public Map<String, LinearUnit> apply(Entry<String, LinearUnit> t) { final Map<String, LinearUnit> outputUnits = new HashMap<>(); @@ -129,7 +129,7 @@ public final class PrefixSearchRule implements } return Collections.unmodifiableMap(outputUnits); } - + @Override public boolean equals(Object obj) { if (this == obj) @@ -140,7 +140,7 @@ public final class PrefixSearchRule implements return Objects.equals(this.prefixableUnitRule, other.prefixableUnitRule) && Objects.equals(this.prefixes, other.prefixes); } - + /** * @return rule that determines which units get prefixes * @since v0.4.0 @@ -149,7 +149,7 @@ public final class PrefixSearchRule implements public Predicate<LinearUnit> getPrefixableUnitRule() { return this.prefixableUnitRule; } - + /** * @return the prefixes that are applied by this rule * @since v0.4.0 @@ -158,12 +158,12 @@ public final class PrefixSearchRule implements public Set<UnitPrefix> getPrefixes() { return this.prefixes; } - + @Override public int hashCode() { return Objects.hash(this.prefixableUnitRule, this.prefixes); } - + @Override public String toString() { return "Apply the following prefixes: " + this.prefixes; |