Toegevoegt klompen en kaas getallen.

This commit is contained in:
Willem Cazander 2022-01-30 19:04:03 +01:00
parent 9e806b7669
commit e3e5c2fb15
6 changed files with 342 additions and 18 deletions

View file

@ -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<KaassGetậl> {
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<getKaasCuts();i++) {
result.setValue(i, new KlompGetậl(clonedOctals));
}
return result;
}
@Override
public final int getBitCount() {
return KlompGetậl.BIT_COUNT * kaasCuts;
}
@Override
public final void fillOctalValues(T08PartOctalBaseAppender appender) {
for (KlompGetậl value:kaas) {
value.fillOctalValues(appender);
}
}
@Override
public void fillTyteValues(V009TyteBaseAppender appender) {
for (KlompGetậl value:kaas) {
value.fillTyteValues(appender);
}
}
}

View file

@ -1,7 +1,64 @@
package love.distributedrebirth.demo4d.fraction4d;
public class KlompGetậl {
import love.distributedrebirth.demo4d.base2t.BaseNumberTyte;
import love.distributedrebirth.demo4d.base2t.T08PartOctal;
import love.distributedrebirth.demo4d.base2t.T08PartOctalBaseAppender;
import love.distributedrebirth.demo4d.base2t.T08PartOctalBaseIterator;
import love.distributedrebirth.demo4d.base2t.V009TyteBaseAppender;
import love.distributedrebirth.demo4d.base2t.V654Triz;
import love.distributedrebirth.demo4d.base2t.VCA8Tath;
// 4 * V654Tath red
// 4 * V654Tath blue
/**
* Holds an 25920 bit value. (3240 bytes)
*
* 4 * VCA8Tath red
* 4 * VCA8Tath blue
*
* @author willemtsade ©Δ 仙上主天
*
*/
public class KlompGetậl implements BaseNumberTyte<KlompGetậl> {
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<T08PartOctal.LENGTH;i++) {
this.values[i] = new VCA8Tath();
}
}
public KlompGetậl(T08PartOctalBaseIterator values) {
for (int i=0;i<T08PartOctal.LENGTH;i++) {
this.values[i] = new VCA8Tath(values);
}
}
public VCA8Tath getValue(T08PartOctal part) {
return values[part.ordinal()];
}
public void setValue(T08PartOctal part, VCA8Tath value) {
values[part.ordinal()] = value;
}
@Override
public int getBitCount() {
return BIT_COUNT;
}
@Override
public KlompGetậl toClone() {
return new KlompGetậl(cloneIterator());
}
@Override
public void fillOctalValues(T08PartOctalBaseAppender appender) {
T08PartOctal.forEach(v -> getValue(v).fillOctalValues(appender));
}
@Override
public void fillTyteValues(V009TyteBaseAppender appender) {
T08PartOctal.forEach(v -> getValue(v).fillTyteValues(appender));
}
}