This commit is contained in:
Willem Cazander 2022-02-02 18:55:21 +01:00
parent 4bfb7b94eb
commit f959704f08
19 changed files with 66 additions and 46 deletions

View file

@ -37,14 +37,14 @@ public class BasePartRenderer extends ImGuiRendererMain {
ImGui.begin("Base part", widgetOpen);
List<String> bases = new ArrayList<>();
for (int base:BasePartFactory.getSupportedBases()) {
for (int base:BasePartFactory.INSTANCE.BãßBases()) {
bases.add(Integer.toString(base));
}
String[] items = new String[bases.size()];
items = bases.toArray(items);
String selectedItem = items[selectedBasePart.get()];
Integer baseNumber = Integer.valueOf(selectedItem);
BãßBȍőnPartʸᴰ<?>[] baseParts = BasePartFactory.buildBassBonesByBase(baseNumber);
BãßBȍőnPartʸᴰ<?>[] baseParts = BasePartFactory.INSTANCE.BãßBuildPartsByBase(baseNumber);
ImGui.text("Base:");
ImGui.sameLine();

View file

@ -61,7 +61,7 @@ public interface BãßBȍőnEnumSetʸᴰ<T> extends BãßBȍőnEnumʸᴰ<T> {
return values[resultIndex];
}
default void staticVoorElk(Consumer<T> consumer) {
default void BãßVoorElk(Consumer<T> consumer) {
for (T value:BãßInstances()) {
consumer.accept(value);
}

View file

@ -5,18 +5,13 @@ public interface BãßBȍőnEnumʸᴰ<T> {
String name();
// Bȍőn prefix is for set instance enum object called BãßBȍőnEnumSetʸᴰ
// Bãß prefix is for single instance enum objects called BãßBȍőnEnumInstanceʸᴰ
default String BȍőnNaam() {
return name();
}
default String BȍőnNaamI18N() {
return BãßNaam() + BãßBȍőnConstantsʸᴰ.STR_DOT + name();
}
default String BãßNaam() {
return getClass().getAnnotation(BãßBȍőnInfoʸᴰ.class).name();
}
@SuppressWarnings("unchecked")
default T[] BãßInstances() {
try {
@ -26,4 +21,24 @@ public interface BãßBȍőnEnumʸᴰ<T> {
throw new RuntimeException(e);
}
}
default String BãßNaam() {
return getClass().getAnnotation(BãßBȍőnInfoʸᴰ.class).name();
}
default String BãßPurpose() {
return getClass().getAnnotation(BãßBȍőnInfoʸᴰ.class).purpose();
}
default String BãßAuthorNaam() {
return getClass().getAnnotation(BãßBȍőnAuthorInfoʸᴰ.class).name();
}
default String BãßAuthorCopyright() {
return getClass().getAnnotation(BãßBȍőnAuthorInfoʸᴰ.class).copyright();
}
default String BȍőnNaamI18N() {
return BãßNaam() + BãßBȍőnConstantsʸᴰ.STR_DOT + name();
}
}

View file

@ -55,11 +55,11 @@ public class GroßGetậl6ˢᴰ implements BaseNumberTyte<GroßGetậl6ˢᴰ> {
@Override
public void fillOctalsByClone(BaseAppenderOctal appender) {
T12PartUncial.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender));
T12PartUncial.PART_1.BãßVoorElk(v -> getValue(v).fillOctalsByClone(appender));
}
@Override
public void fillTytesByReference(BaseAppenderTyte appender) {
T12PartUncial.PART_1.staticVoorElk(v -> getValue(v).fillTytesByReference(appender));
T12PartUncial.PART_1.BãßVoorElk(v -> getValue(v).fillTytesByReference(appender));
}
}

View file

@ -53,11 +53,11 @@ public class KlompGetậl4ˢᴰ implements BaseNumberTyte<KlompGetậl4ˢᴰ> {
@Override
public void fillOctalsByClone(BaseAppenderOctal appender) {
T08PartOctal.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender));
T08PartOctal.PART_1.BãßVoorElk(v -> getValue(v).fillOctalsByClone(appender));
}
@Override
public void fillTytesByReference(BaseAppenderTyte appender) {
T08PartOctal.PART_1.staticVoorElk(v -> getValue(v).fillTytesByReference(appender));
T08PartOctal.PART_1.BãßVoorElk(v -> getValue(v).fillTytesByReference(appender));
}
}

View file

@ -64,7 +64,7 @@ public class Base2Terminator {
private List<T08PartOctal> base2ReadOctals(int...values) {
List<T08PartOctal> octals = new ArrayList<>();
for (int value:values) {
T08PartOctal.PART_1.staticVoorElk(v -> octals.add(T08PartOctal.indexOf(v, value)));
T08PartOctal.PART_1.BãßVoorElk(v -> octals.add(T08PartOctal.indexOf(v, value)));
}
return octals;
}

View file

@ -1,18 +1,23 @@
package love.distributedrebirth.numberxd.base2t;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnEnumInstanceʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnInfoʸᴰ;
import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public final class BasePartFactory {
@BãßBȍőnInfoʸᴰ(name = "BasePartFactory", purpose = "Factory to access the bases.")
public enum BasePartFactory implements BãßBȍőnEnumInstanceʸᴰ<BasePartFactory> {
INSTANCE;
private static final int[] SUPPORTED_BASES = {2,3,4,5,6,7,8,10,11,12,16,20,60};
public static int[] getSupportedBases() {
public int[] BãßBases() {
return SUPPORTED_BASES;
}
public static BãßBȍőnPartʸᴰ<?>[] buildBassBonesByBase(int base) {
public BãßBȍőnPartʸᴰ<?>[] BãßBuildPartsByBase(int base) {
switch (base) {
case 2:
return T02PartBinary.values();

View file

@ -44,6 +44,6 @@ public final class V006Tixte implements BaseNumber<V006Tixte> {
@Override
public void fillOctalsByClone(BaseAppenderOctal appender) {
T02PartBinary.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender));
T02PartBinary.PART_1.BãßVoorElk(v -> getValue(v).fillOctalsByClone(appender));
}
}

View file

@ -45,7 +45,7 @@ public final class V009Tyte implements BaseNumberTyte<V009Tyte> {
@Override
public void fillOctalsByClone(BaseAppenderOctal appender) {
T03PartTrit.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender));
T03PartTrit.PART_1.BãßVoorElk(v -> getValue(v).fillOctalsByClone(appender));
}
@Override

View file

@ -52,11 +52,11 @@ public final class V012Tord implements BaseNumberTyte<V012Tord> {
@Override
public void fillOctalsByClone(BaseAppenderOctal appender) {
T02PartBinary.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender));
T02PartBinary.PART_1.BãßVoorElk(v -> getValue(v).fillOctalsByClone(appender));
}
@Override
public void fillTytesByReference(BaseAppenderTyte appender) {
T02PartBinary.PART_1.staticVoorElk(v -> getValue(v).fillTytesByReference(appender));
T02PartBinary.PART_1.BãßVoorElk(v -> getValue(v).fillTytesByReference(appender));
}
}

View file

@ -49,11 +49,11 @@ public final class V01BTemvig implements BaseNumberTyte<V01BTemvig> {
@Override
public void fillOctalsByClone(BaseAppenderOctal appender) {
T03PartTrit.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender));
T03PartTrit.PART_1.BãßVoorElk(v -> getValue(v).fillOctalsByClone(appender));
}
@Override
public void fillTytesByReference(BaseAppenderTyte appender) {
T03PartTrit.PART_1.staticVoorElk(v -> getValue(v).fillTytesByReference(appender));
T03PartTrit.PART_1.BãßVoorElk(v -> getValue(v).fillTytesByReference(appender));
}
}

View file

@ -58,11 +58,11 @@ public final class V024Teger implements BaseNumberTyte<V024Teger> {
@Override
public void fillOctalsByClone(BaseAppenderOctal appender) {
T02PartBinary.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender));
T02PartBinary.PART_1.BãßVoorElk(v -> getValue(v).fillOctalsByClone(appender));
}
@Override
public void fillTytesByReference(BaseAppenderTyte appender) {
T02PartBinary.PART_1.staticVoorElk(v -> getValue(v).fillTytesByReference(appender));
T02PartBinary.PART_1.BãßVoorElk(v -> getValue(v).fillTytesByReference(appender));
}
}

View file

@ -43,6 +43,6 @@ public final class V02ATraw implements BaseNumber<V02ATraw> {
@Override
public void fillOctalsByClone(BaseAppenderOctal appender) {
T07PartPlanIt.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender));
T07PartPlanIt.PART_1.BãßVoorElk(v -> getValue(v).fillOctalsByClone(appender));
}
}

View file

@ -60,11 +60,11 @@ public final class V048Tong implements BaseNumberTyte<V048Tong> {
@Override
public void fillOctalsByClone(BaseAppenderOctal appender) {
T02PartBinary.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender));
T02PartBinary.PART_1.BãßVoorElk(v -> getValue(v).fillOctalsByClone(appender));
}
@Override
public void fillTytesByReference(BaseAppenderTyte appender) {
T02PartBinary.PART_1.staticVoorElk(v -> getValue(v).fillTytesByReference(appender));
T02PartBinary.PART_1.BãßVoorElk(v -> getValue(v).fillTytesByReference(appender));
}
}

View file

@ -74,11 +74,11 @@ public final class V090Tocta implements BaseNumberTyte<V090Tocta> {
@Override
public void fillOctalsByClone(BaseAppenderOctal appender) {
T02PartBinary.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender));
T02PartBinary.PART_1.BãßVoorElk(v -> getValue(v).fillOctalsByClone(appender));
}
@Override
public void fillTytesByReference(BaseAppenderTyte appender) {
T02PartBinary.PART_1.staticVoorElk(v -> getValue(v).fillTytesByReference(appender));
T02PartBinary.PART_1.BãßVoorElk(v -> getValue(v).fillTytesByReference(appender));
}
}

View file

@ -43,11 +43,11 @@ public class V654Triz implements BaseNumberTyte<V654Triz> {
@Override
public void fillOctalsByClone(BaseAppenderOctal appender) {
T60PartSexagesimal.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender));
T60PartSexagesimal.PART_1.BãßVoorElk(v -> getValue(v).fillOctalsByClone(appender));
}
@Override
public void fillTytesByReference(BaseAppenderTyte appender) {
T60PartSexagesimal.PART_1.staticVoorElk(v -> getValue(v).fillTytesByReference(appender));
T60PartSexagesimal.PART_1.BãßVoorElk(v -> getValue(v).fillTytesByReference(appender));
}
}

View file

@ -43,6 +43,6 @@ public class V9D8Traz implements BaseNumber<V9D8Traz> {
@Override
public void fillOctalsByClone(BaseAppenderOctal appender) {
T60PartSexagesimal.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender));
T60PartSexagesimal.PART_1.BãßVoorElk(v -> getValue(v).fillOctalsByClone(appender));
}
}

View file

@ -44,11 +44,11 @@ public class VCA8Tath implements BaseNumberTyte<VCA8Tath> {
@Override
public void fillOctalsByClone(BaseAppenderOctal appender) {
T02PartBinary.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender));
T02PartBinary.PART_1.BãßVoorElk(v -> getValue(v).fillOctalsByClone(appender));
}
@Override
public void fillTytesByReference(BaseAppenderTyte appender) {
T02PartBinary.PART_1.staticVoorElk(v -> getValue(v).fillTytesByReference(appender));
T02PartBinary.PART_1.BãßVoorElk(v -> getValue(v).fillTytesByReference(appender));
}
}

View file

@ -14,7 +14,7 @@ public class BasePartFactoryTest {
@Test
public void testSupportedBases() {
int[] bases = BasePartFactory.getSupportedBases();
int[] bases = BasePartFactory.INSTANCE.BãßBases();
Assertions.assertNotNull(bases);
Assertions.assertTrue(bases.length > 1);
Assertions.assertTrue(bases.length < 100);
@ -23,8 +23,8 @@ public class BasePartFactoryTest {
@Test
public void testGlobalChinaKeyMap() {
Map<String,String> global = new HashMap<>();
for (int base:BasePartFactory.getSupportedBases()) {
for (BãßBȍőnPartʸᴰ<?> part:BasePartFactory.buildBassBonesByBase(base)) {
for (int base:BasePartFactory.INSTANCE.BãßBases()) {
for (BãßBȍőnPartʸᴰ<?> part:BasePartFactory.INSTANCE.BãßBuildPartsByBase(base)) {
Assertions.assertFalse(global.containsKey(part.getChinaKey()));
global.put(part.getChinaKey(), part.getChinaValue());
}
@ -35,8 +35,8 @@ public class BasePartFactoryTest {
@Test
public void testGlobalChinaValueMap() {
Map<String,String> global = new HashMap<>();
for (int base:BasePartFactory.getSupportedBases()) {
for (BãßBȍőnPartʸᴰ<?> part:BasePartFactory.buildBassBonesByBase(base)) {
for (int base:BasePartFactory.INSTANCE.BãßBases()) {
for (BãßBȍőnPartʸᴰ<?> part:BasePartFactory.INSTANCE.BãßBuildPartsByBase(base)) {
Assertions.assertFalse(global.containsKey(part.getChinaValue()));
global.put(part.getChinaValue(), part.getChinaValue());
}
@ -48,8 +48,8 @@ public class BasePartFactoryTest {
public void testGlobalToneMap() {
boolean duplicate = false;
Map<String,String> global = new HashMap<>();
for (int base:BasePartFactory.getSupportedBases()) {
for (BãßBȍőnPartʸᴰ<?> part:BasePartFactory.buildBassBonesByBase(base)) {
for (int base:BasePartFactory.INSTANCE.BãßBases()) {
for (BãßBȍőnPartʸᴰ<?> part:BasePartFactory.INSTANCE.BãßBuildPartsByBase(base)) {
if (global.containsKey(part.getIdentifierTone())) {
duplicate = true;
break;
@ -65,8 +65,8 @@ public class BasePartFactoryTest {
public void testGlobalLetterMap() {
boolean duplicate = false;
Map<String,String> global = new HashMap<>();
for (int base:BasePartFactory.getSupportedBases()) {
for (BãßBȍőnPartʸᴰ<?> part:BasePartFactory.buildBassBonesByBase(base)) {
for (int base:BasePartFactory.INSTANCE.BãßBases()) {
for (BãßBȍőnPartʸᴰ<?> part:BasePartFactory.INSTANCE.BãßBuildPartsByBase(base)) {
if (global.containsKey(part.getIdentifierLetter())) {
duplicate = true;
break;