From 26291e672b0e683edc9d57710a9a9d96ca199c45 Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Sun, 24 Mar 2024 13:14:11 -0500 Subject: Format source code & set explicit UTF-8 --- src/main/java/sevenUnits/utils/NameSymbol.java | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/main/java/sevenUnits/utils/NameSymbol.java') diff --git a/src/main/java/sevenUnits/utils/NameSymbol.java b/src/main/java/sevenUnits/utils/NameSymbol.java index 9388f63..49c44fa 100644 --- a/src/main/java/sevenUnits/utils/NameSymbol.java +++ b/src/main/java/sevenUnits/utils/NameSymbol.java @@ -33,7 +33,7 @@ import java.util.Set; public final class NameSymbol { public static final NameSymbol EMPTY = new NameSymbol(Optional.empty(), Optional.empty(), new HashSet<>()); - + /** * Creates a {@code NameSymbol}, ensuring that if primaryName is null and * otherNames is not empty, one name is moved from otherNames to primaryName @@ -43,7 +43,7 @@ public final class NameSymbol { private static final NameSymbol create(final String name, final String symbol, final Set otherNames) { final Optional primaryName; - + if (name == null && !otherNames.isEmpty()) { // get primary name and remove it from savedNames final Iterator it = otherNames.iterator(); @@ -53,11 +53,11 @@ public final class NameSymbol { } else { primaryName = Optional.ofNullable(name); } - + return new NameSymbol(primaryName, Optional.ofNullable(symbol), otherNames); } - + /** * Gets a {@code NameSymbol} with a primary name, a symbol and no other * names. @@ -72,7 +72,7 @@ public final class NameSymbol { return new NameSymbol(Optional.of(name), Optional.of(symbol), new HashSet<>()); } - + /** * Gets a {@code NameSymbol} with a primary name, a symbol and additional * names. @@ -90,7 +90,7 @@ public final class NameSymbol { new HashSet<>(Objects.requireNonNull(otherNames, "otherNames must not be null."))); } - + /** * h * Gets a {@code NameSymbol} with a primary name, a symbol and additional * names. @@ -108,7 +108,7 @@ public final class NameSymbol { new HashSet<>(Arrays.asList(Objects.requireNonNull(otherNames, "otherNames must not be null.")))); } - + /** * Gets a {@code NameSymbol} with a primary name, no symbol, and no other * names. @@ -122,7 +122,7 @@ public final class NameSymbol { return new NameSymbol(Optional.of(name), Optional.empty(), new HashSet<>()); } - + /** * Gets a {@code NameSymbol} with a primary name, a symbol and additional * names. @@ -145,7 +145,7 @@ public final class NameSymbol { return NameSymbol.create(name, symbol, otherNames == null ? new HashSet<>() : new HashSet<>(otherNames)); } - + /** * h * Gets a {@code NameSymbol} with a primary name, a symbol and additional * names. @@ -168,7 +168,7 @@ public final class NameSymbol { return create(name, symbol, otherNames == null ? new HashSet<>() : new HashSet<>(Arrays.asList(otherNames))); } - + /** * Gets a {@code NameSymbol} with a symbol and no names. * @@ -181,12 +181,12 @@ public final class NameSymbol { return new NameSymbol(Optional.empty(), Optional.of(symbol), new HashSet<>()); } - + private final Optional primaryName; private final Optional symbol; - + private final Set otherNames; - + /** * Creates the {@code NameSymbol}. * @@ -202,12 +202,12 @@ public final class NameSymbol { this.symbol = symbol; otherNames.remove(null); this.otherNames = Collections.unmodifiableSet(otherNames); - + if (this.primaryName.isEmpty()) { assert this.otherNames.isEmpty(); } } - + @Override public boolean equals(Object obj) { if (this == obj) @@ -232,7 +232,7 @@ public final class NameSymbol { return false; return true; } - + /** * @return otherNames * @since 2019-10-21 @@ -240,7 +240,7 @@ public final class NameSymbol { public final Set getOtherNames() { return this.otherNames; } - + /** * @return primaryName * @since 2019-10-21 @@ -248,7 +248,7 @@ public final class NameSymbol { public final Optional getPrimaryName() { return this.primaryName; } - + /** * @return symbol * @since 2019-10-21 @@ -256,7 +256,7 @@ public final class NameSymbol { public final Optional getSymbol() { return this.symbol; } - + @Override public int hashCode() { final int prime = 31; @@ -269,7 +269,7 @@ public final class NameSymbol { + (this.symbol == null ? 0 : this.symbol.hashCode()); return result; } - + /** * @return true iff this {@code NameSymbol} contains no names or symbols. */ @@ -277,7 +277,7 @@ public final class NameSymbol { // if primaryName is empty, otherNames must also be empty return this.primaryName.isEmpty() && this.symbol.isEmpty(); } - + @Override public String toString() { if (this.isEmpty()) @@ -288,7 +288,7 @@ public final class NameSymbol { else return this.primaryName.orElseGet(this.symbol::orElseThrow); } - + /** * Creates and returns a copy of this {@code NameSymbol} with the provided * extra name. If this {@code NameSymbol} has a primary name, the provided -- cgit v1.2.3