FC18: Fixed NCR argument order

This commit is contained in:
Willem Cazander 2025-08-24 20:19:27 +02:00
parent 4c7355b65d
commit 355ac835be
5 changed files with 15 additions and 15 deletions

View file

@ -237,7 +237,7 @@ public class FourCornerUnicodeDisplay {
} }
@Override @Override
public void strobeNCR1632(BigInteger denominator, BigInteger numerator) { public void strobeNCR1632(BigInteger numerator, BigInteger denominator) {
List<Integer> math = new ArrayList<>(); List<Integer> math = new ArrayList<>();
FourCornerRecipe.toScriptSuperX18(math, numerator); FourCornerRecipe.toScriptSuperX18(math, numerator);
math.add(FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.ordinal()); math.add(FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.ordinal());

View file

@ -44,7 +44,7 @@ public interface FourCornerZion7Candlelier extends FourCornerZion7AlphaOmega {
//void strobeWordDozeger(BigInteger value); // up to 192 bit integer //void strobeWordDozeger(BigInteger value); // up to 192 bit integer
/// 1152 bit fractions of two 576 bit numbers. /// 1152 bit fractions of two 576 bit numbers.
void strobeNCR1632(BigInteger denominator, BigInteger numerator); void strobeNCR1632(BigInteger numerator, BigInteger denominator);
/// Octal sand walker, with an 72 to 576 bit mime-type rhythm header. /// Octal sand walker, with an 72 to 576 bit mime-type rhythm header.
void strobeSandWalker(List<PrimordialOctal> rhythm); void strobeSandWalker(List<PrimordialOctal> rhythm);
@ -66,7 +66,7 @@ public interface FourCornerZion7Candlelier extends FourCornerZion7AlphaOmega {
} }
@Override @Override
default void strobeNCR1632(BigInteger denominator, BigInteger numerator) { default void strobeNCR1632(BigInteger numerator, BigInteger denominator) {
} }
@Override @Override

View file

@ -85,7 +85,7 @@ public class FourCornerZionStenoGrapher {
} }
@Override @Override
public void strobeNCR1632(BigInteger denominator, BigInteger numerator) { public void strobeNCR1632(BigInteger numerator, BigInteger denominator) {
if (denominator.equals(BigInteger.ZERO)) { if (denominator.equals(BigInteger.ZERO)) {
throw new IllegalArgumentException("The denominator value ZERO is not allowed."); throw new IllegalArgumentException("The denominator value ZERO is not allowed.");
} }

View file

@ -198,7 +198,7 @@ public class FourCornerZionStenoLexer {
for (int i = 0; i < numeratorBank.length; i++) { for (int i = 0; i < numeratorBank.length; i++) {
numerator = numerator.add(BigInteger.valueOf(numeratorBank[i]).shiftLeft(i * 9)); numerator = numerator.add(BigInteger.valueOf(numeratorBank[i]).shiftLeft(i * 9));
} }
handler.strobeNCR1632(denominator, numerator); handler.strobeNCR1632(numerator, denominator);
// reset the bank after each fire // reset the bank after each fire
for (int i = 0; i < denominatorBank.length; i++) { for (int i = 0; i < denominatorBank.length; i++) {
denominatorBank[i] = 0; denominatorBank[i] = 0;

View file

@ -62,11 +62,11 @@ public class StenoGrapherTest {
FourCornerZion7Candlelier writerX06 = FourCornerZionStenoGrapher.writerX06(outX06); FourCornerZion7Candlelier writerX06 = FourCornerZionStenoGrapher.writerX06(outX06);
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18); FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
BigInteger v1 = BigInteger.valueOf(123); BigInteger v1 = BigInteger.valueOf(123);
writerX06.strobeNCR1632(v1, BigInteger.ONE); writerX06.strobeNCR1632(BigInteger.ONE, v1);
writerX18.strobeNCR1632(v1, BigInteger.ONE); writerX18.strobeNCR1632(BigInteger.ONE, v1);
BigInteger v2 = BigInteger.valueOf(12345); BigInteger v2 = BigInteger.valueOf(12345);
writerX06.strobeNCR1632(v2, BigInteger.ONE); writerX06.strobeNCR1632(BigInteger.ONE, v2);
writerX18.strobeNCR1632(v2, BigInteger.ONE); writerX18.strobeNCR1632(BigInteger.ONE, v2);
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(outX06); String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(outX06);
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18); String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
Assertions.assertEquals(resX18, resX06); Assertions.assertEquals(resX18, resX06);
@ -81,8 +81,8 @@ public class StenoGrapherTest {
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18); FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
for (int x = 1; x <= 1025; x++) { for (int x = 1; x <= 1025; x++) {
BigInteger v = BigInteger.valueOf(x); BigInteger v = BigInteger.valueOf(x);
writerX06.strobeNCR1632(v, BigInteger.ONE); writerX06.strobeNCR1632(BigInteger.ONE, v);
writerX18.strobeNCR1632(v, BigInteger.ONE); writerX18.strobeNCR1632(BigInteger.ONE, v);
} }
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(outX06); String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(outX06);
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18); String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
@ -104,17 +104,17 @@ public class StenoGrapherTest {
BigInteger maxValue = new BigInteger("FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16); BigInteger maxValue = new BigInteger("FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
writerX06.strobeNCR1632(maxValue, maxValue); writerX06.strobeNCR1632(maxValue, maxValue);
Assertions.assertThrows(IllegalArgumentException.class, () -> { Assertions.assertThrows(IllegalArgumentException.class, () -> {
writerX06.strobeNCR1632(maxValue.add(BigInteger.ONE), maxValue); writerX06.strobeNCR1632(maxValue, maxValue.add(BigInteger.ONE));
}); });
Assertions.assertThrows(IllegalArgumentException.class, () -> { Assertions.assertThrows(IllegalArgumentException.class, () -> {
writerX06.strobeNCR1632(maxValue, maxValue.add(BigInteger.ONE)); writerX06.strobeNCR1632(maxValue.add(BigInteger.ONE), maxValue);
}); });
writerX18.strobeNCR1632(maxValue, maxValue); writerX18.strobeNCR1632(maxValue, maxValue);
Assertions.assertThrows(IllegalArgumentException.class, () -> { Assertions.assertThrows(IllegalArgumentException.class, () -> {
writerX18.strobeNCR1632(maxValue.add(BigInteger.ONE), maxValue); writerX18.strobeNCR1632(maxValue, maxValue.add(BigInteger.ONE));
}); });
Assertions.assertThrows(IllegalArgumentException.class, () -> { Assertions.assertThrows(IllegalArgumentException.class, () -> {
writerX18.strobeNCR1632(maxValue, maxValue.add(BigInteger.ONE)); writerX18.strobeNCR1632(maxValue.add(BigInteger.ONE), maxValue);
}); });
} }
} }