diff --git a/numberxd/src/main/love/distributedrebirth/numberxd/base2t/BasePartFactory.java b/numberxd/src/main/love/distributedrebirth/numberxd/base2t/BasePartFactory.java index a1690fea..2a81b74e 100644 --- a/numberxd/src/main/love/distributedrebirth/numberxd/base2t/BasePartFactory.java +++ b/numberxd/src/main/love/distributedrebirth/numberxd/base2t/BasePartFactory.java @@ -10,7 +10,7 @@ public final class BasePartFactory { return SUPPORTED_BASES; } - public static BassBone[] buildBassBonesByBase(int base) { + public static BassBone[] buildBassBonesByBase(int base) { switch (base) { case 2: return T02PartBinary.values(); diff --git a/numberxd/src/main/love/distributedrebirth/numberxd/base2t/T60Sexagesimal.java b/numberxd/src/main/love/distributedrebirth/numberxd/base2t/T60Sexagesimal.java index 0a6ca53d..825b54c5 100644 --- a/numberxd/src/main/love/distributedrebirth/numberxd/base2t/T60Sexagesimal.java +++ b/numberxd/src/main/love/distributedrebirth/numberxd/base2t/T60Sexagesimal.java @@ -1,11 +1,5 @@ package love.distributedrebirth.numberxd.base2t; -import java.util.Arrays; -import java.util.Collections; -import java.util.Map; -import java.util.function.Consumer; -import java.util.stream.Collectors; - import love.distributedrebirth.numberxd.base2t.bone.BassBone; import love.distributedrebirth.numberxd.base2t.bone.BassBoneCoffin; import love.distributedrebirth.numberxd.base2t.bone.BassBoneName; @@ -17,7 +11,7 @@ import love.distributedrebirth.numberxd.base2t.bone.BassBoneStoreKey; * @author willemtsade ©Δ∞ 仙上主天 */ @BassBoneName("T60Sexagesimal") -public enum T60Sexagesimal implements BassBone { +public enum T60Sexagesimal implements BassBone { PART_1 ("˧˩˥","ια","牛","cow"), PART_2 ("˧˥˦","ιβ","鸡","chicken"), @@ -85,35 +79,19 @@ public enum T60Sexagesimal implements BassBone { ; public static int LENGTH() { return values().length; }; - private final BassBoneCoffin bfm = BassBoneCoffin.newInstance(); - private static final Map TONE_MAP = Collections.unmodifiableMap( - Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v))); - private static final Map CHINA_MAP = Collections.unmodifiableMap( - Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v))); + private final BassBoneCoffin bbc = BassBoneCoffin.newInstance(); private T60Sexagesimal(String idTone, String idLetter, String chinaKey, String chinaValue) { - this.getBBC().putInit(BassBoneStoreKey.ID_TONE, idTone); - this.getBBC().putInit(BassBoneStoreKey.ID_LETTER, idLetter); - this.getBBC().putInit(BassBoneStoreKey.CHINA_KEY, chinaKey); - this.getBBC().putInit(BassBoneStoreKey.CHINA_VALUE, chinaValue); + getBBC().putInit(BassBoneStoreKey.ID_TONE, idTone); + getBBC().putInit(BassBoneStoreKey.ID_LETTER, idLetter); + getBBC().putInit(BassBoneStoreKey.CHINA_KEY, chinaKey); + getBBC().putInit(BassBoneStoreKey.CHINA_VALUE, chinaValue); + getBBC().getMapObject(BassBoneStoreKey.MAP_TONE); + getBBC().getMapObject(BassBoneStoreKey.MAP_CHINA); } @Override public BassBoneCoffin getBBC() { - return bfm; - } - - public static void forEach(Consumer consumer) { - for (T60Sexagesimal value:values()) { - consumer.accept(value); - } - } - - public static T60Sexagesimal valueOfTone(String identifierTone) { - return TONE_MAP.get(identifierTone); - } - - public static T60Sexagesimal valueOfChina(String chinaKey) { - return CHINA_MAP.get(chinaKey); + return bbc; } } diff --git a/numberxd/src/main/love/distributedrebirth/numberxd/base2t/V654Triz.java b/numberxd/src/main/love/distributedrebirth/numberxd/base2t/V654Triz.java index dc60bb11..c3e37e82 100644 --- a/numberxd/src/main/love/distributedrebirth/numberxd/base2t/V654Triz.java +++ b/numberxd/src/main/love/distributedrebirth/numberxd/base2t/V654Triz.java @@ -42,11 +42,11 @@ public class V654Triz implements BaseNumberTyte { @Override public void fillOctalsByClone(T08PartOctalBaseAppender appender) { - T60Sexagesimal.forEach(v -> getValue(v).fillOctalsByClone(appender)); + T60Sexagesimal.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender)); } @Override public void fillTytesByReference(V009TyteBaseAppender appender) { - T60Sexagesimal.forEach(v -> getValue(v).fillTytesByReference(appender)); + T60Sexagesimal.PART_1.staticVoorElk(v -> getValue(v).fillTytesByReference(appender)); } } diff --git a/numberxd/src/main/love/distributedrebirth/numberxd/base2t/V9D8Traz.java b/numberxd/src/main/love/distributedrebirth/numberxd/base2t/V9D8Traz.java index 2fc0e067..1481e894 100644 --- a/numberxd/src/main/love/distributedrebirth/numberxd/base2t/V9D8Traz.java +++ b/numberxd/src/main/love/distributedrebirth/numberxd/base2t/V9D8Traz.java @@ -42,6 +42,6 @@ public class V9D8Traz implements BaseNumber { @Override public void fillOctalsByClone(T08PartOctalBaseAppender appender) { - T60Sexagesimal.forEach(v -> getValue(v).fillOctalsByClone(appender)); + T60Sexagesimal.PART_1.staticVoorElk(v -> getValue(v).fillOctalsByClone(appender)); } } diff --git a/numberxd/src/test/love/distributedrebirth/numberxd/base2t/T60SexagesimalTest.java b/numberxd/src/test/love/distributedrebirth/numberxd/base2t/T60SexagesimalTest.java index c7e05958..420b5c43 100644 --- a/numberxd/src/test/love/distributedrebirth/numberxd/base2t/T60SexagesimalTest.java +++ b/numberxd/src/test/love/distributedrebirth/numberxd/base2t/T60SexagesimalTest.java @@ -22,17 +22,17 @@ public class T60SexagesimalTest { @Test public void testToneMap() { - Assertions.assertEquals(T60Sexagesimal.PART_1, T60Sexagesimal.valueOfTone("˧˩˥")); - Assertions.assertEquals(T60Sexagesimal.PART_2, T60Sexagesimal.valueOfTone("˧˥˦")); - Assertions.assertEquals(T60Sexagesimal.PART_59, T60Sexagesimal.valueOfTone("꜍꜍꜏")); - Assertions.assertEquals(T60Sexagesimal.PART_60, T60Sexagesimal.valueOfTone("꜑꜑꜏")); + Assertions.assertEquals(T60Sexagesimal.PART_1, T60Sexagesimal.PART_1.staticValueOfTone("˧˩˥")); + Assertions.assertEquals(T60Sexagesimal.PART_2, T60Sexagesimal.PART_1.staticValueOfTone("˧˥˦")); + Assertions.assertEquals(T60Sexagesimal.PART_59, T60Sexagesimal.PART_1.staticValueOfTone("꜍꜍꜏")); + Assertions.assertEquals(T60Sexagesimal.PART_60, T60Sexagesimal.PART_1.staticValueOfTone("꜑꜑꜏")); } @Test public void testChinaMap() { - Assertions.assertEquals(T60Sexagesimal.PART_1, T60Sexagesimal.valueOfChina("牛")); - Assertions.assertEquals(T60Sexagesimal.PART_2, T60Sexagesimal.valueOfChina("鸡")); - Assertions.assertEquals(T60Sexagesimal.PART_59, T60Sexagesimal.valueOfChina("薯")); - Assertions.assertEquals(T60Sexagesimal.PART_60, T60Sexagesimal.valueOfChina("蘋")); + Assertions.assertEquals(T60Sexagesimal.PART_1, T60Sexagesimal.PART_1.staticValueOfChina("牛")); + Assertions.assertEquals(T60Sexagesimal.PART_2, T60Sexagesimal.PART_1.staticValueOfChina("鸡")); + Assertions.assertEquals(T60Sexagesimal.PART_59, T60Sexagesimal.PART_1.staticValueOfChina("薯")); + Assertions.assertEquals(T60Sexagesimal.PART_60, T60Sexagesimal.PART_1.staticValueOfChina("蘋")); } }