JPP: Added abacus operation and water clock piping infrastructure
This commit is contained in:
parent
cff00daa3e
commit
5fcb5289c8
6 changed files with 341 additions and 23 deletions
|
|
@ -27,48 +27,40 @@
|
|||
|
||||
package ᒢᐩᐩ.ᣕᓑᔿᒃᓫᣗ.ᙆᓫᣗᒄᑊᣕᣔᒻ.ᣔᒃᣔᒼᓑᔆ;
|
||||
|
||||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᒢℭỗᶇṧⱦᶏꬼȶʂ;
|
||||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||||
import ᒢᐩᐩ.ᣕᓑᔿᒃᓫᣗ.ᙆᓫᣗᒄᑊᣕᣔᒻ.PrimordialZerdinalSpaceMaterializer;
|
||||
|
||||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
public interface ZerdinalAḃåčȕs̈Rȧñk<T extends ZerdinalAḃåčȕs̈Rȧñk<T>> extends PrimordialZerdinalSpaceMaterializer<T> {
|
||||
|
||||
// TODO: add operators
|
||||
|
||||
String abacusRȧñkName();
|
||||
|
||||
// TODO: replace with nether phone book entry class type + add new mat... method
|
||||
String abacusRȧñkRingTone();
|
||||
|
||||
default ZerdinalAḃåčȕs̈RȧñkOperationPipe abacusOperation(ZerdinalAḃåčȕs̈RȧñkOperation op, int zerdinal) {
|
||||
return abacusOperation(op, zerdinal, false);
|
||||
}
|
||||
|
||||
default ZerdinalAḃåčȕs̈RȧñkOperationPipe abacusOperation(ZerdinalAḃåčȕs̈RȧñkOperation op, int zerdinal, boolean carry) {
|
||||
return op.automata(new ZerdinalAḃåčȕs̈RȧñkWaterClock(carry, zerdinal(), zerdinal, zerdinalSpaceBoundary()));
|
||||
}
|
||||
|
||||
default T abacusRȧñkGotoFirst() {
|
||||
return zerdinalMaterializeSpace(ᒢℭỗᶇṧⱦᶏꬼȶʂ.INTᣟᐧᣟZERO);
|
||||
return abacusOperation(ZerdinalAḃåčȕs̈RȧñkWaterWorks.GOTO_FIRST, zerdinal()).materializeOutput(zerdinalMaterializeSpace(zerdinal()));
|
||||
}
|
||||
|
||||
default T abacusRȧñkGotoLast() {
|
||||
return zerdinalMaterializeSpace(zerdinalSpaceBoundary() - ᒢℭỗᶇṧⱦᶏꬼȶʂ.INTᣟᐧᣟONE);
|
||||
return abacusOperation(ZerdinalAḃåčȕs̈RȧñkWaterWorks.GOTO_LAST, zerdinal()).materializeOutput(zerdinalMaterializeSpace(zerdinal()));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
default T abacusRȧñkGotoUp(boolean loop) {
|
||||
int resultIndex = zerdinal() + ᒢℭỗᶇṧⱦᶏꬼȶʂ.INTᣟᐧᣟONE;
|
||||
if (resultIndex >= zerdinalSpaceBoundary()) {
|
||||
if (loop) {
|
||||
resultIndex = ᒢℭỗᶇṧⱦᶏꬼȶʂ.INTᣟᐧᣟZERO;
|
||||
} else {
|
||||
resultIndex = zerdinal();
|
||||
}
|
||||
}
|
||||
return zerdinalMaterializeSpace(resultIndex);
|
||||
return abacusOperation(ZerdinalAḃåčȕs̈RȧñkWaterWorks.PLUS, 1, loop).materializeOutput(zerdinalMaterializeSpace(zerdinal()));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
default T abacusRȧñkGotoDown(boolean loop) {
|
||||
int resultIndex = zerdinal() - ᒢℭỗᶇṧⱦᶏꬼȶʂ.INTᣟᐧᣟONE;
|
||||
if (resultIndex < ᒢℭỗᶇṧⱦᶏꬼȶʂ.INTᣟᐧᣟZERO) {
|
||||
if (loop) {
|
||||
resultIndex = zerdinalSpaceBoundary() - ᒢℭỗᶇṧⱦᶏꬼȶʂ.INTᣟᐧᣟONE;
|
||||
} else {
|
||||
resultIndex = zerdinal();
|
||||
}
|
||||
}
|
||||
return zerdinalMaterializeSpace(resultIndex);
|
||||
return abacusOperation(ZerdinalAḃåčȕs̈RȧñkWaterWorks.MINUS, 1, loop).materializeOutput(zerdinalMaterializeSpace(zerdinal()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package ᒢᐩᐩ.ᣕᓑᔿᒃᓫᣗ.ᙆᓫᣗᒄᑊᣕᣔᒻ.ᣔᒃᣔᒼᓑᔆ;
|
||||
|
||||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||||
|
||||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
@FunctionalInterface
|
||||
public interface ZerdinalAḃåčȕs̈RȧñkOperation {
|
||||
|
||||
/// Performs one automation step calculation.
|
||||
/// @param pipe The water pipe for step flow.
|
||||
ZerdinalAḃåčȕs̈RȧñkOperationPipe automata(ZerdinalAḃåčȕs̈RȧñkOperationPipeWater pipe);
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package ᒢᐩᐩ.ᣕᓑᔿᒃᓫᣗ.ᙆᓫᣗᒄᑊᣕᣔᒻ.ᣔᒃᣔᒼᓑᔆ;
|
||||
|
||||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᐪᓫᣗᔿᑊᣕᣔᐪᐤᣗ.T002ᖟ;
|
||||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||||
|
||||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
public interface ZerdinalAḃåčȕs̈RȧñkOperationPipe {
|
||||
|
||||
/// Materialize the current step output as a abacus space rank.
|
||||
<T extends ZerdinalAḃåčȕs̈Rȧñk<T>> T materializeOutput(T rank);
|
||||
|
||||
/// Materialize the current step output carry bit.
|
||||
T002ᖟ materializeOutputCarry();
|
||||
|
||||
/// Chain multiple automation steps.
|
||||
/// @param op The operation to perform.
|
||||
/// @param zerdinal The zerdinal value to give to the operation.
|
||||
ZerdinalAḃåčȕs̈RȧñkOperationPipe automaton(ZerdinalAḃåčȕs̈RȧñkOperation op, int zerdinal);
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package ᒢᐩᐩ.ᣕᓑᔿᒃᓫᣗ.ᙆᓫᣗᒄᑊᣕᣔᒻ.ᣔᒃᣔᒼᓑᔆ;
|
||||
|
||||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||||
|
||||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
public interface ZerdinalAḃåčȕs̈RȧñkOperationPipeWater extends ZerdinalAḃåčȕs̈RȧñkOperationPipe {
|
||||
|
||||
boolean inputCarry();
|
||||
|
||||
int input1();
|
||||
|
||||
int input2();
|
||||
|
||||
ZerdinalAḃåčȕs̈RȧñkOperationPipeWater outputPipe(int output);
|
||||
|
||||
void output(int output);
|
||||
|
||||
void outputCarry(boolean outputCarry);
|
||||
|
||||
int outputBoundry();
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package ᒢᐩᐩ.ᣕᓑᔿᒃᓫᣗ.ᙆᓫᣗᒄᑊᣕᣔᒻ.ᣔᒃᣔᒼᓑᔆ;
|
||||
|
||||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᐪᓫᣗᔿᑊᣕᣔᐪᐤᣗ.T002ᖟ;
|
||||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||||
|
||||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
public final class ZerdinalAḃåčȕs̈RȧñkWaterClock implements ZerdinalAḃåčȕs̈RȧñkOperationPipeWater {
|
||||
private boolean inputCarry;
|
||||
private int input1;
|
||||
private int input2;
|
||||
private int output;
|
||||
private boolean outputCarry;
|
||||
private final int ouputBoundry;
|
||||
|
||||
protected ZerdinalAḃåčȕs̈RȧñkWaterClock(boolean inputCarry, int input1, int input2, int ouputBoundry) {
|
||||
this.inputCarry = inputCarry;
|
||||
this.input1 = input1;
|
||||
this.input2 = input2;
|
||||
this.ouputBoundry = ouputBoundry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends ZerdinalAḃåčȕs̈Rȧñk<T>> T materializeOutput(T rank) {
|
||||
if (outputBoundry() != rank.zerdinalSpaceBoundary()) {
|
||||
throw new IllegalArgumentException("Wrong rank type of given water pipe size: " + outputBoundry());
|
||||
}
|
||||
return rank.zerdinalMaterializeSpace(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T002ᖟ materializeOutputCarry() {
|
||||
return T002ᖟ.valueOf(outputCarry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZerdinalAḃåčȕs̈RȧñkOperationPipe automaton(ZerdinalAḃåčȕs̈RȧñkOperation op, int zerdinal) {
|
||||
inputCarry = outputCarry;
|
||||
input1 = output;
|
||||
input2 = zerdinal;
|
||||
return op.automata(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inputCarry() {
|
||||
return inputCarry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int input1() {
|
||||
return input1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int input2() {
|
||||
return input2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZerdinalAḃåčȕs̈RȧñkOperationPipeWater outputPipe(int output) {
|
||||
output(output);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void output(int output) {
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void outputCarry(boolean outputCarry) {
|
||||
this.outputCarry = outputCarry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int outputBoundry() {
|
||||
return ouputBoundry;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package ᒢᐩᐩ.ᣕᓑᔿᒃᓫᣗ.ᙆᓫᣗᒄᑊᣕᣔᒻ.ᣔᒃᣔᒼᓑᔆ;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᒢℭỗᶇṧⱦᶏꬼȶʂ;
|
||||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||||
|
||||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
public enum ZerdinalAḃåčȕs̈RȧñkWaterWorks implements ZerdinalAḃåčȕs̈RȧñkOperation {
|
||||
|
||||
GOTO_FIRST(pipe -> pipe.outputPipe(ᒢℭỗᶇṧⱦᶏꬼȶʂ.INTᣟᐧᣟZERO)),
|
||||
GOTO_LAST(pipe -> pipe.outputPipe(pipe.outputBoundry() - ᒢℭỗᶇṧⱦᶏꬼȶʂ.INTᣟᐧᣟONE)),
|
||||
PLUS(pipe -> {
|
||||
int result = pipe.input1() + pipe.input2();
|
||||
if (result >= pipe.outputBoundry()) {
|
||||
if (pipe.inputCarry()) {
|
||||
result = ᒢℭỗᶇṧⱦᶏꬼȶʂ.INTᣟᐧᣟZERO;
|
||||
} else {
|
||||
result = pipe.outputBoundry() - ᒢℭỗᶇṧⱦᶏꬼȶʂ.INTᣟᐧᣟONE;
|
||||
}
|
||||
pipe.outputCarry(true);
|
||||
}
|
||||
return pipe.outputPipe(result);
|
||||
}),
|
||||
MINUS(pipe -> {
|
||||
int result = pipe.input1() - pipe.input2();
|
||||
if (result < ᒢℭỗᶇṧⱦᶏꬼȶʂ.INTᣟᐧᣟZERO) {
|
||||
if (pipe.inputCarry()) {
|
||||
result = pipe.outputBoundry() - ᒢℭỗᶇṧⱦᶏꬼȶʂ.INTᣟᐧᣟONE;
|
||||
} else {
|
||||
result = ᒢℭỗᶇṧⱦᶏꬼȶʂ.INTᣟᐧᣟZERO;
|
||||
}
|
||||
pipe.outputCarry(true);
|
||||
}
|
||||
return pipe.outputPipe(result);
|
||||
}),
|
||||
BIT_AND(pipe -> pipe.outputPipe(pipe.input1() & pipe.input2())),
|
||||
BIT_OR(pipe -> pipe.outputPipe(pipe.input1() | pipe.input2())),
|
||||
SHIFT_LEFT(pipe -> {
|
||||
//TODO: add carry input and output
|
||||
pipe.output(pipe.input1() << pipe.input2());
|
||||
return pipe;
|
||||
}),
|
||||
SHIFT_RIGHT(pipe -> {
|
||||
pipe.outputCarry((pipe.input1() & 1) == 1);// first or last ?
|
||||
// TODO: add inputCarry
|
||||
pipe.output(pipe.input1() >> pipe.input2());
|
||||
return pipe;
|
||||
}),
|
||||
;
|
||||
private final ZerdinalAḃåčȕs̈RȧñkOperation op;
|
||||
|
||||
private ZerdinalAḃåčȕs̈RȧñkWaterWorks(ZerdinalAḃåčȕs̈RȧñkOperation op) {
|
||||
this.op = Objects.requireNonNull(op);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZerdinalAḃåčȕs̈RȧñkOperationPipe automata(ZerdinalAḃåčȕs̈RȧñkOperationPipeWater pipe) {
|
||||
return op.automata(pipe);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue