From bde611e456db1089c6f1f3bceef800a713003af4 Mon Sep 17 00:00:00 2001 From: Willem Date: Fri, 4 Feb 2022 22:44:11 +0100 Subject: [PATCH] POC alu code --- .../numberxd/BaseGetậl.java | 5 +- .../numberxd/GroßGetậl1ⁿᴰ.java | 9 +++- .../numberxd/GroßGetậl6ˢᴰ.java | 9 +++- .../numberxd/GroßGetậlŌṁDiamond1ⁿᴰ.java | 9 +++- .../numberxd/GroßGetậlŌṁDiamond6ˢᴰ.java | 9 +++- .../numberxd/GroßGetậlŌṁHyperStàr1ⁿᴰ.java | 9 +++- .../numberxd/GroßGetậlŌṁHyperStàr6ˢᴰ.java | 11 +++-- .../numberxd/Gê̄ldGetậl.java | 14 +++++- .../numberxd/KlompGetậl4ˢᴰ.java | 9 +++- .../numberxd/KlompÅtŌṁKāassGetậl4ˢᴰ.java | 11 +++-- .../numberxd/WaveGetậl1ᑫᴰ.java | 9 +++- .../numberxd/WaveGetậl1ⁿᴰ.java | 9 +++- .../numberxd/alu/ŌctopǔsALU.java | 46 +++++++++++++++++++ 13 files changed, 134 insertions(+), 25 deletions(-) diff --git a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/BaseGetậl.java b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/BaseGetậl.java index 6eb4cbf9..bf221184 100644 --- a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/BaseGetậl.java +++ b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/BaseGetậl.java @@ -1,6 +1,7 @@ package love.distributedrebirth.numberxd; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; +import love.distributedrebirth.numberxd.base2t.BaseIteratorOctal; import love.distributedrebirth.numberxd.base2t.BaseNumber; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") @@ -8,5 +9,7 @@ public interface BaseGetậl,V extends BaseNumber> V getValue(); - T toClone(); + T toClone(BaseIteratorOctal values); + + BaseIteratorOctal iteratorOctalsByClone(); } diff --git a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/GroßGetậl1ⁿᴰ.java b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/GroßGetậl1ⁿᴰ.java index b6e046b7..8ce7a245 100644 --- a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/GroßGetậl1ⁿᴰ.java +++ b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/GroßGetậl1ⁿᴰ.java @@ -47,7 +47,12 @@ public class GroßGetậl1ⁿᴰ extends AbstractBaseGetậlMatrix1,V extends BaseNumber> BaseGetậl math(BaseGetậl opA, BaseGetậl opB) { + BaseIteratorOctal bioA = opA.iteratorOctalsByClone(); + BaseIteratorOctal bioB = opB.iteratorOctalsByClone(); + BaseIteratorOctalALU bioALU = new BaseIteratorOctalALU(bioA, bioB); + BaseGetậl result = opA.toClone(bioALU); + return result; + } + + class BaseIteratorOctalALU implements BaseIteratorOctal { + + private final BaseIteratorOctal bioA; + private final BaseIteratorOctal bioB; + + public BaseIteratorOctalALU(BaseIteratorOctal bioA, BaseIteratorOctal bioB) { + this.bioA = bioA; + this.bioB = bioB; + } + + @Override + public boolean hasNext() { + return bioA.hasNext(); + } + + @Override + public T08PartOctal next() { + T08PartOctal valA = bioA.next(); + T08PartOctal valB = bioB.next(); + + int valANum = valA.BȍőnRangTelNul(); + int valBNum = valB.BȍőnRangTelNul(); + + var valResultNum = valANum + valBNum; + + if (valResultNum > valA.BãßInstances().length) { + valResultNum = valA.BãßInstances().length -1; + } + + T08PartOctal valResult = T08PartOctal.values()[valResultNum]; + + return valResult; + } + } }