Added init annotation and method for boon's.

This commit is contained in:
Willem 2022-02-04 21:59:42 +01:00
parent 08de7c0f4f
commit 5a0b3978d1
18 changed files with 61 additions and 26 deletions

View file

@ -1,5 +1,6 @@
package love.distributedrebirth.bassboonyd; package love.distributedrebirth.bassboonyd;
import java.lang.reflect.Method;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -18,6 +19,18 @@ public interface BãßBȍőnCoffinOpenʸᴰ<T extends BãßBȍőnCoffinStoreKey
PUT_OBJ(key, new HashMap<>()); PUT_OBJ(key, new HashMap<>());
} }
default void INIT_BOON(Object boon) {
try {
for (Method m:boon.getClass().getMethods()) {
if (m.isAnnotationPresent(BãßBȍőnInitMethodʸᴰ.class)) {
m.invoke(boon, this);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
static <Y extends BãßBȍőnCoffinStoreKeyʸᴰ> BãßBȍőnCoffinOpenʸᴰ<Y> newInstance() { static <Y extends BãßBȍőnCoffinStoreKeyʸᴰ> BãßBȍőnCoffinOpenʸᴰ<Y> newInstance() {
return new BãßBȍőnCoffinOpenʸᴰ<Y>() { return new BãßBȍőnCoffinOpenʸᴰ<Y>() {
final Map<Y,Object> initMap = new HashMap<>(); final Map<Y,Object> initMap = new HashMap<>();

View file

@ -0,0 +1,13 @@
package love.distributedrebirth.bassboonyd;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface BãßBȍőnInitMethodʸᴰ {
}

View file

@ -8,7 +8,10 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnEnumInstanceʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnEnumInstanceʸᴰ;
import love.distributedrebirth.numberxd.base2t.glyph.BãßBȍőnGlyphSetKeyʸᴰ;
import love.distributedrebirth.numberxd.base2t.part.T08PartOctal; import love.distributedrebirth.numberxd.base2t.part.T08PartOctal;
import love.distributedrebirth.numberxd.base2t.type.V072Tong; import love.distributedrebirth.numberxd.base2t.type.V072Tong;
import love.distributedrebirth.numberxd.base2t.type.V144Tocta; import love.distributedrebirth.numberxd.base2t.type.V144Tocta;
@ -26,6 +29,12 @@ public enum Base2Terminator implements BãßBȍőnEnumInstanceʸᴰ<Base2Termina
private static final int BLOCK_TOCTA_SIZE = 18; private static final int BLOCK_TOCTA_SIZE = 18;
private static final int SHIFT_8 = 8; private static final int SHIFT_8 = 8;
private static final int SHIFT_16 = 16; private static final int SHIFT_16 = 16;
private final BãßBȍőnCoffinOpenʸᴰ<BãßBȍőnGlyphSetKeyʸᴰ> BBC = BãßBȍőnCoffinOpenʸᴰ.newInstance();
public BãßBȍőnCoffinʸᴰ<BãßBȍőnGlyphSetKeyʸᴰ> GET_BBC() { return BBC; }
private Base2Terminator() {
BBC.INIT_BOON(this);
}
public int Bãß2ReadTong(InputStream input, List<V072Tong> output) throws IOException { public int Bãß2ReadTong(InputStream input, List<V072Tong> output) throws IOException {
int totalBytes = 0; int totalBytes = 0;

View file

@ -84,5 +84,6 @@ public enum BaseGlyphSet implements BãßBȍőnGlyphSetʸᴰ<BaseGlyphSet> {
BBC.PUT_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.NUMBERS, numbers); BBC.PUT_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.NUMBERS, numbers);
BBC.PUT_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.HEXIMALS, hex); BBC.PUT_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.HEXIMALS, hex);
BBC.PUT_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.GEMATRIA, gematria); BBC.PUT_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.GEMATRIA, gematria);
BBC.INIT_BOON(this);
} }
} }

View file

@ -4,13 +4,25 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinStoreʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinStoreʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnEnumSetʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnEnumSetʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnInitMethodʸᴰ;
import love.distributedrebirth.numberxd.base2t.glyph.BaseGlyphSet; import love.distributedrebirth.numberxd.base2t.glyph.BaseGlyphSet;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public interface BãßBȍőnPartʸᴰ<T extends BãßBȍőnPartʸᴰ<T>> extends BãßBȍőnEnumSetʸᴰ<T>, BãßBȍőnCoffinStoreʸᴰ<BãßBȍőnPartKeyʸᴰ> { public interface BãßBȍőnPartʸᴰ<T extends BãßBȍőnPartʸᴰ<T>> extends BãßBȍőnEnumSetʸᴰ<T>, BãßBȍőnCoffinStoreʸᴰ<BãßBȍőnPartKeyʸᴰ> {
@BãßBȍőnInitMethodʸᴰ
default void initMapTone(BãßBȍőnCoffinOpenʸᴰ<BãßBȍőnPartKeyʸᴰ> BBC) {
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_TONE);
}
@BãßBȍőnInitMethodʸᴰ
default void initMapChina(BãßBȍőnCoffinOpenʸᴰ<BãßBȍőnPartKeyʸᴰ> BBC) {
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_CHINA);
}
default String BȍőnIdentifierTone() { default String BȍőnIdentifierTone() {
return GET_BBC().GET_STR(BãßBȍőnPartKeyʸᴰ.ID_TONE); return GET_BBC().GET_STR(BãßBȍőnPartKeyʸᴰ.ID_TONE);
} }

View file

@ -21,7 +21,6 @@ public enum T02PartBinary implements BãßBȍőnPartʸᴰ<T02PartBinary> {
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ID_TONE, idTone); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ID_TONE, idTone);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_TONE); BBC.INIT_BOON(this);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_CHINA);
} }
} }

View file

@ -22,7 +22,6 @@ public enum T03PartTrit implements BãßBȍőnPartʸᴰ<T03PartTrit> {
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ID_TONE, idTone); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ID_TONE, idTone);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_TONE); BBC.INIT_BOON(this);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_CHINA);
} }
} }

View file

@ -25,8 +25,7 @@ public enum T04PartQuad implements BãßBȍőnPartAlt1ʸᴰ<T04PartQuad> {
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_TONE); BBC.INIT_BOON(this);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_CHINA);
} }
public T02PartBinary splitPartBinary(T02PartBinary part) { public T02PartBinary splitPartBinary(T02PartBinary part) {

View file

@ -28,7 +28,6 @@ public enum T05PartPental implements BãßBȍőnPartAlt2ʸᴰ<T05PartPental> {
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_2_VALUE, alt2Value); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_2_VALUE, alt2Value);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_TONE); BBC.INIT_BOON(this);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_CHINA);
} }
} }

View file

@ -27,8 +27,7 @@ public enum T06PartSeximal implements BãßBȍőnPartAlt1ʸᴰ<T06PartSeximal> {
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_TONE); BBC.INIT_BOON(this);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_CHINA);
} }
public T02PartBinary splitPartBinary() { public T02PartBinary splitPartBinary() {

View file

@ -28,7 +28,6 @@ public enum T07PartPlanIt implements BãßBȍőnPartAlt1ʸᴰ<T07PartPlanIt> {
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_TONE); BBC.INIT_BOON(this);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_CHINA);
} }
} }

View file

@ -30,8 +30,7 @@ public enum T08PartOctal implements BãßBȍőnPartʸᴰ<T08PartOctal>,BãßBȍ
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.SHIFT_BITS, Integer.valueOf(shiftBits)); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.SHIFT_BITS, Integer.valueOf(shiftBits));
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_TONE); BBC.INIT_BOON(this);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_CHINA);
} }
public static T08PartOctal indexOf(T08PartOctal group, int value) { public static T08PartOctal indexOf(T08PartOctal group, int value) {

View file

@ -33,7 +33,6 @@ public enum T10PartDecimal implements BãßBȍőnPartAlt2ʸᴰ<T10PartDecimal> {
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_2_VALUE, alt2Value); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_2_VALUE, alt2Value);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_TONE); BBC.INIT_BOON(this);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_CHINA);
} }
} }

View file

@ -32,7 +32,6 @@ public enum T11PartUndecimal implements BãßBȍőnPartAlt1ʸᴰ<T11PartUndecima
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_TONE); BBC.INIT_BOON(this);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_CHINA);
} }
} }

View file

@ -33,7 +33,6 @@ public enum T12PartUncial implements BãßBȍőnPartAlt1ʸᴰ<T12PartUncial> {
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_TONE); BBC.INIT_BOON(this);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_CHINA);
} }
} }

View file

@ -37,8 +37,7 @@ public enum T16PartHex implements BãßBȍőnPartAlt1ʸᴰ<T16PartHex> {
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_1_VALUE, alt1Value);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_TONE); BBC.INIT_BOON(this);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_CHINA);
} }
public T02PartBinary splitPartBinary(T04PartQuad part) { public T02PartBinary splitPartBinary(T04PartQuad part) {

View file

@ -55,8 +55,7 @@ public enum T20PartScore implements BãßBȍőnPartAlt4ʸᴰ<T20PartScore> {
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_2_VALUE, alt2Value); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_2_VALUE, alt2Value);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_3_VALUE, alt3Value); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_3_VALUE, alt3Value);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_4_VALUE, alt4Value); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ALT_4_VALUE, alt4Value);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_TONE); BBC.INIT_BOON(this);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_CHINA);
} }
public T20PartScore BãßValueOfOpenLC(String openLCKey) { public T20PartScore BãßValueOfOpenLC(String openLCKey) {

View file

@ -79,7 +79,6 @@ public enum T60PartSexagesimal implements BãßBȍőnPartʸᴰ<T60PartSexagesima
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ID_TONE, idTone); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.ID_TONE, idTone);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, chinaKey);
BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue); BBC.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, chinaValue);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_TONE); BBC.INIT_BOON(this);
BBC.PUT_MAP(BãßBȍőnPartKeyʸᴰ.MAP_CHINA);
} }
} }