gdxapp4d/lib-numberxd/src/main/love/distributedrebirth/numberxd/glyph/BaseGlyphSet.java

247 lines
14 KiB
Java
Raw Normal View History

package love.distributedrebirth.numberxd.glyph;
2022-02-11 15:30:26 +01:00
import java.text.DecimalFormat;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnClassInfoʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinʸᴰ;
2022-02-06 17:35:37 +01:00
import love.distributedrebirth.bassboonyd.BãßBȍőnConstantsʸᴰ;
2022-02-06 17:19:05 +01:00
import love.distributedrebirth.bassboonyd.BãßBȍőnPackageInfoʸᴰ;
2022-02-11 15:30:26 +01:00
import love.distributedrebirth.bassboonyd.jmx.DefaultEnumSetᴶᴹˣ;
import love.distributedrebirth.bassboonyd.jmx.GuageCounterᴶᴹˣ;
import love.distributedrebirth.numberxd.base2t.part.T10PartDecimal;
import love.distributedrebirth.numberxd.base2t.part.T16PartHex;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
2022-02-03 01:11:45 +01:00
@BãßBȍőnClassInfoʸᴰ(name = "BaseGlyphSet", purpose = "The encoded base scripts.")
2022-02-06 17:19:05 +01:00
@BãßBȍőnPackageInfoʸᴰ(name = "love.distributedrebirth.numberxd")
2022-02-11 15:30:26 +01:00
public enum BaseGlyphSet implements DefaultEnumSetᴶᴹˣ<BaseGlyphSet,BãßBȍőnGlyphSetKeyʸᴰ> {
2022-02-03 13:21:40 +01:00
LATIN_BASIC(new BaseGlyphSetNumber(v -> T10PartDecimal.PART_1.BãßVoorElk(x -> v.add(Integer.toString(x.BȍőnRangTelNul())))),
new BaseGlyphSetNumber(v -> T16PartHex.PART_1.BãßVoorElk(x -> v.add(x.BȍőnAlt1Value()))),
new BaseGlyphSetNumber("1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R")),
2022-02-10 02:42:46 +01:00
LATIN_DTMF(new BaseGlyphSetNumber(v -> T10PartDecimal.PART_1.BãßVoorElk(x -> v.add(x.BȍőnChinaValue()))).withSeperator(BãßBȍőnConstantsʸᴰ.STR_SPACE),
new BaseGlyphSetNumber("1","2","3","A","4","5","6","B","7","8","9","C","*","0","#","D"),
2022-02-11 15:30:26 +01:00
LATIN_BASIC.BȍőnGlyphSetNumber27()),
2022-02-10 02:42:46 +01:00
LATIN_TOP(new BaseGlyphSetNumber("","¹","²","³","","","","","",""),
new BaseGlyphSetNumber("","¹","²","³","","","","","","","","","","","",""),
new BaseGlyphSetNumber("¹","²","³","","","","","","","","","","","","","","","","","","","","","","","Q","ᴿ")),
2022-02-10 02:42:46 +01:00
LATIN_SUB(new BaseGlyphSetNumber("","","","","","","","","",""),
new BaseGlyphSetNumber("","","","","","","","","","","","","","","","բ"),
new BaseGlyphSetNumber("","","","","","","","","","","","","","","բ","G","","","","","","","","","","Q","")),
2022-02-10 02:42:46 +01:00
LATIN_TOPHEX(LATIN_BASIC.BȍőnGlyphSetNumber10(),
LATIN_BASIC.BȍőnGlyphSetNumber16().withAltGlyphSet(LATIN_TOP),
2022-02-11 15:30:26 +01:00
LATIN_BASIC.BȍőnGlyphSetNumber27()),
2022-02-10 02:42:46 +01:00
TONE_SCRIPT(new BaseGlyphSetNumber(v -> T10PartDecimal.PART_1.BãßVoorElk(x -> v.add(x.BȍőnDialTone()))),
2022-02-05 16:25:41 +01:00
new BaseGlyphSetNumber(v -> T16PartHex.PART_1.BãßVoorElk(x -> v.add(x.BȍőnDialTone()))),
new BaseGlyphSetNumber("꜊꜈","꜊꜉","꜊꜋","꜊꜌","꜊꜍","꜊꜎","꜊꜏","꜊꜐","꜊꜑","˧˥","˧˦","˧˨","˧˩","˧꜒","˧꜓","˧꜔","˧꜕","˧꜖","꜏˥","꜏˦","꜏˧","꜏˨","꜏˩","꜏꜍","꜏꜎","꜏꜐","꜏꜑")),
2022-02-10 02:42:46 +01:00
DIPAVALI_LRPATH_TOPHEX(new BaseGlyphSetNumber(v -> T10PartDecimal.PART_1.BãßVoorElk(x -> v.add(x.BȍőnAlt1Value()))),
new BaseGlyphSetNumber("˧˥˩","˧˩˥","˧˥˦","˧˩˨","˧˦˦","˧˨˨","˧˥˥","˧˩˩","˥˩˧","˩˥˧","˥˦˧","˩˨˧","˦˦˧","˨˨˧","˥˥˧","˩˩˧").withAltGlyphSet(BaseGlyphSet.LATIN_TOP),
2022-02-11 15:30:26 +01:00
TONE_SCRIPT.BȍőnGlyphSetNumber27()),
2022-02-10 02:42:46 +01:00
DIPAVALI_LRPATH_SUBHEX(new BaseGlyphSetNumber(v -> T10PartDecimal.PART_1.BãßVoorElk(x -> v.add(x.BȍőnAlt1Value()))),
new BaseGlyphSetNumber("˧˥˩","˧˩˥","˧˥˦","˧˩˨","˧˦˦","˧˨˨","˧˥˥","˧˩˩","˥˩˧","˩˥˧","˥˦˧","˩˨˧","˦˦˧","˨˨˧","˥˥˧","˩˩˧").withAltGlyphSet(BaseGlyphSet.LATIN_SUB),
2022-02-11 15:30:26 +01:00
TONE_SCRIPT.BȍőnGlyphSetNumber27()),
2022-02-10 02:42:46 +01:00
DIPAVALI_RLPATH_TOPHEX(new BaseGlyphSetNumber(v -> T10PartDecimal.PART_1.BãßVoorElk(x -> v.add(x.BȍőnAlt2Value()))),
new BaseGlyphSetNumber("꜔꜒꜖","꜔꜖꜒","꜔꜒꜓","꜔꜖꜕","꜔꜓꜓","꜔꜕꜕","꜔꜒꜒","꜔꜖꜖","꜒꜖꜔","꜖꜒꜔","꜒꜓꜔","꜖꜕꜔","꜓꜓꜔","꜕꜕꜔","꜒꜒꜔","꜖꜖꜔").withAltGlyphSet(BaseGlyphSet.LATIN_TOP),
2022-02-11 15:30:26 +01:00
TONE_SCRIPT.BȍőnGlyphSetNumber27()),
2022-02-10 02:42:46 +01:00
DIPAVALI_RLPATH_SUBHEX(new BaseGlyphSetNumber(v -> T10PartDecimal.PART_1.BãßVoorElk(x -> v.add(x.BȍőnAlt2Value()))),
new BaseGlyphSetNumber("꜔꜒꜖","꜔꜖꜒","꜔꜒꜓","꜔꜖꜕","꜔꜓꜓","꜔꜕꜕","꜔꜒꜒","꜔꜖꜖","꜒꜖꜔","꜖꜒꜔","꜒꜓꜔","꜖꜕꜔","꜓꜓꜔","꜕꜕꜔","꜒꜒꜔","꜖꜖꜔").withAltGlyphSet(BaseGlyphSet.LATIN_SUB),
2022-02-11 15:30:26 +01:00
TONE_SCRIPT.BȍőnGlyphSetNumber27()),
2022-02-10 02:42:46 +01:00
GREEK(new BaseGlyphSetNumber("ō","α","β","γ","δ","ε","ϝ","ζ","η","θ"),
new BaseGlyphSetNumber("ō","α","β","γ","δ","ε","ϝ","ζ","η","θ","ι","κ","λ","μ","ν","ξ"),
2022-02-11 13:48:55 +01:00
new BaseGlyphSetNumber("α","β","γ","δ","ε","ϝ","ζ","η","θ","ι","κ","λ","μ","ν","ξ","ο","π","ϟ","ρ","σ","τ","υ","φ","χ","ψ","ω","ϡ")),
2022-02-10 02:42:46 +01:00
BENGALI(new BaseGlyphSetNumber("","","","","","","","","",""),
new BaseGlyphSetNumber("","","","","","","","","","","জ্ঞ","ক্ষ","","","",""),
2022-02-11 13:48:55 +01:00
new BaseGlyphSetNumber("","","","","","","","","","","","","","","","","","","","","","","","","","","")),
2022-02-11 02:46:44 +01:00
THAI(new BaseGlyphSetNumber("","","","","","","","","",""),
new BaseGlyphSetNumber("","","","","","","","","","","","","","","",""),
2022-02-11 13:48:55 +01:00
new BaseGlyphSetNumber("","","","","","","","","","","","","","","","","","","","","","","","","","","")),
2022-02-10 02:42:46 +01:00
RUNIC(new BaseGlyphSetNumber("","","","","","","","","",""),
new BaseGlyphSetNumber("","","","","","","","","","","","","","","",""),
2022-02-11 13:48:55 +01:00
new BaseGlyphSetNumber("","","","","","","","","","","","","","","","","","","","","","","","","","","")),
RUNIC_TOPHEX(RUNIC.BȍőnGlyphSetNumber10(),
RUNIC.BȍőnGlyphSetNumber16().withAltGlyphSet(LATIN_TOP),
2022-02-11 15:30:26 +01:00
RUNIC.BȍőnGlyphSetNumber27()),
KOREAN(new BaseGlyphSetNumber("","","","","","","","","",""),
2022-02-10 02:42:46 +01:00
new BaseGlyphSetNumber("","","","","","","","","","","","","","","",""),
2022-02-11 13:48:55 +01:00
new BaseGlyphSetNumber("","","","","","","","","","","","","","","","","","","","","","","","","","","")),
KOREAN_TOPHEX(KOREAN.BȍőnGlyphSetNumber10(),
KOREAN.BȍőnGlyphSetNumber16().withAltGlyphSet(LATIN_TOP),
2022-02-11 15:30:26 +01:00
KOREAN.BȍőnGlyphSetNumber27()),
2022-02-10 02:42:46 +01:00
2022-02-11 02:46:44 +01:00
CHINA(
new BaseGlyphSetNumber("","","","","","","","","",""), LATIN_BASIC.BȍőnGlyphSetNumber16(), null),
CHINA_FORMAL(
new BaseGlyphSetNumber(v -> T10PartDecimal.PART_1.BãßVoorElk(x -> v.add(x.BȍőnChinaKey()))), LATIN_BASIC.BȍőnGlyphSetNumber16(), null),
CHINA_FORMAL_OLD(
new BaseGlyphSetNumber("","","","","","","","","",""), LATIN_BASIC.BȍőnGlyphSetNumber16(), null),
JAPAN(
CHINA.BȍőnGlyphSetNumber10(), LATIN_BASIC.BȍőnGlyphSetNumber16(), null),
JAPAN_FORMAL(
new BaseGlyphSetNumber("","","","","","","","","",""), LATIN_BASIC.BȍőnGlyphSetNumber16(), null),
2022-02-11 13:48:55 +01:00
CYRILLIC(new BaseGlyphSetNumber("Ф","А","В","Г","Д","Є","Ѕ","З","И","Ѳ"),
LATIN_BASIC.BȍőnGlyphSetNumber16(),
new BaseGlyphSetNumber("А","В","Г","Д","Є","Ѕ","З","И","Ѳ","І","К","Л","М","Н","Ѯ","Ѻ","П","Ч","Р","С","Т","Ѵ","Ф","Х","Ѱ","Ѿ","Ц")),
ARABIC(new BaseGlyphSetNumber("٠","١","٢","٣","٤","٥","٦","٧","٨","٩"),
LATIN_BASIC.BȍőnGlyphSetNumber16(),
2022-02-11 15:30:26 +01:00
new BaseGlyphSetNumber("ا","ب","ج","د","ه","و","ز","ح","ط","ي","ك","ل","م","ن","س","ع","ف","ص","ق","ر","ش","ت","ث","خ","ذ","ض","ظ"),
true),
2022-02-06 17:35:37 +01:00
HEBREW(new BaseGlyphSetNumber("אֶפֶס","אֶחָד","שְׁתַּיִם","שְׁלֹשָׁה","אַרְבַּע‎","חֲמִשָּׁה‎","שֵׁשׁ‎","שִׁבְעָה","שְׁמוֹנֶה","תִּשְׁעָה‎").withSeperator(BãßBȍőnConstantsʸᴰ.STR_SPACE),
LATIN_BASIC.BȍőnGlyphSetNumber16(),
2022-02-11 15:30:26 +01:00
new BaseGlyphSetNumber("א","ב","ג","ד","ה","ו","ז","ח","ט","י","כ","ל","מ","נ","ס ","ע","פ","צ","ק","ר","ש","ת","ך","ם","ן","ף","ץ"),
true),
;
2022-02-11 15:30:26 +01:00
private final GuageCounterᴶᴹˣ printsGlyphSetNumber10;
private final GuageCounterᴶᴹˣ printsGlyphSetNumber16;
private final GuageCounterᴶᴹˣ printsGlyphSetNumber27;
private final BãßBȍőnCoffinOpenʸᴰ<BãßBȍőnGlyphSetKeyʸᴰ> BBC = BãßBȍőnCoffinOpenʸᴰ.newInstance();
public BãßBȍőnCoffinʸᴰ<BãßBȍőnGlyphSetKeyʸᴰ> GET_BBC() { return BBC; }
public static int LENGTH() { return values().length; };
private BaseGlyphSet(BaseGlyphSetNumber numbers) {
this(numbers, null, null);
}
private BaseGlyphSet(BaseGlyphSetNumber numbers, BaseGlyphSetNumber hex, BaseGlyphSetNumber gematria) {
2022-02-11 15:30:26 +01:00
this(numbers, hex, gematria, false);
}
private BaseGlyphSet(BaseGlyphSetNumber numbers, BaseGlyphSetNumber hex, BaseGlyphSetNumber gematria, Boolean reverseScript) {
BBC.PUT_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.NUMBERS, numbers);
BBC.PUT_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.HEXIMALS, hex);
BBC.PUT_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.GEMATRIA, gematria);
2022-02-11 15:30:26 +01:00
BBC.PUT_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.REVERSE_SCRIPT, reverseScript); // TODO: ImGui workaround
2022-02-06 15:49:32 +01:00
BBC.BOON_INIT(this);
2022-02-06 17:19:05 +01:00
this.BȍőnJmxInit(BãßBȍőnGlyphSetKeyʸᴰ.JMX);
2022-02-11 15:30:26 +01:00
printsGlyphSetNumber10 = BȍőnJmxInitGuageCounter(BãßBȍőnGlyphSetKeyʸᴰ.JMX, "printsGlyphSetNumber10");
printsGlyphSetNumber16 = BȍőnJmxInitGuageCounter(BãßBȍőnGlyphSetKeyʸᴰ.JMX, "printsGlyphSetNumber16");
printsGlyphSetNumber27 = BȍőnJmxInitGuageCounter(BãßBȍőnGlyphSetKeyʸᴰ.JMX, "printsGlyphSetNumber27");
}
public BaseGlyphSetNumber BȍőnGlyphSetNumber10() {
return GET_BBC().GET_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.NUMBERS, BaseGlyphSetNumber.class);
}
public BaseGlyphSetNumber BȍőnGlyphSetNumber16() {
return GET_BBC().GET_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.HEXIMALS, BaseGlyphSetNumber.class);
}
public BaseGlyphSetNumber BȍőnGlyphSetNumber27() {
return GET_BBC().GET_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.GEMATRIA, BaseGlyphSetNumber.class);
}
public Boolean BȍőnGlyphSetReverseScript() {
return GET_BBC().GET_BOOL(BãßBȍőnGlyphSetKeyʸᴰ.REVERSE_SCRIPT);
}
2022-02-10 14:45:52 +01:00
public String BȍőnConvertTo(String numbers) {
StringBuilder buf = new StringBuilder();
for (char c:numbers.toCharArray()) {
for (BaseGlyphSet set:values()) {
int loc = set.BȍőnGlyphSetNumber10().BȍőnIndexOf(""+c);
if (loc != -1) {
buf.append(set.BȍőnGlyphSetNumber10().BȍőnCharFor(loc));
}
}
}
return buf.toString();
}
2022-02-11 15:30:26 +01:00
public String BȍőnPrintGlyphSetNumber10(int number, int numberMax) {
printsGlyphSetNumber10.increment();
String maxDigitNumber = Integer.toString(numberMax);
StringBuilder maxDigitFormat = new StringBuilder();
for (int i=0;i<maxDigitNumber.length();i++) {
maxDigitFormat.append("0");
}
String numberStr = new DecimalFormat(maxDigitFormat.toString()).format(number);
StringBuilder buf = new StringBuilder();
for (int i=0;i<numberStr.length();i++) {
char c = numberStr.charAt(i);
int numberDigit = c - '0';
buf.append(BȍőnGlyphSetNumber10().BȍőnCharFor(numberDigit));
if (i<numberStr.length() - 1) {
buf.append(BȍőnGlyphSetNumber10().BȍőnCharSeperator());
}
}
if (BȍőnGlyphSetReverseScript()) {
return buf.reverse().toString();
}
return buf.toString();
}
public String BȍőnPrintGlyphSetNumber16(int number, int numberMax) {
printsGlyphSetNumber16.increment();
String maxDigitNumber = Integer.toHexString(numberMax);
String numberStr = Integer.toHexString(number);
StringBuilder buf = new StringBuilder();
BaseGlyphSet printSet = this;
for (int i=numberStr.length();i<maxDigitNumber.length();i++) {
buf.append(printSet.BȍőnGlyphSetNumber16().BȍőnCharFor(0));
if (i==numberStr.length() && BȍőnGlyphSetNumber16().BȍőnAltGlyphSet() != null) {
printSet = BȍőnGlyphSetNumber16().BȍőnAltGlyphSet();
}
}
for (int i=0;i<numberStr.length();i++) {
char c = numberStr.charAt(i);
int numberDigit = 0;
if (c >= 'a') {
numberDigit = c - 'a' + 10;
} else {
numberDigit = c - '0';
}
buf.append(printSet.BȍőnGlyphSetNumber16().BȍőnCharFor(numberDigit));
if (i<numberStr.length() - 1) {
buf.append(printSet.BȍőnGlyphSetNumber16().BȍőnCharSeperator());
}
if (i==0 && BȍőnGlyphSetNumber16().BȍőnAltGlyphSet() != null) {
printSet = BȍőnGlyphSetNumber16().BȍőnAltGlyphSet();
}
}
if (BȍőnGlyphSetReverseScript()) {
return buf.reverse().toString();
}
return buf.toString();
}
public String BȍőnPrintGlyphSetNumber27(int number, int numberMax) {
printsGlyphSetNumber27.increment();
String maxDigitNumber = Integer.toString(numberMax, 27);
String numberStr = Integer.toString(number, 27);
StringBuilder buf = new StringBuilder();
BaseGlyphSet printSet = this;
for (int i=numberStr.length();i<maxDigitNumber.length();i++) {
buf.append(printSet.BȍőnGlyphSetNumber27().BȍőnCharFor(0));
if (i==numberStr.length() && BȍőnGlyphSetNumber27().BȍőnAltGlyphSet() != null) {
printSet = BȍőnGlyphSetNumber27().BȍőnAltGlyphSet();
}
}
for (int i=0;i<numberStr.length();i++) {
char c = numberStr.charAt(i);
int numberDigit = 0;
if (c >= 'a') {
numberDigit = c - 'a' + 10;
} else {
numberDigit = c - '0';
}
buf.append(printSet.BȍőnGlyphSetNumber27().BȍőnCharFor(numberDigit));
if (i<numberStr.length() - 1) {
buf.append(printSet.BȍőnGlyphSetNumber27().BȍőnCharSeperator());
}
if (i==0 && BȍőnGlyphSetNumber27().BȍőnAltGlyphSet() != null) {
printSet = BȍőnGlyphSetNumber27().BȍőnAltGlyphSet();
}
}
if (BȍőnGlyphSetReverseScript()) {
return buf.reverse().toString(); // TODO: ImGui workaround
}
return buf.toString();
}
}