Prepared tone id for leading in (bin) xml storage.

This commit is contained in:
Willem Cazander 2022-01-29 10:59:14 +01:00
parent d793add3de
commit ef1f14b55a
11 changed files with 205 additions and 197 deletions

View file

@ -7,5 +7,7 @@ package love.distributedrebirth.demo4d.base2t;
*/
public interface BasePartIdentifier {
String getIdentifier();
String getIdentifierTone();
String getIdentifierLetter();
}

View file

@ -1,11 +0,0 @@
package love.distributedrebirth.demo4d.base2t;
/**
*
* @author willemtsade ©Δ 仙上主天
*
*/
public interface BasePartIdentifierTone extends BasePartIdentifier {
String getIdentifierTone();
}

View file

@ -7,24 +7,19 @@ import java.util.function.Consumer;
* @author willemtsade ©Δ 仙上主天
*
*/
public enum T02PartBinary implements BasePartIdentifierTone {
public enum T02PartBinary implements BasePartIdentifier {
PART_1("0","˥"),
PART_2("1","˩"),
PART_1("˧","0"),
PART_2("","1"),
;
public static int LENGTH = 2;
private final String identifier;
private final String identifierTone;
private final String identifierLetter;
private T02PartBinary(String identifier, String identifierTone) {
this.identifier = identifier;
private T02PartBinary(String identifierTone, String identifierLetter) {
this.identifierTone = identifierTone;
}
@Override
public String getIdentifier() {
return identifier;
this.identifierLetter = identifierLetter;
}
@Override
@ -32,6 +27,11 @@ public enum T02PartBinary implements BasePartIdentifierTone {
return identifierTone;
}
@Override
public String getIdentifierLetter() {
return identifierLetter;
}
public static void forEach(Consumer<T02PartBinary> consumer) {
for (T02PartBinary value:values()) {
consumer.accept(value);

View file

@ -7,25 +7,20 @@ import java.util.function.Consumer;
* @author willemtsade ©Δ 仙上主天
*
*/
public enum T03PartTrit implements BasePartIdentifierTone {
public enum T03PartTrit implements BasePartIdentifier {
PART_1("0","˦"),
PART_2("1","˧"),
PART_3("2","˨"),
PART_1("˦","0"),
PART_2("˧","1"),
PART_3("˨","2"),
;
public static int LENGTH = 3;
private final String identifier;
private final String identifierTone;
private final String identifierLetter;
private T03PartTrit(String identifier, String identifierTone) {
this.identifier = identifier;
private T03PartTrit(String identifierTone, String identifierLetter) {
this.identifierTone = identifierTone;
}
@Override
public String getIdentifier() {
return identifier;
this.identifierLetter = identifierLetter;
}
@Override
@ -33,6 +28,11 @@ public enum T03PartTrit implements BasePartIdentifierTone {
return identifierTone;
}
@Override
public String getIdentifierLetter() {
return identifierLetter;
}
public static void forEach(Consumer<T03PartTrit> consumer) {
for (T03PartTrit value:values()) {
consumer.accept(value);

View file

@ -7,35 +7,25 @@ import java.util.function.Consumer;
* @author willemtsade ©Δ 仙上主天
*
*/
public enum T04PartQuad implements BasePartIdentifierAlt,BasePartIdentifierTone {
public enum T04PartQuad implements BasePartIdentifierAlt {
PART_1("0","N","˥"),
PART_2("1","E","˦"),
PART_3("2","W","˨"),
PART_4("3","S","˩"),
PART_1("˥","0","N"),
PART_2("˦","1","E"),
PART_3("˨","2","W"),
PART_4("˩","3","S"),
;
public static int LENGTH = 4;
private final String identifier;
private final String identifierAlt;
private final String identifierTone;
private final String identifierLetter;
private final String identifierAlt;
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
"Cardinal direction","https://simple.wikipedia.org/wiki/Cardinal_direction");
private T04PartQuad(String identifier, String identifierAlt, String identifierTone) {
this.identifier = identifier;
this.identifierAlt = identifierAlt;
private T04PartQuad(String identifierTone, String identifierLetter, String identifierAlt) {
this.identifierTone = identifierTone;
}
@Override
public String getIdentifier() {
return identifier;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
this.identifierLetter = identifierLetter;
this.identifierAlt = identifierAlt;
}
@Override
@ -43,6 +33,16 @@ public enum T04PartQuad implements BasePartIdentifierAlt,BasePartIdentifierTone
return identifierTone;
}
@Override
public String getIdentifierLetter() {
return identifierLetter;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
}
@Override
public BasePartIdentifierAltInfo getIdentifierAltInfo() {
return ALT_INFO;

View file

@ -7,36 +7,26 @@ import java.util.function.Consumer;
* @author willemtsade ©Δ 仙上主天
*
*/
public enum T05PartPental implements BasePartIdentifierAlt,BasePartIdentifierTone {
public enum T05PartPental implements BasePartIdentifierAlt {
PART_1("0","\u706b","˥"),
PART_2("1","\u571f","˦"),
PART_3("2","\u91d1","˧"),
PART_4("3","\u6c34","˨"),
PART_5("4","\u6728","˩"),
PART_1("˥","0","\u706b"),
PART_2("˦","1","\u571f"),
PART_3("˧","2","\u91d1"),
PART_4("˨","3","\u6c34"),
PART_5("˩","4","\u6728"),
;
public static int LENGTH = 5;
private final String identifier;
private final String identifierAlt; // escaped to keep normal line height in IDE
private final String identifierTone;
private final String identifierLetter;
private final String identifierAlt; // FIXME: escaped to keep normal line height in IDE
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
"Wuxing","https://en.wikipedia.org/wiki/Wuxing_(Chinese_philosophy)");
private T05PartPental(String identifier, String identifierAlt, String identifierTone) {
this.identifier = identifier;
this.identifierAlt = identifierAlt;
private T05PartPental(String identifierTone, String identifierLetter, String identifierAlt) {
this.identifierTone = identifierTone;
}
@Override
public String getIdentifier() {
return identifier;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
this.identifierLetter = identifierLetter;
this.identifierAlt = identifierAlt;
}
@Override
@ -44,6 +34,16 @@ public enum T05PartPental implements BasePartIdentifierAlt,BasePartIdentifierTon
return identifierTone;
}
@Override
public String getIdentifierLetter() {
return identifierLetter;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
}
@Override
public BasePartIdentifierAltInfo getIdentifierAltInfo() {
return ALT_INFO;

View file

@ -7,37 +7,27 @@ import java.util.function.Consumer;
* @author willemtsade ©Δ 仙上主天
*
*/
public enum T06PartSeximal implements BasePartIdentifierAlt,BasePartIdentifierTone {
public enum T06PartSeximal implements BasePartIdentifierAlt {
PART_1("0","A","˧˥"),
PART_2("1","D","˧˩"),
PART_3("2","F","˨˦"),
PART_4("3","G","˦˨"),
PART_5("4","V","˩˧"),
PART_6("5","X","˥˧"),
PART_1("˧˥","0","A"),
PART_2("˧˩","1","D"),
PART_3("˨˦","2","F"),
PART_4("˦˨","3","G"),
PART_5("˩˧","4","V"),
PART_6("˥˧","5","X"),
;
public static int LENGTH = 6;
private final String identifier;
private final String identifierAlt;
private final String identifierTone;
private final String identifierLetter;
private final String identifierAlt;
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
"ADFGVX cipher","https://en.wikipedia.org/wiki/ADFGVX_cipher");
private T06PartSeximal(String identifier, String identifierAlt, String identifierTone) {
this.identifier = identifier;
this.identifierAlt = identifierAlt;
private T06PartSeximal(String identifierTone, String identifierLetter, String identifierAlt) {
this.identifierTone = identifierTone;
}
@Override
public String getIdentifier() {
return identifier;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
this.identifierLetter = identifierLetter;
this.identifierAlt = identifierAlt;
}
@Override
@ -45,6 +35,16 @@ public enum T06PartSeximal implements BasePartIdentifierAlt,BasePartIdentifierTo
return identifierTone;
}
@Override
public String getIdentifierLetter() {
return identifierLetter;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
}
@Override
public BasePartIdentifierAltInfo getIdentifierAltInfo() {
return ALT_INFO;

View file

@ -7,50 +7,51 @@ import java.util.function.Consumer;
* @author willemtsade ©Δ 仙上主天
*
*/
public enum T08PartOctal implements BasePartIdentifierAlt, BasePartIdentifierTone {
public enum T08PartOctal implements BasePartIdentifierAlt {
PART_1("0","˧˥˩","˥˩˧", 0),
PART_2("1","˧˩˥","˩˥˧", 3),
PART_3("2","˧˥˦","˥˦˧", 6),
PART_4("3","˧˩˨","˩˨˧", 9),
PART_5("4","˧˦˦","˦˦˧", 12),
PART_6("5","˧˨˨","˨˨˧", 15),
PART_7("6","˧˥˥","˥˥˧", 18),
PART_8("7","˧˩˩","˩˩˧", 21),
PART_1("˧˥˩","0","˥˩˧", 0),
PART_2("˧˩˥","1","˩˥˧", 3),
PART_3("˧˥˦","2","˥˦˧", 6),
PART_4("˧˩˨","3","˩˨˧", 9),
PART_5("˧˦˦","4","˦˦˧", 12),
PART_6("˧˨˨","5","˨˨˧", 15),
PART_7("˧˥˥","6","˥˥˧", 18),
PART_8("˧˩˩","7","˩˩˧", 21),
;
public static int LENGTH = 8;
public static int BIT_COUNT = 3;
private static final byte BITMASK = 0x07;
private final String identifier;
private final String identifierAlt; // absolute
private final String identifierTone; // relative
private final String identifierTone; // absolute
private final String identifierLetter;
private final String identifierAlt; // relative
private final int shiftBits;
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
"Tone Letters","https://en.wikipedia.org/wiki/Tone_letter");
private T08PartOctal(String identifier, String identifierAlt, String identifierTone, int shiftBits) {
this.identifier = identifier;
this.identifierAlt = identifierAlt;
private T08PartOctal(String identifierTone, String identifierLetter, String identifierAlt, int shiftBits) {
this.identifierTone = identifierTone;
this.identifierLetter = identifierLetter;
this.identifierAlt = identifierAlt;
this.shiftBits = shiftBits;
}
@Override
public String getIdentifier() {
return identifier;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
}
@Override
public String getIdentifierTone() {
return identifierTone;
}
@Override
public String getIdentifierLetter() {
return identifierLetter;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
}
@Override
public BasePartIdentifierAltInfo getIdentifierAltInfo() {
return ALT_INFO;

View file

@ -9,34 +9,42 @@ import java.util.function.Consumer;
*/
public enum T12PartUncial implements BasePartIdentifierAlt {
PART_1("0","0"),
PART_2("1","1"),
PART_3("2","2"),
PART_4("3","3"),
PART_5("4","4"),
PART_6("5","5"),
PART_7("6","6"),
PART_8("7","7"),
PART_9("8","8"),
PART_10("9","9"),
PART_11("A","\u218a"), // TURNED DIGIT TWO
PART_12("B","\u218b"), // TURNED DIGIT THREE
// TODO: fixup tone letters for 12 parts
PART_1 ("˥","0","0"),
PART_2 ("˥","1","1"),
PART_3 ("˥","2","2"),
PART_4 ("˥","3","3"),
PART_5 ("˥","4","4"),
PART_6 ("˥","5","5"),
PART_7 ("˥","6","6"),
PART_8 ("˥","7","7"),
PART_9 ("˥","8","8"),
PART_10("˥","9","9"),
PART_11("˥","A","\u218a"), // TURNED DIGIT TWO
PART_12("˥","B","\u218b"), // TURNED DIGIT THREE
;
public static int LENGTH = 12;
private final String identifier;
private final String identifierTone;
private final String identifierLetter;
private final String identifierAlt;
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
"Transdecimal symbols","https://en.wikipedia.org/wiki/Duodecimal#Transdecimal_symbols");
private T12PartUncial(String identifier, String identifierAlt) {
this.identifier = identifier;
private T12PartUncial(String identifierTone, String identifierLetter, String identifierAlt) {
this.identifierTone = identifierTone;
this.identifierLetter = identifierLetter;
this.identifierAlt = identifierAlt;
}
@Override
public String getIdentifier() {
return identifier;
public String getIdentifierTone() {
return identifierTone;
}
@Override
public String getIdentifierLetter() {
return identifierLetter;
}
@Override

View file

@ -7,47 +7,37 @@ import java.util.function.Consumer;
* @author willemtsade ©Δ 仙上主天
*
*/
public enum T16PartHex implements BasePartIdentifierAlt, BasePartIdentifierTone {
public enum T16PartHex implements BasePartIdentifierAlt {
PART_1("0","1","˧˥˩"),
PART_2("1","2","˧˩˥"),
PART_3("2","3","˧˥˦"),
PART_4("3","A","˧˩˨"),
PART_5("4","4","˧˦˦"),
PART_6("5","5","˧˨˨"),
PART_7("6","6","˧˥˥"),
PART_8("7","B","˧˩˩"),
PART_9("8","7","˥˩˧"),
PART_10("9","8","˩˥˧"),
PART_11("A","9","˥˦˧"),
PART_12("B","C","˩˨˧"),
PART_13("C","*","˦˦˧"),
PART_14("D","0","˨˨˧"),
PART_15("E","#","˥˥˧"),
PART_16("F","D","˩˩˧"),
PART_1 ("˧˥˩","0","1"),
PART_2 ("˧˩˥","1","2"),
PART_3 ("˧˥˦","2","3"),
PART_4 ("˧˩˨","3","A"),
PART_5 ("˧˦˦","4","4"),
PART_6 ("˧˨˨","5","5"),
PART_7 ("˧˥˥","6","6"),
PART_8 ("˧˩˩","7","B"),
PART_9 ("˥˩˧","8","7"),
PART_10("˩˥˧","9","8"),
PART_11("˥˦˧","A","9"),
PART_12("˩˨˧","B","C"),
PART_13("˦˦˧","C","*"),
PART_14("˨˨˧","D","0"),
PART_15("˥˥˧","E","#"),
PART_16("˩˩˧","F","D"),
;
public static int LENGTH = 16;
private final String identifier;
private final String identifierAlt;
private final String identifierTone;
private final String identifierLetter;
private final String identifierAlt;
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
"Dual-tone multi-frequency signaling","https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling");
private T16PartHex(String identifier, String identifierAlt, String identifierTone) {
this.identifier = identifier;
this.identifierAlt = identifierAlt;
private T16PartHex(String identifierTone, String identifierLetter, String identifierAlt) {
this.identifierTone = identifierTone;
}
@Override
public String getIdentifier() {
return identifier;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
this.identifierLetter = identifierLetter;
this.identifierAlt = identifierAlt;
}
@Override
@ -55,6 +45,16 @@ public enum T16PartHex implements BasePartIdentifierAlt, BasePartIdentifierTone
return identifierTone;
}
@Override
public String getIdentifierLetter() {
return identifierLetter;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
}
@Override
public BasePartIdentifierAltInfo getIdentifierAltInfo() {
return ALT_INFO;

View file

@ -9,42 +9,50 @@ import java.util.function.Consumer;
*/
public enum T20PartScore implements BasePartIdentifierAlt {
PART_1("0","2"),
PART_2("1","3"),
PART_3("2","4"),
PART_4("3","5"),
PART_5("4","6"),
PART_6("5","7"),
PART_7("6","8"),
PART_8("7","9"),
PART_9("8","C"),
PART_10("9","F"),
PART_11("A","G"),
PART_12("B","H"),
PART_13("C","J"),
PART_14("D","M"),
PART_15("E","P"),
PART_16("F","Q"),
PART_17("G","R"),
PART_18("H","V"),
PART_19("I","W"),
PART_20("J","X"),
// TODO: fixup tone letters for 20 parts
PART_1 ("˥","0","2"),
PART_2 ("˦","1","3"),
PART_3 ("˧","2","4"),
PART_4 ("˨","3","5"),
PART_5 ("˩","4","6"),
PART_6 ("˥","5","7"),
PART_7 ("˥","6","8"),
PART_8 ("˥","7","9"),
PART_9 ("˥","8","C"),
PART_10("˥","9","F"),
PART_11("˥","A","G"),
PART_12("˥","B","H"),
PART_13("˥","C","J"),
PART_14("˥","D","M"),
PART_15("˥","E","P"),
PART_16("˥","F","Q"),
PART_17("˥","G","R"),
PART_18("˥","H","V"),
PART_19("˥","I","W"),
PART_20("˥","J","X"),
;
public static int LENGTH = 20;
private final String identifier;
private final String identifierTone;
private final String identifierLetter;
private final String identifierAlt;
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
"Open Location Code","https://en.wikipedia.org/wiki/Open_Location_Code");
private T20PartScore(String identifier, String identifierAlt) {
this.identifier = identifier;
private T20PartScore(String identifierTone, String identifierLetter, String identifierAlt) {
this.identifierTone = identifierTone;
this.identifierLetter = identifierLetter;
this.identifierAlt = identifierAlt;
}
@Override
public String getIdentifier() {
return identifier;
public String getIdentifierTone() {
return identifierTone;
}
@Override
public String getIdentifierLetter() {
return identifierLetter;
}
@Override