Added base10 and base11
This commit is contained in:
parent
69fc75b1af
commit
ed938585df
|
@ -51,7 +51,8 @@ public class BasePartRenderer extends ImGuiRendererMain {
|
|||
BasePart[] baseParts = BasePartFactory.buildBasePartsByBase(baseNumber);
|
||||
|
||||
int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV;
|
||||
ImGui.beginTable("base-part", 9, flags);
|
||||
ImGui.beginTable("base-part", 10, flags);
|
||||
ImGui.tableSetupColumn("Name");
|
||||
ImGui.tableSetupColumn("Ordinal");
|
||||
ImGui.tableSetupColumn("Tone");
|
||||
ImGui.tableSetupColumn("Letter");
|
||||
|
@ -66,6 +67,8 @@ public class BasePartRenderer extends ImGuiRendererMain {
|
|||
for (BasePart part:baseParts) {
|
||||
ImGui.tableNextRow();
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text(part.name());
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text(Integer.toString(part.ordinal()));
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text(part.getIdentifierTone());
|
||||
|
|
|
@ -4,7 +4,7 @@ import love.distributedrebirth.numberxd.base2t.facet.BasePart;
|
|||
|
||||
public final class BasePartFactory {
|
||||
|
||||
private static final int[] SUPPORTED_BASES = {2,3,4,5,6,7,8,12,16,20,60};
|
||||
private static final int[] SUPPORTED_BASES = {2,3,4,5,6,7,8,10,11,12,16,20,60};
|
||||
|
||||
public static int[] getSupportedBases() {
|
||||
return SUPPORTED_BASES;
|
||||
|
@ -29,9 +29,9 @@ public final class BasePartFactory {
|
|||
case 9:
|
||||
throw new IllegalArgumentException("Unsupported base: "+base);
|
||||
case 10:
|
||||
throw new IllegalArgumentException("Unsupported base: "+base);
|
||||
return T10PartDecimal.values();
|
||||
case 11:
|
||||
throw new IllegalArgumentException("Unsupported base: "+base);
|
||||
return T11PartUndecimal.values();
|
||||
case 12:
|
||||
return T12PartUncial.values();
|
||||
case 16:
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
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.facet.BasePart;
|
||||
import love.distributedrebirth.numberxd.base2t.facet.BaseFacetKey;
|
||||
import love.distributedrebirth.numberxd.base2t.facet.BaseFacetMap;
|
||||
|
||||
/**
|
||||
* The distribution by 10.
|
||||
*
|
||||
* @author willemtsade ©Δ∞ 仙上主天
|
||||
*/
|
||||
public enum T10PartDecimal implements BasePart {
|
||||
|
||||
PART_1 ("˥","0","零","zero"),
|
||||
PART_2 ("˦","1","壹","one"),
|
||||
PART_3 ("˧","2","貳","two"),
|
||||
PART_4 ("˨","3","參","three"),
|
||||
PART_5 ("˩","4","肆","four"),
|
||||
PART_6 ("꜒","5","伍","five"),
|
||||
PART_7 ("꜓","6","陸","six"),
|
||||
PART_8 ("꜔","7","柒","seven"),
|
||||
PART_9 ("꜕","8","捌","eight"),
|
||||
PART_10("꜖","9","玖","nine"),
|
||||
;
|
||||
|
||||
public static int LENGTH() { return values().length; };
|
||||
private final BaseFacetMap bfm = BaseFacetMap.newInstance();
|
||||
private static final Map<String, T10PartDecimal> TONE_MAP = Collections.unmodifiableMap(
|
||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
|
||||
private static final Map<String, T10PartDecimal> CHINA_MAP = Collections.unmodifiableMap(
|
||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v)));
|
||||
|
||||
private T10PartDecimal(String idTone, String idLetter, String chinaKey, String chinaValue) {
|
||||
this.getBFM().putInit(BaseFacetKey.ID_TONE, idTone);
|
||||
this.getBFM().putInit(BaseFacetKey.ID_LETTER, idLetter);
|
||||
this.getBFM().putInit(BaseFacetKey.CHINA_KEY, chinaKey);
|
||||
this.getBFM().putInit(BaseFacetKey.CHINA_VALUE, chinaValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseFacetMap getBFM() {
|
||||
return bfm;
|
||||
}
|
||||
|
||||
public static void forEach(Consumer<T10PartDecimal> consumer) {
|
||||
for (T10PartDecimal value:values()) {
|
||||
consumer.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static T10PartDecimal valueOfTone(String identifierTone) {
|
||||
return TONE_MAP.get(identifierTone);
|
||||
}
|
||||
|
||||
public static T10PartDecimal valueOfChina(String chinaKey) {
|
||||
return CHINA_MAP.get(chinaKey);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
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.facet.BasePart;
|
||||
import love.distributedrebirth.numberxd.base2t.facet.BaseFacetKey;
|
||||
import love.distributedrebirth.numberxd.base2t.facet.BaseFacetMap;
|
||||
|
||||
/**
|
||||
* The distribution by 11.
|
||||
*
|
||||
* @author willemtsade ©Δ∞ 仙上主天
|
||||
*/
|
||||
public enum T11PartUndecimal implements BasePart {
|
||||
|
||||
PART_1 ("˥","0","走","walk"),
|
||||
PART_2 ("꜈","1","跑","run"),
|
||||
PART_3 ("꜉","2","坐","sit"),
|
||||
PART_4 ("꜋","3","掛","hang"),
|
||||
PART_5 ("꜌","4","鋪","lay"),
|
||||
PART_6 ("꜔","5","跳","jump"),
|
||||
PART_7 ("꜍","6","落","drop"),
|
||||
PART_8 ("꜎","7","寂","lonely"),
|
||||
PART_9 ("꜏","8","談","talk"),
|
||||
PART_10("꜐","9","春","life"),
|
||||
PART_11("˩","=","耦","mate"),
|
||||
;
|
||||
|
||||
public static int LENGTH() { return values().length; };
|
||||
private final BaseFacetMap bfm = BaseFacetMap.newInstance();
|
||||
private static final Map<String, T11PartUndecimal> TONE_MAP = Collections.unmodifiableMap(
|
||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
|
||||
private static final Map<String, T11PartUndecimal> CHINA_MAP = Collections.unmodifiableMap(
|
||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v)));
|
||||
|
||||
private T11PartUndecimal(String idTone, String idLetter, String chinaKey, String chinaValue) {
|
||||
this.getBFM().putInit(BaseFacetKey.ID_TONE, idTone);
|
||||
this.getBFM().putInit(BaseFacetKey.ID_LETTER, idLetter);
|
||||
this.getBFM().putInit(BaseFacetKey.CHINA_KEY, chinaKey);
|
||||
this.getBFM().putInit(BaseFacetKey.CHINA_VALUE, chinaValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseFacetMap getBFM() {
|
||||
return bfm;
|
||||
}
|
||||
|
||||
public static void forEach(Consumer<T11PartUndecimal> consumer) {
|
||||
for (T11PartUndecimal value:values()) {
|
||||
consumer.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static T11PartUndecimal valueOfTone(String identifierTone) {
|
||||
return TONE_MAP.get(identifierTone);
|
||||
}
|
||||
|
||||
public static T11PartUndecimal valueOfChina(String chinaKey) {
|
||||
return CHINA_MAP.get(chinaKey);
|
||||
}
|
||||
}
|
|
@ -7,6 +7,8 @@ package love.distributedrebirth.numberxd.base2t.facet;
|
|||
*/
|
||||
public interface BasePart extends BaseFacetStore {
|
||||
|
||||
String name();
|
||||
|
||||
int ordinal();
|
||||
|
||||
default String getIdentifierTone() {
|
||||
|
|
|
@ -21,9 +21,6 @@ public class BasePartFactoryTest {
|
|||
Assertions.assertNotNull(bases);
|
||||
Assertions.assertTrue(bases.length > 1);
|
||||
Assertions.assertTrue(bases.length < 100);
|
||||
for (int base:bases) {
|
||||
Assertions.assertNotNull(base);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package love.distributedrebirth.numberxd.base2t;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author willemtsade ©Δ∞ 仙上主天
|
||||
*/
|
||||
public class T10PartDecimalTest {
|
||||
|
||||
@Test
|
||||
public void testBasePart() {
|
||||
for (T10PartDecimal value:T10PartDecimal.values()) {
|
||||
Assertions.assertNotNull(value.getIdentifierTone());
|
||||
Assertions.assertNotNull(value.getIdentifierLetter());
|
||||
Assertions.assertNotNull(value.getChinaKey());
|
||||
Assertions.assertNotNull(value.getChinaValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToneMap() {
|
||||
Assertions.assertEquals(T10PartDecimal.PART_1, T10PartDecimal.valueOfTone("˥"));
|
||||
Assertions.assertEquals(T10PartDecimal.PART_2, T10PartDecimal.valueOfTone("˦"));
|
||||
Assertions.assertEquals(T10PartDecimal.PART_9, T10PartDecimal.valueOfTone("꜕"));
|
||||
Assertions.assertEquals(T10PartDecimal.PART_10, T10PartDecimal.valueOfTone("꜖"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChinaMap() {
|
||||
Assertions.assertEquals(T10PartDecimal.PART_1, T10PartDecimal.valueOfChina("零"));
|
||||
Assertions.assertEquals(T10PartDecimal.PART_2, T10PartDecimal.valueOfChina("壹"));
|
||||
Assertions.assertEquals(T10PartDecimal.PART_9, T10PartDecimal.valueOfChina("捌"));
|
||||
Assertions.assertEquals(T10PartDecimal.PART_10, T10PartDecimal.valueOfChina("玖"));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package love.distributedrebirth.numberxd.base2t;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author willemtsade ©Δ∞ 仙上主天
|
||||
*/
|
||||
public class T11PartUndecimalTest {
|
||||
|
||||
@Test
|
||||
public void testBasePart() {
|
||||
for (T11PartUndecimal value:T11PartUndecimal.values()) {
|
||||
Assertions.assertNotNull(value.getIdentifierTone());
|
||||
Assertions.assertNotNull(value.getIdentifierLetter());
|
||||
Assertions.assertNotNull(value.getChinaKey());
|
||||
Assertions.assertNotNull(value.getChinaValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToneMap() {
|
||||
Assertions.assertEquals(T11PartUndecimal.PART_1, T11PartUndecimal.valueOfTone("˥"));
|
||||
Assertions.assertEquals(T11PartUndecimal.PART_2, T11PartUndecimal.valueOfTone("꜈"));
|
||||
Assertions.assertEquals(T11PartUndecimal.PART_10, T11PartUndecimal.valueOfTone("꜐"));
|
||||
Assertions.assertEquals(T11PartUndecimal.PART_11, T11PartUndecimal.valueOfTone("˩"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChinaMap() {
|
||||
Assertions.assertEquals(T11PartUndecimal.PART_1, T11PartUndecimal.valueOfChina("走"));
|
||||
Assertions.assertEquals(T11PartUndecimal.PART_2, T11PartUndecimal.valueOfChina("跑"));
|
||||
Assertions.assertEquals(T11PartUndecimal.PART_10, T11PartUndecimal.valueOfChina("春"));
|
||||
Assertions.assertEquals(T11PartUndecimal.PART_11, T11PartUndecimal.valueOfChina("耦"));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue