Moved broken number render code, todo fix

This commit is contained in:
Willem 2022-02-05 14:43:14 +01:00
parent bc02b51d7d
commit dff7e98cc0
5 changed files with 249 additions and 121 deletions

View file

@ -18,4 +18,100 @@ public interface BãßBȍőnGlyphSetʸᴰ<T extends BãßBȍőnGlyphSetʸᴰ<T>>
default BaseGlyphSetNumber BȍőnGlyphSetNumber36() {
return GET_BBC().GET_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.GEMATRIA, BaseGlyphSetNumber.class);
}
default String BȍőnPrintGlyphSetNumber10(int number, int numberMax) {
StringBuilder buf = new StringBuilder();
if (numberMax < 10) {
buf.append(BȍőnGlyphSetNumber10().BȍőnCharFor(number));
} else if (numberMax < 100) {
int count = number;
int mod10 = count % 10;
int div10 = count / 10 % 10;
buf.append(BȍőnGlyphSetNumber10().BȍőnCharFor(div10));
buf.append(BȍőnGlyphSetNumber10().BȍőnCharSeperator());
buf.append(BȍőnGlyphSetNumber10().BȍőnCharFor(mod10));
} else if (numberMax < 1000) {
int count = number;
int mod10 = count % 10;
int div10 = count / 10 % 10;
int div100 = count / 100 % 10;
buf.append(BȍőnGlyphSetNumber10().BȍőnCharFor(div10));
buf.append(BȍőnGlyphSetNumber10().BȍőnCharSeperator());
buf.append(BȍőnGlyphSetNumber10().BȍőnCharFor(div100));
buf.append(BȍőnGlyphSetNumber10().BȍőnCharSeperator());
buf.append(BȍőnGlyphSetNumber10().BȍőnCharFor(mod10));
} else {
throw new IllegalStateException("Can't handle more than 1000 values.");
}
if (BaseGlyphSet.HEBREW.equals(this)) {
return buf.reverse().toString(); // TODO: ImGui workaround
}
return buf.toString();
}
default String BȍőnPrintGlyphSetNumber16(int number, int numberMax) {
//BãßBȍőnGlyphSetʸᴰ<T> glyphSet = this;
StringBuilder buf = new StringBuilder();
if (numberMax < 16) {
buf.append(BȍőnGlyphSetNumber16().BȍőnCharFor(number));
} else if (numberMax < 256) {
buf.append(BȍőnGlyphSetNumber16().BȍőnCharFor(number >> 4));
buf.append(BȍőnGlyphSetNumber16().BȍőnCharSeperator());
BaseGlyphSet secondGlyphSet = BȍőnGlyphSetNumber16().BȍőnAltGlyphSet();
if (secondGlyphSet != null) {
buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor(number & 0x0F));
} else {
buf.append(BȍőnGlyphSetNumber16().BȍőnCharFor(number & 0x0F));
}
} else if (numberMax < 0xFFF+1) {
buf.append(BȍőnGlyphSetNumber16().BȍőnCharFor((number >> 8) & 0x0F));
buf.append(BȍőnGlyphSetNumber16().BȍőnCharSeperator());
BaseGlyphSet secondGlyphSet = BȍőnGlyphSetNumber16().BȍőnAltGlyphSet();
if (secondGlyphSet != null) {
buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor((number >> 4) & 0x0F));
buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharSeperator());
buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor(number & 0x0F));
} else {
buf.append(BȍőnGlyphSetNumber16().BȍőnCharFor((number >> 4) & 0x0F));
buf.append(BȍőnGlyphSetNumber16().BȍőnCharSeperator());
buf.append(BȍőnGlyphSetNumber16().BȍőnCharFor(number & 0x0F));
}
} else {
throw new IllegalStateException("Can't handle more than 0xFFF values.");
}
if (BaseGlyphSet.HEBREW.equals(this)) {
return buf.reverse().toString(); // TODO: ImGui workaround
}
return buf.toString();
}
default String BȍőnPrintGlyphSetNumber36(int number, int numberMax) {
StringBuilder buf = new StringBuilder();
if (numberMax < 9) {
buf.append(BȍőnGlyphSetNumber36().BȍőnCharFor36(number + 1));
} else if (numberMax < 99) {
int count = number + 1;
int mod10 = (count % 9) + 1;
int div10 = ((count / 9) % 9) + 1;
buf.append(BȍőnGlyphSetNumber36().BȍőnCharFor36(div10));
buf.append(BȍőnGlyphSetNumber36().BȍőnCharSeperator());
buf.append(BȍőnGlyphSetNumber36().BȍőnCharFor36(mod10));
} else if (numberMax < 999) {
int count = number;
int mod10 = (count % 9) + 1;
int div10 = ((count / 90) & 9) + 1;
int div100 = ((count / 900) & 9) + 1;
buf.append(BȍőnGlyphSetNumber36().BȍőnCharFor36(div10));
buf.append(BȍőnGlyphSetNumber36().BȍőnCharSeperator());
buf.append(BȍőnGlyphSetNumber36().BȍőnCharFor36(div100));
buf.append(BȍőnGlyphSetNumber36().BȍőnCharSeperator());
buf.append(BȍőnGlyphSetNumber36().BȍőnCharFor36(mod10));
} else {
throw new IllegalStateException("Can't handle more than 1000 values.");
}
if (BaseGlyphSet.HEBREW.equals(this)) {
return buf.reverse().toString(); // TODO: ImGui workaround
}
return buf.toString();
}
}

View file

@ -35,100 +35,6 @@ public interface BãßBȍőnPartʸᴰ<T extends BãßBȍőnPartʸᴰ<T>> extends
return GET_BBC().GET_STR(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE);
}
default String BȍőnGlyphSetNumber10(BaseGlyphSet glyphSet) {
StringBuilder buf = new StringBuilder();
T[] values = BãßInstances();
if (values.length <= 10) {
buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharFor(BȍőnRangTelNul()));
} else if (values.length <= 100) {
int count = BȍőnRangTelNul();
int mod10 = count % 10;
int div10 = count / 10;
buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharFor(div10));
buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharSeperator());
buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharFor(mod10));
} else if (values.length <= 1000) {
int count = BȍőnRangTelNul();
int mod10 = count % 10;
int div10 = count / 10;
int div100 = count / 100;
buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharFor(div10));
buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharSeperator());
buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharFor(div100));
buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharSeperator());
buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharFor(mod10));
} else {
throw new IllegalStateException("Can't handle more than 1000 values.");
}
if (BaseGlyphSet.HEBREW.equals(glyphSet)) {
return buf.reverse().toString(); // TODO: ImGui workaround
}
return buf.toString();
}
default String BȍőnGlyphSetNumber16(BaseGlyphSet glyphSet) {
StringBuilder buf = new StringBuilder();
T[] values = BãßInstances();
if (values.length <= 16) {
buf.append(glyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor(BȍőnRangTelNul()));
} else if (values.length <= 256) {
buf.append(glyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor(BȍőnRangTelNul() >> 4));
buf.append(glyphSet.BȍőnGlyphSetNumber16().BȍőnCharSeperator());
BaseGlyphSet secondGlyphSet = glyphSet.BȍőnGlyphSetNumber16().BȍőnAltGlyphSet();
if (secondGlyphSet == null) {
secondGlyphSet = glyphSet;
}
buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor(BȍőnRangTelNul() & 0x0F));
} else if (values.length <= 0xFFF+1) {
buf.append(glyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor((BȍőnRangTelNul() >> 8) & 0x0F));
buf.append(glyphSet.BȍőnGlyphSetNumber16().BȍőnCharSeperator());
BaseGlyphSet secondGlyphSet = glyphSet.BȍőnGlyphSetNumber16().BȍőnAltGlyphSet();
if (secondGlyphSet == null) {
secondGlyphSet = glyphSet;
}
buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor((BȍőnRangTelNul() >> 4) & 0x0F));
buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharSeperator());
buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor(BȍőnRangTelNul() & 0x0F));
} else {
throw new IllegalStateException("Can't handle more than 0xFFF values.");
}
if (BaseGlyphSet.HEBREW.equals(glyphSet)) {
return buf.reverse().toString(); // TODO: ImGui workaround
}
return buf.toString();
}
default String BȍőnGlyphSetNumber36(BaseGlyphSet glyphSet) {
StringBuilder buf = new StringBuilder();
T[] values = BãßInstances();
if (values.length <= 9) {
buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharFor36(BȍőnRangTelEen()));
} else if (values.length <= 99) {
int count = BȍőnRangTelNul();
int mod10 = count % 9 + 1;
int div10 = count / 9 + 1;
buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharFor36(div10));
buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharSeperator());
buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharFor36(mod10));
} else if (values.length <= 999) {
int count = BȍőnRangTelNul();
int mod10 = count % 9 + 1;
int div10 = count / 90 + 1;
int div100 = count / 900 + 1;
buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharFor36(div10));
buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharSeperator());
buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharFor36(div100));
buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharSeperator());
buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharFor36(mod10));
} else {
throw new IllegalStateException("Can't handle more than 1000 values.");
}
if (BaseGlyphSet.HEBREW.equals(glyphSet)) {
return buf.reverse().toString(); // TODO: ImGui workaround
}
return buf.toString();
}
@SuppressWarnings("unchecked")
default T BãßValueOfTone(String identifierTone) {
Map<String,Object> mapTone = GET_BBC().GET_MAP_OBJ(BãßBȍőnPartKeyʸᴰ.MAP_TONE);
@ -146,4 +52,16 @@ public interface BãßBȍőnPartʸᴰ<T extends BãßBȍőnPartʸᴰ<T>> extends
}
return (T) mapChina.get(chinaKey);
}
default String BȍőnPrintGlyphSetNumber10(BaseGlyphSet glyphSet) {
return glyphSet.BȍőnPrintGlyphSetNumber10(BȍőnRangTelNul(), BãßInstances().length);
}
default String BȍőnPrintGlyphSetNumber16(BaseGlyphSet glyphSet) {
return glyphSet.BȍőnPrintGlyphSetNumber16(BȍőnRangTelNul(), BãßInstances().length);
}
default String BȍőnPrintGlyphSetNumber36(BaseGlyphSet glyphSet) {
return glyphSet.BȍőnPrintGlyphSetNumber36(BȍőnRangTelNul(), BãßInstances().length);
}
}