From ef1f14b55aed041948fc7d59cdf4b59c78a4fd3e Mon Sep 17 00:00:00 2001 From: Willem Cazander Date: Sat, 29 Jan 2022 10:59:14 +0100 Subject: [PATCH] Prepared tone id for leading in (bin) xml storage. --- .../demo4d/base2t/BasePartIdentifier.java | 4 +- .../demo4d/base2t/BasePartIdentifierTone.java | 11 ---- .../demo4d/base2t/T02PartBinary.java | 22 +++---- .../demo4d/base2t/T03PartTrit.java | 24 +++---- .../demo4d/base2t/T04PartQuad.java | 40 ++++++------ .../demo4d/base2t/T05PartPental.java | 42 ++++++------ .../demo4d/base2t/T06PartSeximal.java | 44 ++++++------- .../demo4d/base2t/T08PartOctal.java | 51 +++++++-------- .../demo4d/base2t/T12PartUncial.java | 42 +++++++----- .../demo4d/base2t/T16PartHex.java | 64 +++++++++---------- .../demo4d/base2t/T20PartScore.java | 58 +++++++++-------- 11 files changed, 205 insertions(+), 197 deletions(-) delete mode 100644 core/src/love/distributedrebirth/demo4d/base2t/BasePartIdentifierTone.java diff --git a/core/src/love/distributedrebirth/demo4d/base2t/BasePartIdentifier.java b/core/src/love/distributedrebirth/demo4d/base2t/BasePartIdentifier.java index a4d65a87..a252ec4b 100644 --- a/core/src/love/distributedrebirth/demo4d/base2t/BasePartIdentifier.java +++ b/core/src/love/distributedrebirth/demo4d/base2t/BasePartIdentifier.java @@ -7,5 +7,7 @@ package love.distributedrebirth.demo4d.base2t; */ public interface BasePartIdentifier { - String getIdentifier(); + String getIdentifierTone(); + + String getIdentifierLetter(); } diff --git a/core/src/love/distributedrebirth/demo4d/base2t/BasePartIdentifierTone.java b/core/src/love/distributedrebirth/demo4d/base2t/BasePartIdentifierTone.java deleted file mode 100644 index 4e0d8d8c..00000000 --- a/core/src/love/distributedrebirth/demo4d/base2t/BasePartIdentifierTone.java +++ /dev/null @@ -1,11 +0,0 @@ -package love.distributedrebirth.demo4d.base2t; - -/** - * - * @author willemtsade ©Δ∞ 仙上主天 - * - */ -public interface BasePartIdentifierTone extends BasePartIdentifier { - - String getIdentifierTone(); -} diff --git a/core/src/love/distributedrebirth/demo4d/base2t/T02PartBinary.java b/core/src/love/distributedrebirth/demo4d/base2t/T02PartBinary.java index 9541d967..81d66076 100644 --- a/core/src/love/distributedrebirth/demo4d/base2t/T02PartBinary.java +++ b/core/src/love/distributedrebirth/demo4d/base2t/T02PartBinary.java @@ -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 consumer) { for (T02PartBinary value:values()) { consumer.accept(value); diff --git a/core/src/love/distributedrebirth/demo4d/base2t/T03PartTrit.java b/core/src/love/distributedrebirth/demo4d/base2t/T03PartTrit.java index 8fdf508e..f16d95b9 100644 --- a/core/src/love/distributedrebirth/demo4d/base2t/T03PartTrit.java +++ b/core/src/love/distributedrebirth/demo4d/base2t/T03PartTrit.java @@ -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 consumer) { for (T03PartTrit value:values()) { consumer.accept(value); diff --git a/core/src/love/distributedrebirth/demo4d/base2t/T04PartQuad.java b/core/src/love/distributedrebirth/demo4d/base2t/T04PartQuad.java index b78004de..f6418411 100644 --- a/core/src/love/distributedrebirth/demo4d/base2t/T04PartQuad.java +++ b/core/src/love/distributedrebirth/demo4d/base2t/T04PartQuad.java @@ -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; diff --git a/core/src/love/distributedrebirth/demo4d/base2t/T05PartPental.java b/core/src/love/distributedrebirth/demo4d/base2t/T05PartPental.java index 98f73917..56c0d39e 100644 --- a/core/src/love/distributedrebirth/demo4d/base2t/T05PartPental.java +++ b/core/src/love/distributedrebirth/demo4d/base2t/T05PartPental.java @@ -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; diff --git a/core/src/love/distributedrebirth/demo4d/base2t/T06PartSeximal.java b/core/src/love/distributedrebirth/demo4d/base2t/T06PartSeximal.java index 14675365..dd10fa82 100644 --- a/core/src/love/distributedrebirth/demo4d/base2t/T06PartSeximal.java +++ b/core/src/love/distributedrebirth/demo4d/base2t/T06PartSeximal.java @@ -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; diff --git a/core/src/love/distributedrebirth/demo4d/base2t/T08PartOctal.java b/core/src/love/distributedrebirth/demo4d/base2t/T08PartOctal.java index 3674b37e..a5b50d17 100644 --- a/core/src/love/distributedrebirth/demo4d/base2t/T08PartOctal.java +++ b/core/src/love/distributedrebirth/demo4d/base2t/T08PartOctal.java @@ -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; diff --git a/core/src/love/distributedrebirth/demo4d/base2t/T12PartUncial.java b/core/src/love/distributedrebirth/demo4d/base2t/T12PartUncial.java index bceb694e..446af3cf 100644 --- a/core/src/love/distributedrebirth/demo4d/base2t/T12PartUncial.java +++ b/core/src/love/distributedrebirth/demo4d/base2t/T12PartUncial.java @@ -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 diff --git a/core/src/love/distributedrebirth/demo4d/base2t/T16PartHex.java b/core/src/love/distributedrebirth/demo4d/base2t/T16PartHex.java index d1677fe9..7e897ec8 100644 --- a/core/src/love/distributedrebirth/demo4d/base2t/T16PartHex.java +++ b/core/src/love/distributedrebirth/demo4d/base2t/T16PartHex.java @@ -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; diff --git a/core/src/love/distributedrebirth/demo4d/base2t/T20PartScore.java b/core/src/love/distributedrebirth/demo4d/base2t/T20PartScore.java index 5031930c..58040831 100644 --- a/core/src/love/distributedrebirth/demo4d/base2t/T20PartScore.java +++ b/core/src/love/distributedrebirth/demo4d/base2t/T20PartScore.java @@ -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