Converted to BaseFacetMap storage bean

This commit is contained in:
Willem Cazander 2022-02-01 00:26:11 +01:00
parent 45879c1992
commit a31757a349
19 changed files with 186 additions and 145 deletions

View file

@ -2,13 +2,13 @@ package love.distributedrebirth.numberxd.base2t;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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 2.
@ -22,22 +22,22 @@ public enum T02PartBinary implements BasePart {
;
public static int LENGTH() { return values().length; };
private final Map<BaseFacetKey, Object> facetStore = new HashMap<>();
private final BaseFacetMap bfm = BaseFacetMap.newInstance();
private static final Map<String, T02PartBinary> TONE_MAP = Collections.unmodifiableMap(
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
private static final Map<String, T02PartBinary> CHINA_MAP = Collections.unmodifiableMap(
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v)));
private T02PartBinary(String idTone, String idLetter, String chinaKey, String chinaValue) {
this.getFacetStore().put(BaseFacetKey.ID_TONE, idTone);
this.getFacetStore().put(BaseFacetKey.ID_LETTER, idLetter);
this.getFacetStore().put(BaseFacetKey.CHINA_KEY, chinaKey);
this.getFacetStore().put(BaseFacetKey.CHINA_VALUE, 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 Map<BaseFacetKey, Object> getFacetStore() {
return facetStore;
public BaseFacetMap getBFM() {
return bfm;
}
public static void forEach(Consumer<T02PartBinary> consumer) {

View file

@ -2,13 +2,13 @@ package love.distributedrebirth.numberxd.base2t;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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 3.
@ -23,22 +23,22 @@ public enum T03PartTrit implements BasePart {
;
public static int LENGTH() { return values().length; };
private final Map<BaseFacetKey, Object> facetStore = new HashMap<>();
private final BaseFacetMap bfm = BaseFacetMap.newInstance();
private static final Map<String, T03PartTrit> TONE_MAP = Collections.unmodifiableMap(
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
private static final Map<String, T03PartTrit> CHINA_MAP = Collections.unmodifiableMap(
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v)));
private T03PartTrit(String idTone, String idLetter, String chinaKey, String chinaValue) {
this.getFacetStore().put(BaseFacetKey.ID_TONE, idTone);
this.getFacetStore().put(BaseFacetKey.ID_LETTER, idLetter);
this.getFacetStore().put(BaseFacetKey.CHINA_KEY, chinaKey);
this.getFacetStore().put(BaseFacetKey.CHINA_VALUE, 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 Map<BaseFacetKey, Object> getFacetStore() {
return facetStore;
public BaseFacetMap getBFM() {
return bfm;
}
public static void forEach(Consumer<T03PartTrit> consumer) {

View file

@ -2,13 +2,13 @@ package love.distributedrebirth.numberxd.base2t;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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;
import love.distributedrebirth.numberxd.base2t.facet.BasePartAlt1;
import love.distributedrebirth.numberxd.base2t.facet.BasePartSplit4;
@ -26,7 +26,7 @@ public enum T04PartQuad implements BasePart,BasePartAlt1,BasePartSplit4 {
;
public static int LENGTH() { return values().length; };
private final Map<BaseFacetKey, Object> facetStore = new HashMap<>();
private final BaseFacetMap bfm = BaseFacetMap.newInstance();
private static final String ALT_1_NAME = "Cardinal direction";
private static final String ALT_1_WIKI = "https://simple.wikipedia.org/wiki/Cardinal_direction";
private static final Map<String, T04PartQuad> TONE_MAP = Collections.unmodifiableMap(
@ -35,18 +35,18 @@ public enum T04PartQuad implements BasePart,BasePartAlt1,BasePartSplit4 {
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v)));
private T04PartQuad(String idTone, String idLetter, String chinaKey, String chinaValue, String alt1Value) {
this.getFacetStore().put(BaseFacetKey.ID_TONE, idTone);
this.getFacetStore().put(BaseFacetKey.ID_LETTER, idLetter);
this.getFacetStore().put(BaseFacetKey.CHINA_KEY, chinaKey);
this.getFacetStore().put(BaseFacetKey.CHINA_VALUE, chinaValue);
this.getFacetStore().put(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getFacetStore().put(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getFacetStore().put(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
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);
this.getBFM().putInit(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getBFM().putInit(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getBFM().putInit(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
}
@Override
public Map<BaseFacetKey, Object> getFacetStore() {
return facetStore;
public BaseFacetMap getBFM() {
return bfm;
}
public static void forEach(Consumer<T04PartQuad> consumer) {

View file

@ -2,7 +2,6 @@ package love.distributedrebirth.numberxd.base2t;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@ -10,6 +9,7 @@ import java.util.stream.Collectors;
import love.distributedrebirth.numberxd.base2t.facet.BasePart;
import love.distributedrebirth.numberxd.base2t.facet.BasePartAlt2;
import love.distributedrebirth.numberxd.base2t.facet.BaseFacetKey;
import love.distributedrebirth.numberxd.base2t.facet.BaseFacetMap;
/**
* The distribution by 5 called Wuxing.
@ -30,28 +30,28 @@ public enum T05PartPental implements BasePart,BasePartAlt2 {
private static final String ALT_1_WIKI = "https://en.wikipedia.org/wiki/Pentagram";
private static final String ALT_2_NAME = "Pythagorean Interpretations";
private static final String ALT_2_WIKI = "http://wisdomofhypatia.com/OM/BA/PP.html";
private final Map<BaseFacetKey, Object> facetStore = new HashMap<>();
private final BaseFacetMap bfm = BaseFacetMap.newInstance();
private static final Map<String, T05PartPental> TONE_MAP = Collections.unmodifiableMap(
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
private static final Map<String, T05PartPental> CHINA_MAP = Collections.unmodifiableMap(
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v)));
private T05PartPental(String idTone, String idLetter, String chinaKey, String chinaValue, String alt1Value, String alt2Value) {
this.getFacetStore().put(BaseFacetKey.ID_TONE, idTone);
this.getFacetStore().put(BaseFacetKey.ID_LETTER, idLetter);
this.getFacetStore().put(BaseFacetKey.CHINA_KEY, chinaKey);
this.getFacetStore().put(BaseFacetKey.CHINA_VALUE, chinaValue);
this.getFacetStore().put(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getFacetStore().put(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getFacetStore().put(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
this.getFacetStore().put(BaseFacetKey.ALT_2_VALUE, alt2Value);
this.getFacetStore().put(BaseFacetKey.ALT_2_NAME, ALT_2_NAME);
this.getFacetStore().put(BaseFacetKey.ALT_2_WIKI, ALT_2_WIKI);
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);
this.getBFM().putInit(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getBFM().putInit(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getBFM().putInit(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
this.getBFM().putInit(BaseFacetKey.ALT_2_VALUE, alt2Value);
this.getBFM().putInit(BaseFacetKey.ALT_2_NAME, ALT_2_NAME);
this.getBFM().putInit(BaseFacetKey.ALT_2_WIKI, ALT_2_WIKI);
}
@Override
public Map<BaseFacetKey, Object> getFacetStore() {
return facetStore;
public BaseFacetMap getBFM() {
return bfm;
}
public static void forEach(Consumer<T05PartPental> consumer) {

View file

@ -2,13 +2,13 @@ package love.distributedrebirth.numberxd.base2t;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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;
import love.distributedrebirth.numberxd.base2t.facet.BasePartAlt1;
import love.distributedrebirth.numberxd.base2t.facet.BasePartSplit6;
@ -30,7 +30,7 @@ public enum T06PartSeximal implements BasePart,BasePartAlt1,BasePartSplit6 {
;
public static int LENGTH() { return values().length; };
private final Map<BaseFacetKey, Object> facetStore = new HashMap<>();
private final BaseFacetMap bfm = BaseFacetMap.newInstance();
private static final String ALT_1_NAME = "ADFGVX cipher";
private static final String ALT_1_WIKI = "https://en.wikipedia.org/wiki/ADFGVX_cipher";
private static final Map<String, T06PartSeximal> TONE_MAP = Collections.unmodifiableMap(
@ -39,18 +39,18 @@ public enum T06PartSeximal implements BasePart,BasePartAlt1,BasePartSplit6 {
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v)));
private T06PartSeximal(String idTone, String idLetter, String chinaKey, String chinaValue, String alt1Value) {
this.getFacetStore().put(BaseFacetKey.ID_TONE, idTone);
this.getFacetStore().put(BaseFacetKey.ID_LETTER, idLetter);
this.getFacetStore().put(BaseFacetKey.CHINA_KEY, chinaKey);
this.getFacetStore().put(BaseFacetKey.CHINA_VALUE, chinaValue);
this.getFacetStore().put(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getFacetStore().put(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getFacetStore().put(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
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);
this.getBFM().putInit(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getBFM().putInit(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getBFM().putInit(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
}
@Override
public Map<BaseFacetKey, Object> getFacetStore() {
return facetStore;
public BaseFacetMap getBFM() {
return bfm;
}
public static void forEach(Consumer<T06PartSeximal> consumer) {

View file

@ -2,13 +2,13 @@ package love.distributedrebirth.numberxd.base2t;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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;
import love.distributedrebirth.numberxd.base2t.facet.BasePartAlt1;
/**
@ -28,7 +28,7 @@ public enum T07PartPlanIt implements BasePart,BasePartAlt1 {
;
public static int LENGTH() { return values().length; };
private final Map<BaseFacetKey, Object> facetStore = new HashMap<>();
private final BaseFacetMap bfm = BaseFacetMap.newInstance();
private static final String ALT_1_NAME = "Fallen sign";
private static final String ALT_1_WIKI = "https://en.wikipedia.org/wiki/Classical_planet#Western_astrology";
private static final Map<String, T07PartPlanIt> TONE_MAP = Collections.unmodifiableMap(
@ -37,18 +37,18 @@ public enum T07PartPlanIt implements BasePart,BasePartAlt1 {
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v)));
private T07PartPlanIt(String idTone, String idLetter, String chinaKey, String chinaValue, String alt1Value) {
this.getFacetStore().put(BaseFacetKey.ID_TONE, idTone);
this.getFacetStore().put(BaseFacetKey.ID_LETTER, idLetter);
this.getFacetStore().put(BaseFacetKey.CHINA_KEY, chinaKey);
this.getFacetStore().put(BaseFacetKey.CHINA_VALUE, chinaValue);
this.getFacetStore().put(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getFacetStore().put(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getFacetStore().put(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
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);
this.getBFM().putInit(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getBFM().putInit(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getBFM().putInit(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
}
@Override
public Map<BaseFacetKey, Object> getFacetStore() {
return facetStore;
public BaseFacetMap getBFM() {
return bfm;
}
public static void forEach(Consumer<T07PartPlanIt> consumer) {

View file

@ -2,13 +2,13 @@ package love.distributedrebirth.numberxd.base2t;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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;
import love.distributedrebirth.numberxd.base2t.facet.BasePartAlt2;
import love.distributedrebirth.numberxd.base2t.facet.BasePartSplit8;
@ -32,7 +32,7 @@ public enum T08PartOctal implements BasePart,BasePartAlt2,BasePartSplit8 {
public static int LENGTH() { return values().length; };
public static int BIT_COUNT = 3;
private static final byte BITMASK = 0x07;
private final Map<BaseFacetKey, Object> facetStore = new HashMap<>();
private final BaseFacetMap bfm = BaseFacetMap.newInstance();
private static final String ALT_1_NAME = "Absolute Tone Sequence";
private static final String ALT_1_WIKI = "https://en.wikipedia.org/wiki/Tone_letter";
private static final String ALT_2_NAME = "Relative Tone Sequence";
@ -44,22 +44,22 @@ public enum T08PartOctal implements BasePart,BasePartAlt2,BasePartSplit8 {
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v)));
private T08PartOctal(String identifierTone, String identifierLetter, String chinaKey, String chinaValue, String alt1Value, String alt2Value, int shiftBits) {
this.getFacetStore().put(BaseFacetKey.ID_TONE, identifierTone);
this.getFacetStore().put(BaseFacetKey.ID_LETTER, identifierLetter);
this.getFacetStore().put(BaseFacetKey.CHINA_KEY, chinaKey);
this.getFacetStore().put(BaseFacetKey.CHINA_VALUE, chinaValue);
this.getFacetStore().put(BaseFacetKey.SHIFT_BITS, Integer.valueOf(shiftBits));
this.getFacetStore().put(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getFacetStore().put(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getFacetStore().put(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
this.getFacetStore().put(BaseFacetKey.ALT_2_VALUE, alt2Value);
this.getFacetStore().put(BaseFacetKey.ALT_2_NAME, ALT_2_NAME);
this.getFacetStore().put(BaseFacetKey.ALT_2_WIKI, ALT_2_WIKI);
this.getBFM().putInit(BaseFacetKey.ID_TONE, identifierTone);
this.getBFM().putInit(BaseFacetKey.ID_LETTER, identifierLetter);
this.getBFM().putInit(BaseFacetKey.CHINA_KEY, chinaKey);
this.getBFM().putInit(BaseFacetKey.CHINA_VALUE, chinaValue);
this.getBFM().putInit(BaseFacetKey.SHIFT_BITS, Integer.valueOf(shiftBits));
this.getBFM().putInit(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getBFM().putInit(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getBFM().putInit(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
this.getBFM().putInit(BaseFacetKey.ALT_2_VALUE, alt2Value);
this.getBFM().putInit(BaseFacetKey.ALT_2_NAME, ALT_2_NAME);
this.getBFM().putInit(BaseFacetKey.ALT_2_WIKI, ALT_2_WIKI);
}
@Override
public Map<BaseFacetKey, Object> getFacetStore() {
return facetStore;
public BaseFacetMap getBFM() {
return bfm;
}
public static T08PartOctal indexOf(T08PartOctal group, int value) {

View file

@ -2,13 +2,13 @@ package love.distributedrebirth.numberxd.base2t;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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;
import love.distributedrebirth.numberxd.base2t.facet.BasePartAlt1;
/**
@ -33,7 +33,7 @@ public enum T12PartUncial implements BasePart,BasePartAlt1 {
;
public static int LENGTH() { return values().length; };
private final Map<BaseFacetKey, Object> facetStore = new HashMap<>();
private final BaseFacetMap bfm = BaseFacetMap.newInstance();
private static final String ALT_1_NAME = "Transdecimal symbols";
private static final String ALT_1_WIKI = "https://en.wikipedia.org/wiki/Duodecimal#Transdecimal_symbols";
private static final Map<String, T12PartUncial> TONE_MAP = Collections.unmodifiableMap(
@ -42,18 +42,18 @@ public enum T12PartUncial implements BasePart,BasePartAlt1 {
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v)));
private T12PartUncial(String idTone, String idLetter, String chinaKey, String chinaValue, String alt1Value) {
this.getFacetStore().put(BaseFacetKey.ID_TONE, idTone);
this.getFacetStore().put(BaseFacetKey.ID_LETTER, idLetter);
this.getFacetStore().put(BaseFacetKey.CHINA_KEY, chinaKey);
this.getFacetStore().put(BaseFacetKey.CHINA_VALUE, chinaValue);
this.getFacetStore().put(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getFacetStore().put(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getFacetStore().put(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
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);
this.getBFM().putInit(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getBFM().putInit(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getBFM().putInit(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
}
@Override
public Map<BaseFacetKey, Object> getFacetStore() {
return facetStore;
public BaseFacetMap getBFM() {
return bfm;
}
public static void forEach(Consumer<T12PartUncial> consumer) {

View file

@ -2,13 +2,13 @@ package love.distributedrebirth.numberxd.base2t;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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;
import love.distributedrebirth.numberxd.base2t.facet.BasePartAlt1;
import love.distributedrebirth.numberxd.base2t.facet.BasePartSplit16;
@ -38,7 +38,7 @@ public enum T16PartHex implements BasePart,BasePartAlt1,BasePartSplit16 {
;
public static int LENGTH() { return values().length; };
private final Map<BaseFacetKey, Object> facetStore = new HashMap<>();
private final BaseFacetMap bfm = BaseFacetMap.newInstance();
private static final String ALT_1_NAME = "Dual-tone multi-frequency signaling";
private static final String ALT_1_WIKI = "https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling";
private static final Map<String, T16PartHex> TONE_MAP = Collections.unmodifiableMap(
@ -47,18 +47,18 @@ public enum T16PartHex implements BasePart,BasePartAlt1,BasePartSplit16 {
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v)));
private T16PartHex(String idTone, String idLetter, String chinaKey, String chinaValue, String alt1Value) {
this.getFacetStore().put(BaseFacetKey.ID_TONE, idTone);
this.getFacetStore().put(BaseFacetKey.ID_LETTER, idLetter);
this.getFacetStore().put(BaseFacetKey.CHINA_KEY, chinaKey);
this.getFacetStore().put(BaseFacetKey.CHINA_VALUE, chinaValue);
this.getFacetStore().put(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getFacetStore().put(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getFacetStore().put(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
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);
this.getBFM().putInit(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getBFM().putInit(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getBFM().putInit(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
}
@Override
public Map<BaseFacetKey, Object> getFacetStore() {
return facetStore;
public BaseFacetMap getBFM() {
return bfm;
}
public static void forEach(Consumer<T16PartHex> consumer) {

View file

@ -2,13 +2,13 @@ package love.distributedrebirth.numberxd.base2t;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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;
import love.distributedrebirth.numberxd.base2t.facet.BasePartAlt3;
/**
@ -41,7 +41,7 @@ public enum T20PartScore implements BasePart,BasePartAlt3 {
;
public static int LENGTH() { return values().length; };
private final Map<BaseFacetKey, Object> facetStore = new HashMap<>();
private final BaseFacetMap bfm = BaseFacetMap.newInstance();
private static final String ALT_1_NAME = "Vigesimal";
private static final String ALT_1_WIKI = "https://en.wikipedia.org/wiki/Vigesimal#Places";
private static final String ALT_2_NAME = "Vigesimal Alternative";
@ -57,24 +57,24 @@ public enum T20PartScore implements BasePart,BasePartAlt3 {
private T20PartScore(String idTone, String idLetter, String chinaKey, String chinaValue,
String alt1Value, String alt2Value, String alt3Value) {
this.getFacetStore().put(BaseFacetKey.ID_TONE, idTone);
this.getFacetStore().put(BaseFacetKey.ID_LETTER, idLetter);
this.getFacetStore().put(BaseFacetKey.CHINA_KEY, chinaKey);
this.getFacetStore().put(BaseFacetKey.CHINA_VALUE, chinaValue);
this.getFacetStore().put(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getFacetStore().put(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getFacetStore().put(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
this.getFacetStore().put(BaseFacetKey.ALT_2_VALUE, alt2Value);
this.getFacetStore().put(BaseFacetKey.ALT_2_NAME, ALT_2_NAME);
this.getFacetStore().put(BaseFacetKey.ALT_2_WIKI, ALT_2_WIKI);
this.getFacetStore().put(BaseFacetKey.ALT_3_VALUE, alt3Value);
this.getFacetStore().put(BaseFacetKey.ALT_3_NAME, ALT_3_NAME);
this.getFacetStore().put(BaseFacetKey.ALT_3_WIKI, ALT_3_WIKI);
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);
this.getBFM().putInit(BaseFacetKey.ALT_1_VALUE, alt1Value);
this.getBFM().putInit(BaseFacetKey.ALT_1_NAME, ALT_1_NAME);
this.getBFM().putInit(BaseFacetKey.ALT_1_WIKI, ALT_1_WIKI);
this.getBFM().putInit(BaseFacetKey.ALT_2_VALUE, alt2Value);
this.getBFM().putInit(BaseFacetKey.ALT_2_NAME, ALT_2_NAME);
this.getBFM().putInit(BaseFacetKey.ALT_2_WIKI, ALT_2_WIKI);
this.getBFM().putInit(BaseFacetKey.ALT_3_VALUE, alt3Value);
this.getBFM().putInit(BaseFacetKey.ALT_3_NAME, ALT_3_NAME);
this.getBFM().putInit(BaseFacetKey.ALT_3_WIKI, ALT_3_WIKI);
}
@Override
public Map<BaseFacetKey, Object> getFacetStore() {
return facetStore;
public BaseFacetMap getBFM() {
return bfm;
}
public static void forEach(Consumer<T20PartScore> consumer) {

View file

@ -2,13 +2,13 @@ package love.distributedrebirth.numberxd.base2t;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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 60.
@ -83,22 +83,22 @@ public enum T60Sexagesimal implements BasePart {
;
public static int LENGTH() { return values().length; };
private final Map<BaseFacetKey, Object> facetStore = new HashMap<>();
private final BaseFacetMap bfm = BaseFacetMap.newInstance();
private static final Map<String, T60Sexagesimal> TONE_MAP = Collections.unmodifiableMap(
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
private static final Map<String, T60Sexagesimal> CHINA_MAP = Collections.unmodifiableMap(
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v)));
private T60Sexagesimal(String idTone, String idLetter, String chinaKey, String chinaValue) {
this.getFacetStore().put(BaseFacetKey.ID_TONE, idTone);
this.getFacetStore().put(BaseFacetKey.ID_LETTER, idLetter);
this.getFacetStore().put(BaseFacetKey.CHINA_KEY, chinaKey);
this.getFacetStore().put(BaseFacetKey.CHINA_VALUE, 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 Map<BaseFacetKey, Object> getFacetStore() {
return facetStore;
public BaseFacetMap getBFM() {
return bfm;
}
public static void forEach(Consumer<T60Sexagesimal> consumer) {

View file

@ -0,0 +1,43 @@
package love.distributedrebirth.numberxd.base2t.facet;
import java.util.HashMap;
import java.util.Map;
public interface BaseFacetMap {
Object putInit(BaseFacetKey key, Object value);
Object get(BaseFacetKey key);
default String getString(BaseFacetKey key) {
return String.class.cast(get(key));
}
default Integer getInteger(BaseFacetKey key) {
return Integer.class.cast(get(key));
}
default Long getLong(BaseFacetKey key) {
return Long.class.cast(get(key));
}
default Boolean getBoolean(BaseFacetKey key) {
return Boolean.class.cast(get(key));
}
static BaseFacetMap newInstance() {
return new BaseFacetMap() {
final Map<BaseFacetKey,Object> initMap = new HashMap<>();
@Override
public Object get(BaseFacetKey key) {
return initMap.get(key);
}
@Override
public Object putInit(BaseFacetKey key, Object value) {
return initMap.put(key, value);
}
};
}
}

View file

@ -1,7 +1,5 @@
package love.distributedrebirth.numberxd.base2t.facet;
import java.util.Map;
/**
*
*
@ -9,5 +7,5 @@ import java.util.Map;
*/
public interface BaseFacetStore {
Map<BaseFacetKey, Object> getFacetStore();
BaseFacetMap getBFM();
}

View file

@ -10,18 +10,18 @@ public interface BasePart extends BaseFacetStore {
int ordinal();
default String getIdentifierTone() {
return (String)getFacetStore().get(BaseFacetKey.ID_TONE);
return getBFM().getString(BaseFacetKey.ID_TONE);
}
default String getIdentifierLetter() {
return (String)getFacetStore().get(BaseFacetKey.ID_LETTER);
return getBFM().getString(BaseFacetKey.ID_LETTER);
}
default String getChinaKey() {
return (String)getFacetStore().get(BaseFacetKey.CHINA_KEY);
return getBFM().getString(BaseFacetKey.CHINA_KEY);
}
default String getChinaValue() {
return (String)getFacetStore().get(BaseFacetKey.CHINA_VALUE);
return getBFM().getString(BaseFacetKey.CHINA_VALUE);
}
}

View file

@ -8,14 +8,14 @@ package love.distributedrebirth.numberxd.base2t.facet;
public interface BasePartAlt1 extends BasePart {
default String getAlt1Value() {
return (String)getFacetStore().get(BaseFacetKey.ALT_1_VALUE);
return getBFM().getString(BaseFacetKey.ALT_1_VALUE);
}
default String getAlt1Name() {
return (String)getFacetStore().get(BaseFacetKey.ALT_1_NAME);
return getBFM().getString(BaseFacetKey.ALT_1_NAME);
}
default String getAlt1Wiki() {
return (String)getFacetStore().get(BaseFacetKey.ALT_1_WIKI);
return getBFM().getString(BaseFacetKey.ALT_1_WIKI);
}
}

View file

@ -8,14 +8,14 @@ package love.distributedrebirth.numberxd.base2t.facet;
public interface BasePartAlt2 extends BasePartAlt1 {
default String getAlt2Value() {
return (String)getFacetStore().get(BaseFacetKey.ALT_2_VALUE);
return getBFM().getString(BaseFacetKey.ALT_2_VALUE);
}
default String getAlt2Name() {
return (String)getFacetStore().get(BaseFacetKey.ALT_2_NAME);
return getBFM().getString(BaseFacetKey.ALT_2_NAME);
}
default String getAlt2Wiki() {
return (String)getFacetStore().get(BaseFacetKey.ALT_2_WIKI);
return getBFM().getString(BaseFacetKey.ALT_2_WIKI);
}
}

View file

@ -8,14 +8,14 @@ package love.distributedrebirth.numberxd.base2t.facet;
public interface BasePartAlt3 extends BasePartAlt2 {
default String getAlt3Value() {
return (String)getFacetStore().get(BaseFacetKey.ALT_3_VALUE);
return getBFM().getString(BaseFacetKey.ALT_3_VALUE);
}
default String getAlt3Name() {
return (String)getFacetStore().get(BaseFacetKey.ALT_3_NAME);
return getBFM().getString(BaseFacetKey.ALT_3_NAME);
}
default String getAlt3Wiki() {
return (String)getFacetStore().get(BaseFacetKey.ALT_3_WIKI);
return getBFM().getString(BaseFacetKey.ALT_3_WIKI);
}
}

View file

@ -8,14 +8,14 @@ package love.distributedrebirth.numberxd.base2t.facet;
public interface BasePartAlt4 extends BasePartAlt3 {
default String getAlt4Value() {
return (String)getFacetStore().get(BaseFacetKey.ALT_4_VALUE);
return getBFM().getString(BaseFacetKey.ALT_4_VALUE);
}
default String getAlt4Name() {
return (String)getFacetStore().get(BaseFacetKey.ALT_4_NAME);
return getBFM().getString(BaseFacetKey.ALT_4_NAME);
}
default String getAlt4Wiki() {
return (String)getFacetStore().get(BaseFacetKey.ALT_4_WIKI);
return getBFM().getString(BaseFacetKey.ALT_4_WIKI);
}
}

View file

@ -8,6 +8,6 @@ package love.distributedrebirth.numberxd.base2t.facet;
public interface BasePartShiftBits extends BasePart {
default Integer getShiftBits() {
return (Integer)getFacetStore().get(BaseFacetKey.SHIFT_BITS);
return getBFM().getInteger(BaseFacetKey.SHIFT_BITS);
}
}