Added base2 terminator code.

This commit is contained in:
Willem Cazander 2022-01-28 11:19:52 +01:00
parent e52e565d64
commit f51a97f449
29 changed files with 1131 additions and 0 deletions

View file

@ -0,0 +1,97 @@
package love.distributedrebirth.demo4d.base2t;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class Base2Terminator {
private static final int STREAM_EOF = -1;
private static final int BLOCK_TONG_SIZE = 18;
private static final int BLOCK_TOCTA_SIZE = 18;
private static final int SHIFT_8 = 8;
private static final int SHIFT_16 = 16;
public int base2ReadTong(InputStream input, List<V072Tong> output) throws IOException {
int totalBytes = 0;
byte[] data = new byte[BLOCK_TONG_SIZE];
int readDataSize = 0; // per 9 bytes we have 24 octals for one V072Tong number
while ((readDataSize = input.read(data, 0, data.length)) != STREAM_EOF) {
base2ReadCheckSize(readDataSize, BLOCK_TONG_SIZE);
int v0 = data[0] + (data[1] << SHIFT_8) + (data[2] << SHIFT_16);
int v1 = data[3] + (data[4] << SHIFT_8) + (data[5] << SHIFT_16);
int v2 = data[6] + (data[7] << SHIFT_8) + (data[8] << SHIFT_16);
List<T08PartOctal> octals = base2ReadOctals(v0, v1, v2);
output.add(new V072Tong(new T08PartOctalIterator(octals.iterator())));
totalBytes += BLOCK_TONG_SIZE;
}
return totalBytes;
}
public int base2ReadTocta(InputStream input, List<V144Tocta> output) throws IOException {
int totalBytes = 0;
byte[] data = new byte[BLOCK_TOCTA_SIZE];
int readDataSize = 0; // per 18 bytes we have 48 octals for one V144Tocta number
while ((readDataSize = input.read(data, 0, data.length)) != STREAM_EOF) {
base2ReadCheckSize(readDataSize, BLOCK_TOCTA_SIZE);
int v0 = data[0] + (data[1] << SHIFT_8) + (data[2] << SHIFT_16);
int v1 = data[3] + (data[4] << SHIFT_8) + (data[5] << SHIFT_16);
int v2 = data[6] + (data[7] << SHIFT_8) + (data[8] << SHIFT_16);
int v3 = data[9] + (data[10] << SHIFT_8) + (data[11] << SHIFT_16);
int v4 = data[12] + (data[13] << SHIFT_8) + (data[14] << SHIFT_16);
int v5 = data[15] + (data[16] << SHIFT_8) + (data[17] << SHIFT_16);
List<T08PartOctal> octals = base2ReadOctals(v0, v1, v2, v3, v4, v5);
output.add(new V144Tocta(new T08PartOctalIterator(octals.iterator())));
totalBytes += BLOCK_TOCTA_SIZE;
}
return totalBytes;
}
private void base2ReadCheckSize(int readDataSize, int expectedSize) throws IOException {
if (readDataSize < expectedSize) {
throw new IOException("Expected "+expectedSize+" bytes, got: "+readDataSize);
}
}
private List<T08PartOctal> base2ReadOctals(int...values) {
List<T08PartOctal> octals = new ArrayList<>();
for (int value:values) {
T08PartOctal.forEach(v -> octals.add(T08PartOctal.indexOf(v, value)));
}
return octals;
}
public int base2WriteTong(List<V072Tong> data, OutputStream output) throws IOException {
return base2Write(data, output);
}
public int base2WriteTocta(List<V144Tocta> data, OutputStream output) throws IOException {
return base2Write(data, output);
}
private <T extends BaseNumber<T>> int base2Write(List<T> data, OutputStream output) throws IOException {
int totalBytes = 0; // per 8 octa's is 3 bytes
List<T08PartOctal> octals = new ArrayList<>();
T08PartOctalBaseAppender appender = new T08PartOctalBaseAppender(octals);
data.forEach(v -> v.fillOctalValues(appender));
Iterator<T08PartOctal> read = octals.iterator();
while (read.hasNext()) {
int byteTriplet = 0;
byteTriplet += read.next().ordinalOf(T08PartOctal.PART_1);
byteTriplet += read.next().ordinalOf(T08PartOctal.PART_2);
byteTriplet += read.next().ordinalOf(T08PartOctal.PART_3);
byteTriplet += read.next().ordinalOf(T08PartOctal.PART_4);
byteTriplet += read.next().ordinalOf(T08PartOctal.PART_5);
byteTriplet += read.next().ordinalOf(T08PartOctal.PART_6);
byteTriplet += read.next().ordinalOf(T08PartOctal.PART_7);
byteTriplet += read.next().ordinalOf(T08PartOctal.PART_8);
output.write(byteTriplet);
output.write(byteTriplet >> SHIFT_8);
output.write(byteTriplet >> SHIFT_16);
totalBytes += 3;
}
return totalBytes;
}
}

View file

@ -0,0 +1,6 @@
package love.distributedrebirth.demo4d.base2t;
public interface BaseAppender<T> {
void add(T value);
}

View file

@ -0,0 +1,17 @@
package love.distributedrebirth.demo4d.base2t;
import java.util.ArrayList;
import java.util.List;
public interface BaseNumber<V extends BaseNumber<V>> {
V toClone();
void fillOctalValues(T08PartOctalBaseAppender appender);
default T08PartOctalIterator cloneIterator() {
List<T08PartOctal> octals = new ArrayList<>();
fillOctalValues(new T08PartOctalBaseAppender(octals));
return new T08PartOctalIterator(octals.iterator());
}
}

View file

@ -0,0 +1,6 @@
package love.distributedrebirth.demo4d.base2t;
public interface BaseNumberTyte<V extends BaseNumber<V>> extends BaseNumber<V> {
void fillTyteValues(V009TyteBaseAppender appender);
}

View file

@ -0,0 +1,6 @@
package love.distributedrebirth.demo4d.base2t;
public interface BasePartIdentifier {
String getIdentifier();
}

View file

@ -0,0 +1,8 @@
package love.distributedrebirth.demo4d.base2t;
public interface BasePartIdentifierAlt extends BasePartIdentifier {
String getIdentifierAlt();
BasePartIdentifierAltInfo getIdentifierAltInfo();
}

View file

@ -0,0 +1,20 @@
package love.distributedrebirth.demo4d.base2t;
public class BasePartIdentifierAltInfo {
private final String altName;
private final String altWiki;
public BasePartIdentifierAltInfo(String altName, String altWiki) {
this.altName = altName;
this.altWiki = altWiki;
}
public String getAltName() {
return altName;
}
public String getAltWiki() {
return altWiki;
}
}

View file

@ -0,0 +1,6 @@
package love.distributedrebirth.demo4d.base2t;
public interface BasePartIdentifierTone extends BasePartIdentifier {
String getIdentifierTone();
}

View file

@ -0,0 +1,35 @@
package love.distributedrebirth.demo4d.base2t;
import java.util.function.Consumer;
public enum T02PartBinary implements BasePartIdentifierTone {
PART_1("0","˥"),
PART_2("1","˩"),
;
public static int LENGTH = 2;
private final String identifier;
private final String identifierTone;
private T02PartBinary(String identifier, String identifierTone) {
this.identifier = identifier;
this.identifierTone = identifierTone;
}
@Override
public String getIdentifier() {
return identifier;
}
@Override
public String getIdentifierTone() {
return identifierTone;
}
public static void forEach(Consumer<T02PartBinary> consumer) {
for (T02PartBinary value:values()) {
consumer.accept(value);
}
}
}

View file

@ -0,0 +1,36 @@
package love.distributedrebirth.demo4d.base2t;
import java.util.function.Consumer;
public enum T03PartTrit implements BasePartIdentifierTone {
PART_1("0","˦"),
PART_2("1","˧"),
PART_3("2","˨"),
;
public static int LENGTH = 3;
private final String identifier;
private final String identifierTone;
private T03PartTrit(String identifier, String identifierTone) {
this.identifier = identifier;
this.identifierTone = identifierTone;
}
@Override
public String getIdentifier() {
return identifier;
}
@Override
public String getIdentifierTone() {
return identifierTone;
}
public static void forEach(Consumer<T03PartTrit> consumer) {
for (T03PartTrit value:values()) {
consumer.accept(value);
}
}
}

View file

@ -0,0 +1,55 @@
package love.distributedrebirth.demo4d.base2t;
import java.util.function.Consumer;
public enum T04PartQuad implements BasePartIdentifierAlt,BasePartIdentifierTone {
PART_1("0","N","˥"),
PART_2("1","E","˦"),
PART_3("2","W","˨"),
PART_4("3","S","˩"),
;
public static int LENGTH = 4;
private final String identifier;
private final String identifierAlt;
private final String identifierTone;
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
"Cardinal direction","https://simple.wikipedia.org/wiki/Cardinal_direction");
private T04PartQuad(String identifier, String identifierAlt, String identifierTone) {
this.identifier = identifier;
this.identifierAlt = identifierAlt;
this.identifierTone = identifierTone;
}
@Override
public String getIdentifier() {
return identifier;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
}
@Override
public String getIdentifierTone() {
return identifierTone;
}
@Override
public BasePartIdentifierAltInfo getIdentifierAltInfo() {
return ALT_INFO;
}
public T02PartBinary splitPartBinary(T02PartBinary part) {
return T02PartBinary.values()[(ordinal() >> part.ordinal()) & 1];
}
public static void forEach(Consumer<T04PartQuad> consumer) {
for (T04PartQuad value:values()) {
consumer.accept(value);
}
}
}

View file

@ -0,0 +1,52 @@
package love.distributedrebirth.demo4d.base2t;
import java.util.function.Consumer;
public enum T05PartPental implements BasePartIdentifierAlt,BasePartIdentifierTone {
PART_1("0","\u706b","˥"),
PART_2("1","\u571f","˦"),
PART_3("2","\u91d1","˧"),
PART_4("3","\u6c34","˨"),
PART_5("4","\u6728","˩"),
;
public static int LENGTH = 5;
private final String identifier;
private final String identifierAlt; // escaped to keep normal line height in IDE
private final String identifierTone;
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
"Wuxing","https://en.wikipedia.org/wiki/Wuxing_(Chinese_philosophy)");
private T05PartPental(String identifier, String identifierAlt, String identifierTone) {
this.identifier = identifier;
this.identifierAlt = identifierAlt;
this.identifierTone = identifierTone;
}
@Override
public String getIdentifier() {
return identifier;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
}
@Override
public String getIdentifierTone() {
return identifierTone;
}
@Override
public BasePartIdentifierAltInfo getIdentifierAltInfo() {
return ALT_INFO;
}
public static void forEach(Consumer<T05PartPental> consumer) {
for (T05PartPental value:values()) {
consumer.accept(value);
}
}
}

View file

@ -0,0 +1,61 @@
package love.distributedrebirth.demo4d.base2t;
import java.util.function.Consumer;
public enum T06PartSeximal implements BasePartIdentifierAlt,BasePartIdentifierTone {
PART_1("0","A","˧˥"),
PART_2("1","D","˧˩"),
PART_3("2","F","˨˦"),
PART_4("3","G","˦˨"),
PART_5("4","V","˩˧"),
PART_6("5","X","˥˧"),
;
public static int LENGTH = 6;
private final String identifier;
private final String identifierAlt;
private final String identifierTone;
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
"ADFGVX cipher","https://en.wikipedia.org/wiki/ADFGVX_cipher");
private T06PartSeximal(String identifier, String identifierAlt, String identifierTone) {
this.identifier = identifier;
this.identifierAlt = identifierAlt;
this.identifierTone = identifierTone;
}
@Override
public String getIdentifier() {
return identifier;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
}
@Override
public String getIdentifierTone() {
return identifierTone;
}
@Override
public BasePartIdentifierAltInfo getIdentifierAltInfo() {
return ALT_INFO;
}
public T02PartBinary splitPartBinary() {
return T02PartBinary.values()[ordinal() & 1];
}
public T03PartTrit splitPartTrit() {
return T03PartTrit.values()[ordinal() >> 1];
}
public static void forEach(Consumer<T06PartSeximal> consumer) {
for (T06PartSeximal value:values()) {
consumer.accept(value);
}
}
}

View file

@ -0,0 +1,74 @@
package love.distributedrebirth.demo4d.base2t;
import java.util.function.Consumer;
public enum T08PartOctal implements BasePartIdentifierAlt, BasePartIdentifierTone {
PART_1("0","˧˥˩","˥˩˧", 0),
PART_2("1","˧˩˥","˩˥˧", 3),
PART_3("2","˧˥˦","˥˦˧", 6),
PART_4("3","˧˩˨","˩˨˧", 9),
PART_5("4","˧˦˦","˦˦˧", 12),
PART_6("5","˧˨˨","˨˨˧", 15),
PART_7("6","˧˥˥","˥˥˧", 18),
PART_8("7","˧˩˩","˩˩˧", 21),
;
public static int LENGTH = 8;
private static final byte BITMASK = 0x07;
private final String identifier;
private final String identifierAlt; // absolute
private final String identifierTone; // relative
private final int shiftBits;
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
"Tone Letters","https://en.wikipedia.org/wiki/Tone_letter");
private T08PartOctal(String identifier, String identifierAlt, String identifierTone, int shiftBits) {
this.identifier = identifier;
this.identifierAlt = identifierAlt;
this.identifierTone = identifierTone;
this.shiftBits = shiftBits;
}
@Override
public String getIdentifier() {
return identifier;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
}
@Override
public String getIdentifierTone() {
return identifierTone;
}
@Override
public BasePartIdentifierAltInfo getIdentifierAltInfo() {
return ALT_INFO;
}
public int getShiftBits() {
return shiftBits;
}
public int ordinalOf(T08PartOctal group) {
return ordinal() << group.getShiftBits();
}
public static T08PartOctal indexOf(T08PartOctal group, int value) {
return T08PartOctal.values()[(value >> group.getShiftBits()) & BITMASK];
}
public T02PartBinary splitPartBinary(T03PartTrit part) {
return T02PartBinary.values()[(ordinal() >> part.ordinal()) & 1];
}
public static void forEach(Consumer<T08PartOctal> consumer) {
for (T08PartOctal value:values()) {
consumer.accept(value);
}
}
}

View file

@ -0,0 +1,17 @@
package love.distributedrebirth.demo4d.base2t;
import java.util.Collection;
public final class T08PartOctalBaseAppender implements BaseAppender<T08PartOctal> {
private final Collection<T08PartOctal> collection;
public T08PartOctalBaseAppender(Collection<T08PartOctal> collection) {
this.collection = collection;
}
@Override
public void add(T08PartOctal value) {
collection.add(value);
}
}

View file

@ -0,0 +1,22 @@
package love.distributedrebirth.demo4d.base2t;
import java.util.Iterator;
public final class T08PartOctalIterator implements Iterator<T08PartOctal> {
private final Iterator<T08PartOctal> iterator;
public T08PartOctalIterator(Iterator<T08PartOctal> iterator) {
this.iterator = iterator;
}
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public T08PartOctal next() {
return iterator.next();
}
}

View file

@ -0,0 +1,52 @@
package love.distributedrebirth.demo4d.base2t;
import java.util.function.Consumer;
public enum T12PartUncial implements BasePartIdentifierAlt {
PART_1("0","0"),
PART_2("1","1"),
PART_3("2","2"),
PART_4("3","3"),
PART_5("4","4"),
PART_6("5","5"),
PART_7("6","6"),
PART_8("7","7"),
PART_9("8","8"),
PART_10("9","9"),
PART_11("A","\u218a"), // TURNED DIGIT TWO
PART_12("B","\u218b"), // TURNED DIGIT THREE
;
public static int LENGTH = 12;
private final String identifier;
private final String identifierAlt;
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
"Transdecimal symbols","https://en.wikipedia.org/wiki/Duodecimal#Transdecimal_symbols");
private T12PartUncial(String identifier, String identifierAlt) {
this.identifier = identifier;
this.identifierAlt = identifierAlt;
}
@Override
public String getIdentifier() {
return identifier;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
}
@Override
public BasePartIdentifierAltInfo getIdentifierAltInfo() {
return ALT_INFO;
}
public static void forEach(Consumer<T12PartUncial> consumer) {
for (T12PartUncial value:values()) {
consumer.accept(value);
}
}
}

View file

@ -0,0 +1,67 @@
package love.distributedrebirth.demo4d.base2t;
import java.util.function.Consumer;
public enum T16PartHex implements BasePartIdentifierAlt, BasePartIdentifierTone {
PART_1("0","1","˧˥˩"),
PART_2("1","2","˧˩˥"),
PART_3("2","3","˧˥˦"),
PART_4("3","A","˧˩˨"),
PART_5("4","4","˧˦˦"),
PART_6("5","5","˧˨˨"),
PART_7("6","6","˧˥˥"),
PART_8("7","B","˧˩˩"),
PART_9("8","7","˥˩˧"),
PART_10("9","8","˩˥˧"),
PART_11("A","9","˥˦˧"),
PART_12("B","C","˩˨˧"),
PART_13("C","*","˦˦˧"),
PART_14("D","0","˨˨˧"),
PART_15("E","#","˥˥˧"),
PART_16("F","D","˩˩˧"),
;
public static int LENGTH = 16;
private final String identifier;
private final String identifierAlt;
private final String identifierTone;
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
"Dual-tone multi-frequency signaling","https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling");
private T16PartHex(String identifier, String identifierAlt, String identifierTone) {
this.identifier = identifier;
this.identifierAlt = identifierAlt;
this.identifierTone = identifierTone;
}
@Override
public String getIdentifier() {
return identifier;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
}
@Override
public String getIdentifierTone() {
return identifierTone;
}
@Override
public BasePartIdentifierAltInfo getIdentifierAltInfo() {
return ALT_INFO;
}
public T02PartBinary splitPartBinary(T04PartQuad part) {
return T02PartBinary.values()[(ordinal() >> part.ordinal()) & 1];
}
public static void forEach(Consumer<T16PartHex> consumer) {
for (T16PartHex value:values()) {
consumer.accept(value);
}
}
}

View file

@ -0,0 +1,60 @@
package love.distributedrebirth.demo4d.base2t;
import java.util.function.Consumer;
public enum T20PartScore implements BasePartIdentifierAlt {
PART_1("0","2"),
PART_2("1","3"),
PART_3("2","4"),
PART_4("3","5"),
PART_5("4","6"),
PART_6("5","7"),
PART_7("6","8"),
PART_8("7","9"),
PART_9("8","C"),
PART_10("9","F"),
PART_11("A","G"),
PART_12("B","H"),
PART_13("C","J"),
PART_14("D","M"),
PART_15("E","P"),
PART_16("F","Q"),
PART_17("G","R"),
PART_18("H","V"),
PART_19("I","W"),
PART_20("J","X"),
;
public static int LENGTH = 20;
private final String identifier;
private final String identifierAlt;
private static final BasePartIdentifierAltInfo ALT_INFO = new BasePartIdentifierAltInfo(
"Open Location Code","https://en.wikipedia.org/wiki/Open_Location_Code");
private T20PartScore(String identifier, String identifierAlt) {
this.identifier = identifier;
this.identifierAlt = identifierAlt;
}
@Override
public String getIdentifier() {
return identifier;
}
@Override
public String getIdentifierAlt() {
return identifierAlt;
}
@Override
public BasePartIdentifierAltInfo getIdentifierAltInfo() {
return ALT_INFO;
}
public static void forEach(Consumer<T20PartScore> consumer) {
for (T20PartScore value:values()) {
consumer.accept(value);
}
}
}

View file

@ -0,0 +1,36 @@
package love.distributedrebirth.demo4d.base2t;
public final class V003Timble implements BaseNumber<V003Timble> {
private T08PartOctal value;
public V003Timble() {
this(T08PartOctal.PART_1);
}
public V003Timble(T08PartOctalIterator values) {
this(values.next());
}
public V003Timble(T08PartOctal value) {
setValue(value);
}
public void setValue(T08PartOctal value) {
this.value = value;
}
public T08PartOctal getValue() {
return value;
}
@Override
public V003Timble toClone() {
return new V003Timble(getValue());
}
@Override
public void fillOctalValues(T08PartOctalBaseAppender appender) {
appender.add(getValue());
}
}

View file

@ -0,0 +1,37 @@
package love.distributedrebirth.demo4d.base2t;
public final class V006Tixte implements BaseNumber<V006Tixte> {
private V003Timble[] values = new V003Timble[T02PartBinary.LENGTH];
public V006Tixte() {
this(new V003Timble(), new V003Timble());
}
public V006Tixte(T08PartOctalIterator values) {
this(new V003Timble(values), new V003Timble(values));
}
public V006Tixte(V003Timble valueHigh, V003Timble valueLow) {
setValue(T02PartBinary.PART_1, valueHigh);
setValue(T02PartBinary.PART_2, valueLow);
}
public V003Timble getValue(T02PartBinary part) {
return values[part.ordinal()];
}
public void setValue(T02PartBinary part, V003Timble value) {
values[part.ordinal()] = value;
}
@Override
public V006Tixte toClone() {
return new V006Tixte(cloneIterator());
}
@Override
public void fillOctalValues(T08PartOctalBaseAppender appender) {
T02PartBinary.forEach(v -> getValue(v).fillOctalValues(appender));
}
}

View file

@ -0,0 +1,47 @@
package love.distributedrebirth.demo4d.base2t;
public final class V009Tyte implements BaseNumberTyte<V009Tyte> {
private V003Timble[] values = new V003Timble[T03PartTrit.LENGTH];
public V009Tyte() {
this(new V003Timble(), new V003Timble(), new V003Timble());
}
public V009Tyte(T08PartOctalIterator values) {
this(new V003Timble(values), new V003Timble(values), new V003Timble(values));
}
public V009Tyte(T08PartOctal valueHigh, T08PartOctal valueMedium, T08PartOctal valueLow) {
this(new V003Timble(valueHigh), new V003Timble(valueMedium), new V003Timble(valueLow));
}
public V009Tyte(V003Timble valueHigh, V003Timble valueMedium, V003Timble valueLow) {
setValue(T03PartTrit.PART_1, valueHigh);
setValue(T03PartTrit.PART_2, valueMedium);
setValue(T03PartTrit.PART_3, valueLow);
}
public V003Timble getValue(T03PartTrit part) {
return values[part.ordinal()];
}
public void setValue(T03PartTrit part, V003Timble value) {
values[part.ordinal()] = value;
}
@Override
public V009Tyte toClone() {
return new V009Tyte(cloneIterator());
}
@Override
public void fillOctalValues(T08PartOctalBaseAppender appender) {
T03PartTrit.forEach(v -> getValue(v).fillOctalValues(appender));
}
@Override
public void fillTyteValues(V009TyteBaseAppender appender) {
appender.add(this);
}
}

View file

@ -0,0 +1,17 @@
package love.distributedrebirth.demo4d.base2t;
import java.util.Collection;
public final class V009TyteBaseAppender implements BaseAppender<V009Tyte> {
private final Collection<V009Tyte> collection;
public V009TyteBaseAppender(Collection<V009Tyte> collection) {
this.collection = collection;
}
@Override
public void add(V009Tyte value) {
collection.add(value);
}
}

View file

@ -0,0 +1,22 @@
package love.distributedrebirth.demo4d.base2t;
import java.util.Iterator;
public final class V009TyteIterator implements Iterator<V009Tyte> {
private final Iterator<V009Tyte> iterator;
public V009TyteIterator(Iterator<V009Tyte> iterator) {
this.iterator = iterator;
}
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public V009Tyte next() {
return iterator.next();
}
}

View file

@ -0,0 +1,54 @@
package love.distributedrebirth.demo4d.base2t;
public final class V018Tord implements BaseNumberTyte<V018Tord> {
private V009Tyte[] values = new V009Tyte[T02PartBinary.LENGTH];
public V018Tord() {
this(new V009Tyte(), new V009Tyte());
}
public V018Tord(T08PartOctalIterator values) {
this(new V009Tyte(values), new V009Tyte(values));
}
public V018Tord(V009TyteIterator values) {
this(values.next(), values.next());
}
public V018Tord(V009Tyte valueHigh, V009Tyte valueLow) {
setValue(T02PartBinary.PART_1, valueHigh);
setValue(T02PartBinary.PART_2, valueLow);
}
public V009Tyte getValue(T02PartBinary part) {
return values[part.ordinal()];
}
public void setValue(T02PartBinary part, V009Tyte value) {
values[part.ordinal()] = value;
}
public V003Timble getTimblePart(T06PartSeximal part) {
return getValue(part.splitPartBinary()).getValue(part.splitPartTrit());
}
public void setTimblePart(T06PartSeximal part, V003Timble value) {
getValue(part.splitPartBinary()).setValue(part.splitPartTrit(), value);;
}
@Override
public V018Tord toClone() {
return new V018Tord(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));
}
}

View file

@ -0,0 +1,47 @@
package love.distributedrebirth.demo4d.base2t;
public final class V027Temvig implements BaseNumberTyte<V027Temvig> {
private V009Tyte[] values = new V009Tyte[T03PartTrit.LENGTH];
public V027Temvig() {
this(new V009Tyte(), new V009Tyte(), new V009Tyte());
}
public V027Temvig(T08PartOctalIterator values) {
this(new V009Tyte(values), new V009Tyte(values), new V009Tyte(values));
}
public V027Temvig(V009TyteIterator values) {
this(values.next(), values.next(), values.next());
}
public V027Temvig(V009Tyte valueHigh, V009Tyte valueMedium, V009Tyte valueLow) {
setValue(T03PartTrit.PART_1, valueHigh);
setValue(T03PartTrit.PART_2, valueMedium);
setValue(T03PartTrit.PART_3, valueLow);
}
public V009Tyte getValue(T03PartTrit part) {
return values[part.ordinal()];
}
public void setValue(T03PartTrit part, V009Tyte value) {
values[part.ordinal()] = value;
}
@Override
public V027Temvig toClone() {
return new V027Temvig(cloneIterator());
}
@Override
public void fillOctalValues(T08PartOctalBaseAppender appender) {
T03PartTrit.forEach(v -> getValue(v).fillOctalValues(appender));
}
@Override
public void fillTyteValues(V009TyteBaseAppender appender) {
T03PartTrit.forEach(v -> getValue(v).fillTyteValues(appender));
}
}

View file

@ -0,0 +1,56 @@
package love.distributedrebirth.demo4d.base2t;
public final class V036Teger implements BaseNumberTyte<V036Teger> {
private V018Tord[] values = new V018Tord[T02PartBinary.LENGTH];
public V036Teger() {
this(new V018Tord(), new V018Tord());
}
public V036Teger(T08PartOctalIterator values) {
this(new V018Tord(values), new V018Tord(values));
}
public V036Teger(V009TyteIterator values) {
this(new V018Tord(values), new V018Tord(values));
}
public V036Teger(V018Tord valueHigh, V018Tord valueLow) {
setValue(T02PartBinary.PART_1, valueHigh);
setValue(T02PartBinary.PART_2, valueLow);
}
public V018Tord getValue(T02PartBinary part) {
return values[part.ordinal()];
}
public void setValue(T02PartBinary part, V018Tord value) {
values[part.ordinal()] = value;
}
public V009Tyte getTytePart(T04PartQuad part) {
return getValue(part.splitPartBinary(T02PartBinary.PART_1))
.getValue(part.splitPartBinary(T02PartBinary.PART_2));
}
public void setTytePart(T04PartQuad part, V009Tyte value) {
getValue(part.splitPartBinary(T02PartBinary.PART_1))
.setValue(part.splitPartBinary(T02PartBinary.PART_2), value);
}
@Override
public V036Teger toClone() {
return new V036Teger(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));
}
}

View file

@ -0,0 +1,46 @@
package love.distributedrebirth.demo4d.base2t;
public final class V072Tong implements BaseNumberTyte<V072Tong> {
private V036Teger[] values = new V036Teger[T02PartBinary.LENGTH];
public V072Tong() {
this(new V036Teger(), new V036Teger());
}
public V072Tong(T08PartOctalIterator values) {
this(new V036Teger(values), new V036Teger(values));
}
public V072Tong(V009TyteIterator values) {
this(new V036Teger(values), new V036Teger(values));
}
public V072Tong(V036Teger valueHigh, V036Teger valueLow) {
setValue(T02PartBinary.PART_1, valueHigh);
setValue(T02PartBinary.PART_2, valueLow);
}
public V036Teger getValue(T02PartBinary part) {
return values[part.ordinal()];
}
public void setValue(T02PartBinary part, V036Teger value) {
values[part.ordinal()] = value;
}
@Override
public V072Tong toClone() {
return new V072Tong(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));
}
}

View file

@ -0,0 +1,72 @@
package love.distributedrebirth.demo4d.base2t;
public final class V144Tocta implements BaseNumberTyte<V144Tocta> {
private V072Tong[] values = new V072Tong[T02PartBinary.LENGTH];
public V144Tocta() {
this(new V072Tong(), new V072Tong());
}
public V144Tocta(T08PartOctalIterator values) {
this(new V072Tong(values), new V072Tong(values));
}
public V144Tocta(V009TyteIterator values) {
this(new V072Tong(values), new V072Tong(values));
}
public V144Tocta(V072Tong valueHigh, V072Tong valueLow) {
setValue(T02PartBinary.PART_1, valueHigh);
setValue(T02PartBinary.PART_2, valueLow);
}
public V072Tong getValue(T02PartBinary part) {
return values[part.ordinal()];
}
public void setValue(T02PartBinary part, V072Tong value) {
values[part.ordinal()] = value;
}
public V009Tyte getTytePart(T16PartHex part) {
return getValue(part.splitPartBinary(T04PartQuad.PART_1))
.getValue(part.splitPartBinary(T04PartQuad.PART_2))
.getValue(part.splitPartBinary(T04PartQuad.PART_3))
.getValue(part.splitPartBinary(T04PartQuad.PART_4));
}
public void setTytePart(T16PartHex part, V009Tyte value) {
getValue(part.splitPartBinary(T04PartQuad.PART_1))
.getValue(part.splitPartBinary(T04PartQuad.PART_2))
.getValue(part.splitPartBinary(T04PartQuad.PART_3))
.setValue(part.splitPartBinary(T04PartQuad.PART_4), value);
}
public V018Tord getTordPart(T08PartOctal part) {
return getValue(part.splitPartBinary(T03PartTrit.PART_1))
.getValue(part.splitPartBinary(T03PartTrit.PART_2))
.getValue(part.splitPartBinary(T03PartTrit.PART_3));
}
public void setTordPart(T08PartOctal part, V018Tord value) {
getValue(part.splitPartBinary(T03PartTrit.PART_1))
.getValue(part.splitPartBinary(T03PartTrit.PART_2))
.setValue(part.splitPartBinary(T03PartTrit.PART_3), value);
}
@Override
public V144Tocta toClone() {
return new V144Tocta(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));
}
}