Added valueOfTone lookup to terminator enums
This commit is contained in:
parent
e196a8156b
commit
56b6d8a681
|
@ -1,6 +1,10 @@
|
|||
package love.distributedrebirth.demo4d.base2t;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -17,6 +21,9 @@ public enum T02PartBinary implements BasePartIdentifier {
|
|||
private final String identifierTone;
|
||||
private final String identifierLetter;
|
||||
|
||||
private static final Map<String, T02PartBinary> TONE_MAP = Collections.unmodifiableMap(
|
||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
|
||||
|
||||
private T02PartBinary(String identifierTone, String identifierLetter) {
|
||||
this.identifierTone = identifierTone;
|
||||
this.identifierLetter = identifierLetter;
|
||||
|
@ -37,4 +44,8 @@ public enum T02PartBinary implements BasePartIdentifier {
|
|||
consumer.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static T02PartBinary valueOfTone(String identifierTone) {
|
||||
return TONE_MAP.get(identifierTone);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package love.distributedrebirth.demo4d.base2t;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -18,6 +22,9 @@ public enum T03PartTrit implements BasePartIdentifier {
|
|||
private final String identifierTone;
|
||||
private final String identifierLetter;
|
||||
|
||||
private static final Map<String, T03PartTrit> TONE_MAP = Collections.unmodifiableMap(
|
||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
|
||||
|
||||
private T03PartTrit(String identifierTone, String identifierLetter) {
|
||||
this.identifierTone = identifierTone;
|
||||
this.identifierLetter = identifierLetter;
|
||||
|
@ -38,4 +45,8 @@ public enum T03PartTrit implements BasePartIdentifier {
|
|||
consumer.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static T03PartTrit valueOfTone(String identifierTone) {
|
||||
return TONE_MAP.get(identifierTone);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package love.distributedrebirth.demo4d.base2t;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -19,6 +23,9 @@ public enum T04PartQuad implements BasePartIdentifierAlt {
|
|||
private final String identifierTone;
|
||||
private final String identifierLetter;
|
||||
private final String identifierAlt;
|
||||
|
||||
private static final Map<String, T04PartQuad> TONE_MAP = Collections.unmodifiableMap(
|
||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
|
||||
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
|
||||
"Cardinal direction","https://simple.wikipedia.org/wiki/Cardinal_direction");
|
||||
|
||||
|
@ -57,4 +64,8 @@ public enum T04PartQuad implements BasePartIdentifierAlt {
|
|||
consumer.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static T04PartQuad valueOfTone(String identifierTone) {
|
||||
return TONE_MAP.get(identifierTone);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package love.distributedrebirth.demo4d.base2t;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -20,6 +24,9 @@ public enum T05PartPental implements BasePartIdentifierAlt {
|
|||
private final String identifierTone;
|
||||
private final String identifierLetter;
|
||||
private final String identifierAlt; // FIXME: escaped to keep normal line height in IDE
|
||||
|
||||
private static final Map<String, T05PartPental> TONE_MAP = Collections.unmodifiableMap(
|
||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
|
||||
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
|
||||
"Wuxing","https://en.wikipedia.org/wiki/Wuxing_(Chinese_philosophy)");
|
||||
|
||||
|
@ -54,4 +61,8 @@ public enum T05PartPental implements BasePartIdentifierAlt {
|
|||
consumer.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static T05PartPental valueOfTone(String identifierTone) {
|
||||
return TONE_MAP.get(identifierTone);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package love.distributedrebirth.demo4d.base2t;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -21,6 +25,9 @@ public enum T06PartSeximal implements BasePartIdentifierAlt {
|
|||
private final String identifierTone;
|
||||
private final String identifierLetter;
|
||||
private final String identifierAlt;
|
||||
|
||||
private static final Map<String, T06PartSeximal> TONE_MAP = Collections.unmodifiableMap(
|
||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
|
||||
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
|
||||
"ADFGVX cipher","https://en.wikipedia.org/wiki/ADFGVX_cipher");
|
||||
|
||||
|
@ -63,4 +70,8 @@ public enum T06PartSeximal implements BasePartIdentifierAlt {
|
|||
consumer.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static T06PartSeximal valueOfTone(String identifierTone) {
|
||||
return TONE_MAP.get(identifierTone);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package love.distributedrebirth.demo4d.base2t;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -24,9 +28,11 @@ public enum T08PartOctal implements BasePartIdentifierAlt {
|
|||
private static final byte BITMASK = 0x07;
|
||||
private final String identifierTone; // absolute
|
||||
private final String identifierLetter;
|
||||
private final String identifierAlt; // relative
|
||||
|
||||
private final String identifierAlt; // relative
|
||||
private final int shiftBits;
|
||||
|
||||
private static final Map<String, T08PartOctal> TONE_MAP = Collections.unmodifiableMap(
|
||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
|
||||
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
|
||||
"Tone Letters","https://en.wikipedia.org/wiki/Tone_letter");
|
||||
|
||||
|
@ -78,4 +84,8 @@ public enum T08PartOctal implements BasePartIdentifierAlt {
|
|||
consumer.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static T08PartOctal valueOfTone(String identifierTone) {
|
||||
return TONE_MAP.get(identifierTone);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package love.distributedrebirth.demo4d.base2t;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -28,6 +32,9 @@ public enum T12PartUncial implements BasePartIdentifierAlt {
|
|||
private final String identifierTone;
|
||||
private final String identifierLetter;
|
||||
private final String identifierAlt;
|
||||
|
||||
private static final Map<String, T12PartUncial> TONE_MAP = Collections.unmodifiableMap(
|
||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
|
||||
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
|
||||
"Transdecimal symbols","https://en.wikipedia.org/wiki/Duodecimal#Transdecimal_symbols");
|
||||
|
||||
|
@ -62,4 +69,8 @@ public enum T12PartUncial implements BasePartIdentifierAlt {
|
|||
consumer.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static T12PartUncial valueOfTone(String identifierTone) {
|
||||
return TONE_MAP.get(identifierTone);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package love.distributedrebirth.demo4d.base2t;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -31,6 +35,9 @@ public enum T16PartHex implements BasePartIdentifierAlt {
|
|||
private final String identifierTone;
|
||||
private final String identifierLetter;
|
||||
private final String identifierAlt;
|
||||
|
||||
private static final Map<String, T16PartHex> TONE_MAP = Collections.unmodifiableMap(
|
||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
|
||||
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
|
||||
"Dual-tone multi-frequency signaling","https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling");
|
||||
|
||||
|
@ -69,4 +76,8 @@ public enum T16PartHex implements BasePartIdentifierAlt {
|
|||
consumer.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static T16PartHex valueOfTone(String identifierTone) {
|
||||
return TONE_MAP.get(identifierTone);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package love.distributedrebirth.demo4d.base2t;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -36,6 +40,9 @@ public enum T20PartScore implements BasePartIdentifierAlt {
|
|||
private final String identifierTone;
|
||||
private final String identifierLetter;
|
||||
private final String identifierAlt;
|
||||
|
||||
private static final Map<String, T20PartScore> TONE_MAP = Collections.unmodifiableMap(
|
||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
|
||||
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
|
||||
"Open Location Code","https://en.wikipedia.org/wiki/Open_Location_Code");
|
||||
|
||||
|
@ -70,4 +77,8 @@ public enum T20PartScore implements BasePartIdentifierAlt {
|
|||
consumer.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static T20PartScore valueOfTone(String identifierTone) {
|
||||
return TONE_MAP.get(identifierTone);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue