From e3e5c2fb15921ae5e6a86e66cdad8c08cba44375 Mon Sep 17 00:00:00 2001 From: Willem Cazander Date: Sun, 30 Jan 2022 19:04:03 +0100 Subject: [PATCH] Toegevoegt klompen en kaas getallen. --- .../demo4d/base2t/T60Sexagesimal.java | 106 +++++++++++++++++- .../demo4d/base2t/V654Tath.java | 12 -- .../demo4d/base2t/V654Triz.java | 53 +++++++++ .../demo4d/base2t/VCA8Tath.java | 54 +++++++++ .../demo4d/fraction4d/KaassGetậl.java | 72 +++++++++++- .../demo4d/fraction4d/KlompGetậl.java | 63 ++++++++++- 6 files changed, 342 insertions(+), 18 deletions(-) delete mode 100644 core/src/love/distributedrebirth/demo4d/base2t/V654Tath.java create mode 100644 core/src/love/distributedrebirth/demo4d/base2t/V654Triz.java create mode 100644 core/src/love/distributedrebirth/demo4d/base2t/VCA8Tath.java diff --git a/core/src/love/distributedrebirth/demo4d/base2t/T60Sexagesimal.java b/core/src/love/distributedrebirth/demo4d/base2t/T60Sexagesimal.java index 3fb9e72b..a5043c0b 100644 --- a/core/src/love/distributedrebirth/demo4d/base2t/T60Sexagesimal.java +++ b/core/src/love/distributedrebirth/demo4d/base2t/T60Sexagesimal.java @@ -1,5 +1,109 @@ package love.distributedrebirth.demo4d.base2t; -public enum T60Sexagesimal { +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.demo4d.base2t.facet.BaseFacet; +import love.distributedrebirth.demo4d.base2t.facet.BaseFacetKey; + +public enum T60Sexagesimal implements BaseFacet { // TODO impl too + PART_1 ("˧","0","","100"), + PART_2 ("˧","1","","101"), // ? + PART_3 ("˧","2","",""), + PART_4 ("˧","3","",""), + PART_5 ("˧","4","",""), + PART_6 ("˧","5","",""), + PART_7 ("˧","6","",""), + PART_8 ("˧","7","",""), + PART_9 ("˧","8","",""), + PART_10("˧","9","",""), + PART_11("˧","10","",""), + PART_12("˧","11","",""), + PART_13("˧","","",""), + PART_14("˧","","",""), + PART_15("˧","","",""), + PART_16("˧","","",""), + PART_17("˧","","",""), + PART_18("˧","","",""), + PART_19("˧","","",""), + PART_20("˧","","",""), + PART_21("˧","","",""), + PART_22("˧","","",""), + PART_23("˧","","",""), + PART_24("˧","","",""), + PART_25("˧","","",""), + PART_26("˧","","",""), + PART_27("˧","","",""), + PART_28("˧","","",""), + PART_29("˧","","",""), + PART_30("˧","","",""), + PART_31("˧","","",""), + PART_32("˧","","",""), + PART_33("˧","","",""), + PART_34("˧","","",""), + PART_35("˧","","",""), + PART_36("˧","","",""), + PART_37("˧","","",""), + PART_38("˧","","",""), + PART_39("˧","","",""), + PART_40("˧","","",""), + PART_41("˧","","",""), + PART_42("˧","","",""), + PART_43("˧","","",""), + PART_44("˧","","",""), + PART_45("˧","","",""), + PART_46("˧","","",""), + PART_47("˧","","",""), + PART_48("˧","","",""), + PART_49("˧","","",""), + PART_50("˧","","",""), + PART_51("˧","","",""), + PART_52("˧","","",""), + PART_53("˧","","",""), + PART_54("˧","","",""), + PART_55("˧","","",""), + PART_56("˧","","",""), + PART_57("˧","","",""), + PART_58("˧","","",""), + PART_59("˧","","",""), + PART_60("˧","","",""), + ; + + public static int LENGTH = 60; + private final Map facetStore = new HashMap<>(); + 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 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); + } + + @Override + public Map getFacetStore() { + return facetStore; + } + + 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); + } } diff --git a/core/src/love/distributedrebirth/demo4d/base2t/V654Tath.java b/core/src/love/distributedrebirth/demo4d/base2t/V654Tath.java deleted file mode 100644 index 6877c06d..00000000 --- a/core/src/love/distributedrebirth/demo4d/base2t/V654Tath.java +++ /dev/null @@ -1,12 +0,0 @@ -package love.distributedrebirth.demo4d.base2t; - -/** - * Holds an 1620 bit value. - * - * @author willemtsade ©Δ∞ 仙上主天 - * - */ -public class V654Tath { - - // TODO: 27(V01BTemvig) * T60Sexagesimal -} diff --git a/core/src/love/distributedrebirth/demo4d/base2t/V654Triz.java b/core/src/love/distributedrebirth/demo4d/base2t/V654Triz.java new file mode 100644 index 00000000..7b0d2bd5 --- /dev/null +++ b/core/src/love/distributedrebirth/demo4d/base2t/V654Triz.java @@ -0,0 +1,53 @@ +package love.distributedrebirth.demo4d.base2t; + +/** + * Holds an 1620 bit value. + * + * @author willemtsade ©Δ∞ 仙上主天 + * + */ +public class V654Triz implements BaseNumberTyte { + + public static int BIT_COUNT = V01BTemvig.BIT_COUNT * T60Sexagesimal.LENGTH; + private V01BTemvig[] values = new V01BTemvig[T60Sexagesimal.LENGTH]; + + public V654Triz() { + for (int i=0;i getValue(v).fillOctalValues(appender)); + } + + @Override + public void fillTyteValues(V009TyteBaseAppender appender) { + T60Sexagesimal.forEach(v -> getValue(v).fillTyteValues(appender)); + } +} diff --git a/core/src/love/distributedrebirth/demo4d/base2t/VCA8Tath.java b/core/src/love/distributedrebirth/demo4d/base2t/VCA8Tath.java new file mode 100644 index 00000000..6a21952a --- /dev/null +++ b/core/src/love/distributedrebirth/demo4d/base2t/VCA8Tath.java @@ -0,0 +1,54 @@ +package love.distributedrebirth.demo4d.base2t; + +/** + * Holds an 3240 bit value. + * + * @author willemtsade ©Δ∞ 仙上主天 + * + */ +public class VCA8Tath implements BaseNumberTyte { + + public static int BIT_COUNT = V654Triz.BIT_COUNT * T02PartBinary.LENGTH; + private V654Triz[] values = new V654Triz[T02PartBinary.LENGTH]; + + public VCA8Tath() { + this(new V654Triz(), new V654Triz()); + } + + public VCA8Tath(T08PartOctalBaseIterator values) { + this(new V654Triz(values), new V654Triz(values)); + } + + private VCA8Tath(V654Triz valueHigh, V654Triz valueLow) { + setValue(T02PartBinary.PART_1, valueHigh); + setValue(T02PartBinary.PART_2, valueLow); + } + + public V654Triz getValue(T02PartBinary part) { + return values[part.ordinal()]; + } + + public void setValue(T02PartBinary part, V654Triz value) { + values[part.ordinal()] = value; + } + + @Override + public int getBitCount() { + return BIT_COUNT; + } + + @Override + public VCA8Tath toClone() { + return new VCA8Tath(cloneIterator()); + } + + @Override + public void fillOctalValues(T08PartOctalBaseAppender appender) { + T02PartBinary.forEach(v -> getValue(v).fillOctalValues(appender)); + } + + @Override + public void fillTyteValues(V009TyteBaseAppender appender) { + T02PartBinary.forEach(v -> getValue(v).fillTyteValues(appender)); + } +} diff --git a/core/src/love/distributedrebirth/demo4d/fraction4d/KaassGetậl.java b/core/src/love/distributedrebirth/demo4d/fraction4d/KaassGetậl.java index 133b96ca..0a680ec2 100644 --- a/core/src/love/distributedrebirth/demo4d/fraction4d/KaassGetậl.java +++ b/core/src/love/distributedrebirth/demo4d/fraction4d/KaassGetậl.java @@ -1,6 +1,74 @@ package love.distributedrebirth.demo4d.fraction4d; -public class KaassGetậl { +import love.distributedrebirth.demo4d.base2t.BaseNumberTyte; +import love.distributedrebirth.demo4d.base2t.T08PartOctalBaseAppender; +import love.distributedrebirth.demo4d.base2t.T08PartOctalBaseIterator; +import love.distributedrebirth.demo4d.base2t.V009TyteBaseAppender; - // array of KlompGetậl sliced as cheese +/** + * Array of KlompGetậl sliced as cheese. + * + * @author willemtsade ©Δ∞ 仙上主天 + * + */ +public class KaassGetậl implements BaseNumberTyte { + + private KlompGetậl[] kaas; + private final int kaasCuts; + + public KaassGetậl(int kaasCuts) { + this.kaasCuts = kaasCuts; + this.kaas = new KlompGetậl[kaasCuts]; + } + + public final int getKaasCuts() { + return kaasCuts; + } + + private final int validatePartRequest(int part) { + if (part < 0) { + throw new IllegalArgumentException("Requested part is negative"); + } + if (part > kaasCuts) { + throw new IllegalArgumentException("Requested part exceeds kaasCuts storage"); + } + return part; + } + + public final KlompGetậl getValue(int part) { + return kaas[validatePartRequest(part)]; + } + + public final void setValue(int part, KlompGetậl value) { + kaas[validatePartRequest(part)] = value; + } + + @Override + public final KaassGetậl toClone() { + KaassGetậl result = new KaassGetậl(getKaasCuts()); + T08PartOctalBaseIterator clonedOctals = cloneIterator(); + for (int i=0;i { + + public static int BIT_COUNT = V654Triz.BIT_COUNT * T08PartOctal.LENGTH; + private final VCA8Tath[] values = new VCA8Tath[T08PartOctal.LENGTH]; + + public KlompGetậl() { + for (int i=0;i getValue(v).fillOctalValues(appender)); + } + + @Override + public void fillTyteValues(V009TyteBaseAppender appender) { + T08PartOctal.forEach(v -> getValue(v).fillTyteValues(appender)); + } }