Compare commits
No commits in common. "53a162d23261e99b0ce4e8961d504805ca9a450a" and "6c0ee56272a2ceaa082ce03e9dc2c2c53943e824" have entirely different histories.
53a162d232
...
6c0ee56272
12 changed files with 460 additions and 431 deletions
|
|
@ -24,13 +24,22 @@ package org.x4o.fc18;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.PrimitiveIterator;
|
import java.util.PrimitiveIterator;
|
||||||
|
|
||||||
|
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||||
|
import org.x4o.fc18.cake2.FourCornerX00PetitVide;
|
||||||
|
import org.x4o.fc18.cake2.FourCornerX06BaklavaPointSequence;
|
||||||
|
import org.x4o.fc18.cake2.FourCornerX18CakePointSequence;
|
||||||
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash10;
|
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash10;
|
||||||
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash11;
|
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash11;
|
||||||
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash20;
|
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash20;
|
||||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||||
|
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||||
|
import org.x4o.fc18.octal8.PrimordialOctal;
|
||||||
|
import org.x4o.fc18.zion7.FourCornerZion7SalahSequence;
|
||||||
|
|
||||||
/// Holds different lookup and conversion maps towards four corner int18 cake points.
|
/// Holds different lookup and conversion maps towards four corner int18 cake points.
|
||||||
///
|
///
|
||||||
|
|
@ -38,9 +47,266 @@ import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||||
/// @version 1.0 Jan 09, 2025
|
/// @version 1.0 Jan 09, 2025
|
||||||
final public class FourCornerRecipe {
|
final public class FourCornerRecipe {
|
||||||
|
|
||||||
|
public static final BigInteger NCR1632_MASK_PAGE = BigInteger.valueOf(0x1FF);
|
||||||
|
public static final BigInteger NCR1632_VALUE_MAX = new BigInteger("FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
|
||||||
|
public static final List<Integer> SAND_WORM_SIGN = List.of(24,48,72,96,120,144,168,192);
|
||||||
|
|
||||||
private FourCornerRecipe() {
|
private FourCornerRecipe() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public List<Integer> embedSalahSequenceX06(FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||||
|
return embedSalahSequence(new ArrayList<>(), type, arguments, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public List<Integer> embedSalahSequenceX18(FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||||
|
return embedSalahSequence(new ArrayList<>(), type, arguments, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public List<Integer> embedSalahSequenceX06(List<Integer> out, FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||||
|
return embedSalahSequence(out, type, arguments, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public List<Integer> embedSalahSequenceX18(List<Integer> out, FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||||
|
return embedSalahSequence(out, type, arguments, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static private List<Integer> embedSalahSequence(List<Integer> out, FourCornerZion7SalahSequence type, List<List<Integer>> arguments, boolean isSixBit) {
|
||||||
|
Objects.requireNonNull(type);
|
||||||
|
Objects.requireNonNull(arguments);
|
||||||
|
if (FourCornerZion7SalahSequence.ESC_VT06.equals(type)) {
|
||||||
|
if (isSixBit) {
|
||||||
|
out.addAll(FCDotDEC2701DashPX0.ESC_VT06.baklavaPointSequence());
|
||||||
|
} else {
|
||||||
|
out.addAll(FCDotDEC2701DashPX0.ESC_VT06.cakePointSequence());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isSixBit) {
|
||||||
|
out.addAll(FCDotDEC2701DashPX0.valueOf(type.ordinal()).baklavaPointSequence());
|
||||||
|
} else {
|
||||||
|
out.addAll(FCDotDEC2701DashPX0.valueOf(type.ordinal()).cakePointSequence());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Iterator<List<Integer>> argu = arguments.iterator();
|
||||||
|
while (argu.hasNext()) {
|
||||||
|
List<Integer> arguValue = argu.next();
|
||||||
|
out.addAll(arguValue); // TODO: add range check
|
||||||
|
if (argu.hasNext()) {
|
||||||
|
out.add(FCDotCDC1604DashP6._RAKA_QUESTION.baklavaPointDotIndex());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.baklavaPointDotIndex());
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public List<Integer> embedSandWalker(List<PrimordialOctal> rhythm) {
|
||||||
|
return embedSandWalker(new ArrayList<>(), rhythm);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public List<Integer> embedSandWalker(List<Integer> out, List<PrimordialOctal> rhythm) {
|
||||||
|
Objects.requireNonNull(rhythm);
|
||||||
|
if (!FourCornerRecipe.SAND_WORM_SIGN.contains(rhythm.size())) {
|
||||||
|
throw new IllegalArgumentException("Sand walker rhythm is not 72 bit aligned: " + rhythm.size());
|
||||||
|
}
|
||||||
|
out.add(FCDotDEC2701DashPX0.ESC_SAND_WALKER.cakePointDotIndex());
|
||||||
|
for (int i = 192 - 1; i >= 0; i--) {
|
||||||
|
if (rhythm.size() <= i) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
PrimordialOctal octal = rhythm.get(i);
|
||||||
|
out.add(FCDotCDC1604DashP6.NX01_A.cakePointDotIndex() + octal.ordinal());
|
||||||
|
}
|
||||||
|
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public List<Integer> embedSandWormX06(List<PrimordialOctal> spice) {
|
||||||
|
return embedSandWormX06(new ArrayList<>(), spice);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public List<Integer> embedSandWormX06(List<Integer> out, List<PrimordialOctal> spice) {
|
||||||
|
Objects.requireNonNull(spice);
|
||||||
|
out.add(FCDotDEC2701DashPX0.ESC68_SAND_WORM.cakePointDotIndex());
|
||||||
|
for (int i = spice.size(); i >= 0; i--) {
|
||||||
|
PrimordialOctal octal = spice.get(i);
|
||||||
|
out.add(FCDotCDC1604DashP6.NX01_A.cakePointDotIndex() + octal.ordinal());
|
||||||
|
}
|
||||||
|
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public List<Integer> embedSandWormX18(List<PrimordialOctal> spice) {
|
||||||
|
return embedSandWormX18(new ArrayList<>(), spice);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public List<Integer> embedSandWormX18(List<Integer> out, List<PrimordialOctal> spice) {
|
||||||
|
Objects.requireNonNull(spice);
|
||||||
|
Iterator<PrimordialOctal> spiceItr = spice.iterator();
|
||||||
|
while (spiceItr.hasNext()) {
|
||||||
|
PrimordialOctal octal4 = spiceItr.next();
|
||||||
|
PrimordialOctal octal3 = spiceItr.next();
|
||||||
|
PrimordialOctal octal2 = spiceItr.next();
|
||||||
|
PrimordialOctal octal1 = spiceItr.next();
|
||||||
|
PrimordialOctal octal0 = spiceItr.next();
|
||||||
|
int bitValue15 = 0;
|
||||||
|
bitValue15 += (octal4.ordinal() << 12);
|
||||||
|
bitValue15 += (octal3.ordinal() << 9);
|
||||||
|
bitValue15 += (octal2.ordinal() << 6);
|
||||||
|
bitValue15 += (octal1.ordinal() << 3);
|
||||||
|
bitValue15 += (octal0.ordinal() << 0);
|
||||||
|
out.add(FourCornerDotCake.FC_SANDWORM_15.getStart() + bitValue15);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public List<Integer> embedNCR1632FractionX06(BigInteger denominator, BigInteger numerator) {
|
||||||
|
return embedNCR1632FractionX18(new ArrayList<>(), denominator, numerator);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public List<Integer> embedNCR1632FractionX06(List<Integer> out, BigInteger denominator, BigInteger numerator) {
|
||||||
|
if (denominator.equals(BigInteger.ZERO)) {
|
||||||
|
throw new IllegalArgumentException("The denominator value ZERO is not allowed.");
|
||||||
|
}
|
||||||
|
if (numerator.equals(BigInteger.ZERO)) {
|
||||||
|
throw new IllegalArgumentException("The numerator value ZERO is not allowed.");
|
||||||
|
}
|
||||||
|
//if (denominator.signum() == -1) {
|
||||||
|
// // TODO: check if we need one octal for pos/neg/qNaN/sNaN/pos_inf/neg_inf/free/free options
|
||||||
|
//}
|
||||||
|
if (denominator.compareTo(NCR1632_VALUE_MAX) > 0) { // fixme: this is still one off...
|
||||||
|
throw new IllegalArgumentException("Value denominator is larger than 576 bit: " + denominator);
|
||||||
|
}
|
||||||
|
if (numerator.compareTo(NCR1632_VALUE_MAX) > 0) { // fixme: this is still one off...
|
||||||
|
throw new IllegalArgumentException("Value numerator is larger than 576 bit: " + numerator);
|
||||||
|
}
|
||||||
|
|
||||||
|
out.addAll(FCDotDEC2701DashPX0.ESC68_NCR.baklavaPointSequence());
|
||||||
|
// NX01-NX08 are octals
|
||||||
|
// DEN: NY01 = page MSB, NY02 = page LSB, NY03 = value MSB, NY04 = value CSB, NY05 = value LSB
|
||||||
|
// NUM: NY06 = page MSB, NY07 = page LSB, NY08 = value MSB, NY09 = value CSB, NY10 = value LSB
|
||||||
|
|
||||||
|
BigInteger denominatorZero = denominator.subtract(BigInteger.ONE);
|
||||||
|
BigInteger numeratorZero = numerator.subtract(BigInteger.ONE);
|
||||||
|
if (denominatorZero.equals(BigInteger.ZERO)) {
|
||||||
|
out.add(FCDotCDC1604DashP6.NY05_BAR_VERTICAL.baklavaPointDotIndex());
|
||||||
|
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex());
|
||||||
|
} else {
|
||||||
|
for (int i = 63; i >= 0; i--) {
|
||||||
|
int bankValue = denominatorZero.shiftRight(i * 9).and(NCR1632_MASK_PAGE).intValue();
|
||||||
|
if (bankValue == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int pageMSB = (i >> 3) & 0b111;
|
||||||
|
int pageLSB = (i >> 0) & 0b111;
|
||||||
|
int valueMSB = (bankValue >> 6) & 0b111;
|
||||||
|
int valueCSB = (bankValue >> 3) & 0b111;
|
||||||
|
int valueLSB = (bankValue >> 0) & 0b111;
|
||||||
|
if (pageMSB > 0) {
|
||||||
|
out.add(FCDotCDC1604DashP6.NY01_AT.baklavaPointDotIndex());
|
||||||
|
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageMSB);
|
||||||
|
}
|
||||||
|
if (pageLSB > 0) {
|
||||||
|
out.add(FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.baklavaPointDotIndex());
|
||||||
|
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageLSB);
|
||||||
|
}
|
||||||
|
if (valueMSB > 0) {
|
||||||
|
out.add(FCDotCDC1604DashP6.NY03_BAR_V_LEFT.baklavaPointDotIndex());
|
||||||
|
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueMSB);
|
||||||
|
}
|
||||||
|
if (valueCSB > 0) {
|
||||||
|
out.add(FCDotCDC1604DashP6.NY04_BAR_UNDER.baklavaPointDotIndex());
|
||||||
|
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueCSB);
|
||||||
|
}
|
||||||
|
out.add(FCDotCDC1604DashP6.NY05_BAR_VERTICAL.baklavaPointDotIndex());
|
||||||
|
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueLSB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (numeratorZero.equals(BigInteger.ZERO)) {
|
||||||
|
out.add(FCDotCDC1604DashP6.NY10_CARET.baklavaPointDotIndex());
|
||||||
|
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex());
|
||||||
|
} else {
|
||||||
|
for (int i = 63; i >= 0; i--) {
|
||||||
|
int bankValue = numeratorZero.shiftRight(i * 9).and(NCR1632_MASK_PAGE).intValue();
|
||||||
|
if (bankValue == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int pageMSB = (i >> 3) & 0b111;
|
||||||
|
int pageLSB = (i >> 0) & 0b111;
|
||||||
|
int valueMSB = (bankValue >> 6) & 0b111;
|
||||||
|
int valueCSB = (bankValue >> 3) & 0b111;
|
||||||
|
int valueLSB = (bankValue >> 0) & 0b111;
|
||||||
|
if (pageMSB > 0) {
|
||||||
|
out.add(FCDotCDC1604DashP6.NY06_PERCENT.baklavaPointDotIndex());
|
||||||
|
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageMSB);
|
||||||
|
}
|
||||||
|
if (pageLSB > 0) {
|
||||||
|
out.add(FCDotCDC1604DashP6.NY07_DOLLAR.baklavaPointDotIndex());
|
||||||
|
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageLSB);
|
||||||
|
}
|
||||||
|
if (valueMSB > 0) {
|
||||||
|
out.add(FCDotCDC1604DashP6.NY08_HASH.baklavaPointDotIndex());
|
||||||
|
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueMSB);
|
||||||
|
}
|
||||||
|
if (valueCSB > 0) {
|
||||||
|
out.add(FCDotCDC1604DashP6.NY09_EQUALS.baklavaPointDotIndex());
|
||||||
|
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueCSB);
|
||||||
|
}
|
||||||
|
out.add(FCDotCDC1604DashP6.NY10_CARET.baklavaPointDotIndex());
|
||||||
|
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueLSB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public List<Integer> embedNCR1632FractionX18(BigInteger denominator, BigInteger numerator) {
|
||||||
|
return embedNCR1632FractionX18(new ArrayList<>(), denominator, numerator);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public List<Integer> embedNCR1632FractionX18(List<Integer> out, BigInteger denominator, BigInteger numerator) {
|
||||||
|
if (denominator.equals(BigInteger.ZERO)) {
|
||||||
|
throw new IllegalArgumentException("The denominator value ZERO is not allowed.");
|
||||||
|
}
|
||||||
|
if (numerator.equals(BigInteger.ZERO)) {
|
||||||
|
throw new IllegalArgumentException("The numerator value ZERO is not allowed.");
|
||||||
|
}
|
||||||
|
//if (denominator.signum() == -1) {
|
||||||
|
// // TODO: check if we need one octal for pos/neg/qNaN/sNaN/pos_inf/neg_inf/free/free options
|
||||||
|
//}
|
||||||
|
if (denominator.compareTo(NCR1632_VALUE_MAX) > 0) { // fixme: this is still one off...
|
||||||
|
throw new IllegalArgumentException("Value denominator is larger than 576 bit: " + denominator);
|
||||||
|
}
|
||||||
|
if (numerator.compareTo(NCR1632_VALUE_MAX) > 0) { // fixme: this is still one off...
|
||||||
|
throw new IllegalArgumentException("Value numerator is larger than 576 bit: " + numerator);
|
||||||
|
}
|
||||||
|
BigInteger denominatorZero = denominator.subtract(BigInteger.ONE);
|
||||||
|
BigInteger numeratorZero = numerator.subtract(BigInteger.ONE);
|
||||||
|
if (denominatorZero.equals(BigInteger.ZERO)) {
|
||||||
|
out.add(FourCornerDotCake.FC_NCR1632_DEN.getStart());
|
||||||
|
} else {
|
||||||
|
for (int i = 63; i >= 0; i--) {
|
||||||
|
int bankValue = denominatorZero.shiftRight(i * 9).and(NCR1632_MASK_PAGE).intValue();
|
||||||
|
if (bankValue == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int cakePoint = FourCornerDotCake.FC_NCR1632_DEN.getStart() + bankValue + (i * 512);
|
||||||
|
out.add(cakePoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (numeratorZero.equals(BigInteger.ZERO)) {
|
||||||
|
out.add(FourCornerDotCake.FC_NCR1632_NUM.getStart());
|
||||||
|
} else {
|
||||||
|
for (int i = 63; i >= 0; i--) {
|
||||||
|
int bankValue = numeratorZero.shiftRight(i * 9).and(NCR1632_MASK_PAGE).intValue();
|
||||||
|
if (bankValue == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int cakePoint = FourCornerDotCake.FC_NCR1632_NUM.getStart() + bankValue + (i * 512);
|
||||||
|
out.add(cakePoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
static public List<Integer> toScriptSuperX06(int value) {
|
static public List<Integer> toScriptSuperX06(int value) {
|
||||||
return toScript(new ArrayList<>(), Integer.toString(value), 0, true);
|
return toScript(new ArrayList<>(), Integer.toString(value), 0, true);
|
||||||
}
|
}
|
||||||
|
|
@ -176,10 +442,9 @@ final public class FourCornerRecipe {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// fixme
|
if (isSixBit) {
|
||||||
//if (isSixBit) {
|
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex()); // fixme improve: see FourCornerDotCollePie9.baklavaPointsPIE9C
|
||||||
// out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex()); // fixme improve: see FourCornerDotCollePie9.baklavaPointsPIE9C
|
}
|
||||||
//}
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ public class FourCornerUnicodeDisplay {
|
||||||
lexer.withSmokeSignals(printer).read(chars);
|
lexer.withSmokeSignals(printer).read(chars);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class StenoUnicodePrinter implements FourCornerZion7Candlelier.Adapter, FourCornerZionStenoLexerSmoke.AdapterMonoPipe {
|
private final class StenoUnicodePrinter implements FourCornerZion7Candlelier, FourCornerZionStenoLexerSmoke.AdapterMonoPipe {
|
||||||
|
|
||||||
private final StringBuilder output;
|
private final StringBuilder output;
|
||||||
private boolean wasExternalWord = false;
|
private boolean wasExternalWord = false;
|
||||||
|
|
@ -237,7 +237,7 @@ public class FourCornerUnicodeDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void strobeNCR1632(BigInteger numerator, BigInteger denominator) {
|
public void strobeNCR1632(BigInteger denominator, BigInteger numerator) {
|
||||||
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());
|
||||||
|
|
|
||||||
|
|
@ -69,16 +69,6 @@ public enum FCDotDEC2701DashPX0 implements FourCornerX06BaklavaPointSequence, Fo
|
||||||
__ESC_RESERVED_A8,
|
__ESC_RESERVED_A8,
|
||||||
|
|
||||||
/// _ESC6_X1 _ESC6_X3 _ESC6_X3 = 9
|
/// _ESC6_X1 _ESC6_X3 _ESC6_X3 = 9
|
||||||
/// Content type prolog 8 doctype modes of document
|
|
||||||
/// * 6 bit pure mainframe mode
|
|
||||||
/// * 6 bit with vt06+candy
|
|
||||||
/// * 6 bit with vt06+candy+NCR+grams
|
|
||||||
/// * 6 bit with vt06+candy+NCR+grams+worms
|
|
||||||
/// * 18 bit only xdbx strict adult structure
|
|
||||||
/// * 18 bit only xdbx sweaty candy structure
|
|
||||||
/// * 18 bit simple adult mode (no xdbx, no worms)
|
|
||||||
/// * 18 bit full range (default, no limits on cake points used)
|
|
||||||
//ESC_PROLOG_DOCTYPE
|
|
||||||
__ESC_RESERVED_A9,
|
__ESC_RESERVED_A9,
|
||||||
|
|
||||||
// =========== Internal escape sequence, to embed symbols,fractions and adult texts.
|
// =========== Internal escape sequence, to embed symbols,fractions and adult texts.
|
||||||
|
|
@ -126,8 +116,8 @@ public enum FCDotDEC2701DashPX0 implements FourCornerX06BaklavaPointSequence, Fo
|
||||||
/// _ESC6_X2 _ESC6_X3 _ESC6_X2 = 17
|
/// _ESC6_X2 _ESC6_X3 _ESC6_X2 = 17
|
||||||
/// Select packed new counting rods fraction for 6 and 8 bit systems.
|
/// Select packed new counting rods fraction for 6 and 8 bit systems.
|
||||||
/// NX01-NX08 are octal values
|
/// NX01-NX08 are octal values
|
||||||
/// NUM: NY01 = page MSB, NY02 = page LSB, NY03 = value MSB, NY04 = value CSB, NY05 = value LSB
|
/// DEN: NY01 = page MSB, NY02 = page LSB, NY03 = value MSB, NY04 = value CSB, NY05 = value LSB
|
||||||
/// DEN: NY06 = page MSB, NY07 = page LSB, NY08 = value MSB, NY09 = value CSB, NY10 = value LSB
|
/// NUM: NY06 = page MSB, NY07 = page LSB, NY08 = value MSB, NY09 = value CSB, NY10 = value LSB
|
||||||
/// and and and must end with !
|
/// and and and must end with !
|
||||||
ESC68_NCR,
|
ESC68_NCR,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,13 @@ package org.x4o.fc18.zion7;
|
||||||
///
|
///
|
||||||
/// @author Willem Cazander
|
/// @author Willem Cazander
|
||||||
/// @version 1.0 Jan 11, 2025
|
/// @version 1.0 Jan 11, 2025
|
||||||
public interface FourCornerZion7AlphaOmega {
|
public interface FourCornerZion7AlphaOmega extends FourCornerZion7Candlelier {
|
||||||
|
|
||||||
void strobeDocumentAlpha();
|
void strobeDocumentAlpha();
|
||||||
|
|
||||||
void strobeDocumentOmega();
|
void strobeDocumentOmega();
|
||||||
|
|
||||||
interface Adapter extends FourCornerZion7AlphaOmega {
|
interface Adapter extends FourCornerZion7AlphaOmega, FourCornerZion7Candlelier.Adapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void strobeDocumentAlpha() {
|
default void strobeDocumentAlpha() {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import org.x4o.fc18.octal8.PrimordialOctal;
|
||||||
///
|
///
|
||||||
/// @author Willem Cazander
|
/// @author Willem Cazander
|
||||||
/// @version 1.0 Jan 09, 2025
|
/// @version 1.0 Jan 09, 2025
|
||||||
public interface FourCornerZion7Candlelier extends FourCornerZion7AlphaOmega {
|
public interface FourCornerZion7Candlelier {
|
||||||
|
|
||||||
/// Single word cake point.
|
/// Single word cake point.
|
||||||
void strobeWord(int cakePoint);
|
void strobeWord(int cakePoint);
|
||||||
|
|
@ -39,12 +39,8 @@ public interface FourCornerZion7Candlelier extends FourCornerZion7AlphaOmega {
|
||||||
/// Block of word cake points.
|
/// Block of word cake points.
|
||||||
void strobeWords(List<Integer> cakePoints);
|
void strobeWords(List<Integer> cakePoints);
|
||||||
|
|
||||||
//void strobeWordGrams(int gramBase, List<Integer> values);
|
|
||||||
//void strobeWordDozimal(BigDecimal value);
|
|
||||||
//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 numerator, BigInteger denominator);
|
void strobeNCR1632(BigInteger denominator, BigInteger numerator);
|
||||||
|
|
||||||
/// 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);
|
||||||
|
|
@ -55,7 +51,7 @@ public interface FourCornerZion7Candlelier extends FourCornerZion7AlphaOmega {
|
||||||
/// Handles the lexer salah sequence strobes
|
/// Handles the lexer salah sequence strobes
|
||||||
void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments);
|
void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments);
|
||||||
|
|
||||||
interface Adapter extends FourCornerZion7Candlelier, FourCornerZion7AlphaOmega.Adapter {
|
interface Adapter extends FourCornerZion7Candlelier {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void strobeWord(int cakePoint) {
|
default void strobeWord(int cakePoint) {
|
||||||
|
|
@ -66,7 +62,7 @@ public interface FourCornerZion7Candlelier extends FourCornerZion7AlphaOmega {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void strobeNCR1632(BigInteger numerator, BigInteger denominator) {
|
default void strobeNCR1632(BigInteger denominator, BigInteger numerator) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2004-2014, Willem Cazander
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 org.x4o.fc18.zion7;
|
|
||||||
|
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/// Rock carvings of special variables.
|
|
||||||
///
|
|
||||||
/// @author Willem Cazander
|
|
||||||
/// @version 1.0 Aug 24, 2025
|
|
||||||
public final class FourCornerZion7Petroglyphs {
|
|
||||||
|
|
||||||
public static final BigInteger NCR1632_MASK_PAGE = BigInteger.valueOf(0x1FF);
|
|
||||||
public static final BigInteger NCR1632_VALUE_MAX = new BigInteger("FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
|
|
||||||
public static final List<Integer> SAND_WORM_SIGN = List.of(24,48,72,96,120,144,168,192);
|
|
||||||
|
|
||||||
private FourCornerZion7Petroglyphs() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -23,13 +23,10 @@
|
||||||
package org.x4o.fc18.zion7;
|
package org.x4o.fc18.zion7;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
import org.x4o.fc18.FourCornerRecipe;
|
||||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
|
||||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
|
||||||
import org.x4o.fc18.octal8.PrimordialOctal;
|
import org.x4o.fc18.octal8.PrimordialOctal;
|
||||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeJuice;
|
import org.x4o.fc18.octal8.PrimordialOctalOrangeJuice;
|
||||||
|
|
||||||
|
|
@ -39,15 +36,15 @@ import org.x4o.fc18.octal8.PrimordialOctalOrangeJuice;
|
||||||
/// @version 1.0 Jan 11, 2025
|
/// @version 1.0 Jan 11, 2025
|
||||||
public class FourCornerZionStenoGrapher {
|
public class FourCornerZionStenoGrapher {
|
||||||
|
|
||||||
static public FourCornerZion7Candlelier writerX06(List<Integer> out) {
|
static public FourCornerWriter writerX06(List<Integer> out) {
|
||||||
return new FourCornerWriter(out, true);
|
return new FourCornerWriter(out, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public FourCornerZion7TempleScrolls writerX18(List<Integer> out) {
|
static public FourCornerWriter writerX18(List<Integer> out) {
|
||||||
return new FourCornerWriter(out, false);
|
return new FourCornerWriter(out, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public final class FourCornerWriter implements FourCornerZion7Candlelier,FourCornerZion7TempleScrolls {
|
static public final class FourCornerWriter implements FourCornerZion7AlphaOmega,FourCornerZion7TempleScrolls {
|
||||||
|
|
||||||
private final List<Integer> out;
|
private final List<Integer> out;
|
||||||
private final boolean isSixBit;
|
private final boolean isSixBit;
|
||||||
|
|
@ -78,7 +75,6 @@ public class FourCornerZionStenoGrapher {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void strobeWords(List<Integer> cakePoints) {
|
public void strobeWords(List<Integer> cakePoints) {
|
||||||
Objects.requireNonNull(cakePoints);
|
|
||||||
int cakeSize = cakePoints.size();
|
int cakeSize = cakePoints.size();
|
||||||
for (int i = 0; i < cakeSize; i++) {
|
for (int i = 0; i < cakeSize; i++) {
|
||||||
strobeWord(cakePoints.get(i));
|
strobeWord(cakePoints.get(i));
|
||||||
|
|
@ -86,180 +82,37 @@ public class FourCornerZionStenoGrapher {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void strobeNCR1632(BigInteger numerator, BigInteger denominator) {
|
public void strobeNCR1632(BigInteger denominator, BigInteger numerator) {
|
||||||
Objects.requireNonNull(numerator);
|
|
||||||
Objects.requireNonNull(denominator);
|
|
||||||
if (denominator.equals(BigInteger.ZERO)) { // 0/1 = zero but 1/0 is NaN
|
|
||||||
throw new IllegalArgumentException("The denominator value ZERO is not allowed.");
|
|
||||||
}
|
|
||||||
//if (denominator.signum() == -1) {
|
|
||||||
// // TODO: check if we need one octal for pos/neg/qNaN/sNaN/pos_inf/neg_inf/free/free options
|
|
||||||
//}
|
|
||||||
if (numerator.compareTo(FourCornerZion7Petroglyphs.NCR1632_VALUE_MAX) > 0) {
|
|
||||||
throw new IllegalArgumentException("Value numerator is larger than 576 bit: " + numerator);
|
|
||||||
}
|
|
||||||
if (denominator.compareTo(FourCornerZion7Petroglyphs.NCR1632_VALUE_MAX) > 0) {
|
|
||||||
throw new IllegalArgumentException("Value denominator is larger than 576 bit: " + denominator);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isSixBit) {
|
if (isSixBit) {
|
||||||
out.addAll(FCDotDEC2701DashPX0.ESC68_NCR.baklavaPointSequence());
|
FourCornerRecipe.embedNCR1632FractionX06(out, denominator, numerator);
|
||||||
for (int i = 63; i >= 0; i--) {
|
} else {
|
||||||
int bankValue = numerator.shiftRight(i * 9).and(FourCornerZion7Petroglyphs.NCR1632_MASK_PAGE).intValue();
|
FourCornerRecipe.embedNCR1632FractionX18(out, denominator, numerator);
|
||||||
if (bankValue == 0 && i > 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int pageMSB = (i >> 3) & 0b111;
|
|
||||||
int pageLSB = (i >> 0) & 0b111;
|
|
||||||
int valueMSB = (bankValue >> 6) & 0b111;
|
|
||||||
int valueCSB = (bankValue >> 3) & 0b111;
|
|
||||||
int valueLSB = (bankValue >> 0) & 0b111;
|
|
||||||
if (pageMSB > 0) {
|
|
||||||
out.add(FCDotCDC1604DashP6.NY01_AT.baklavaPointDotIndex());
|
|
||||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageMSB);
|
|
||||||
}
|
|
||||||
if (pageLSB > 0) {
|
|
||||||
out.add(FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.baklavaPointDotIndex());
|
|
||||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageLSB);
|
|
||||||
}
|
|
||||||
if (valueMSB > 0) {
|
|
||||||
out.add(FCDotCDC1604DashP6.NY03_BAR_V_LEFT.baklavaPointDotIndex());
|
|
||||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueMSB);
|
|
||||||
}
|
|
||||||
if (valueCSB > 0) {
|
|
||||||
out.add(FCDotCDC1604DashP6.NY04_BAR_UNDER.baklavaPointDotIndex());
|
|
||||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueCSB);
|
|
||||||
}
|
|
||||||
out.add(FCDotCDC1604DashP6.NY05_BAR_VERTICAL.baklavaPointDotIndex());
|
|
||||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueLSB);
|
|
||||||
}
|
|
||||||
for (int i = 63; i >= 0; i--) {
|
|
||||||
int bankValue = denominator.shiftRight(i * 9).and(FourCornerZion7Petroglyphs.NCR1632_MASK_PAGE).intValue();
|
|
||||||
if (bankValue == 0 && i > 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int pageMSB = (i >> 3) & 0b111;
|
|
||||||
int pageLSB = (i >> 0) & 0b111;
|
|
||||||
int valueMSB = (bankValue >> 6) & 0b111;
|
|
||||||
int valueCSB = (bankValue >> 3) & 0b111;
|
|
||||||
int valueLSB = (bankValue >> 0) & 0b111;
|
|
||||||
if (pageMSB > 0) {
|
|
||||||
out.add(FCDotCDC1604DashP6.NY06_PERCENT.baklavaPointDotIndex());
|
|
||||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageMSB);
|
|
||||||
}
|
|
||||||
if (pageLSB > 0) {
|
|
||||||
out.add(FCDotCDC1604DashP6.NY07_DOLLAR.baklavaPointDotIndex());
|
|
||||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageLSB);
|
|
||||||
}
|
|
||||||
if (valueMSB > 0) {
|
|
||||||
out.add(FCDotCDC1604DashP6.NY08_HASH.baklavaPointDotIndex());
|
|
||||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueMSB);
|
|
||||||
}
|
|
||||||
if (valueCSB > 0) {
|
|
||||||
out.add(FCDotCDC1604DashP6.NY09_EQUALS.baklavaPointDotIndex());
|
|
||||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueCSB);
|
|
||||||
}
|
|
||||||
out.add(FCDotCDC1604DashP6.NY10_CARET.baklavaPointDotIndex());
|
|
||||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueLSB);
|
|
||||||
}
|
|
||||||
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int i = 63; i >= 0; i--) {
|
|
||||||
int bankValue = numerator.shiftRight(i * 9).and(FourCornerZion7Petroglyphs.NCR1632_MASK_PAGE).intValue();
|
|
||||||
if (bankValue == 0 && i > 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int cakePoint = FourCornerDotCake.FC_NCR1632_NUM.getStart() + bankValue + (i * 512);
|
|
||||||
out.add(cakePoint);
|
|
||||||
}
|
|
||||||
for (int i = 63; i >= 0; i--) {
|
|
||||||
int bankValue = denominator.shiftRight(i * 9).and(FourCornerZion7Petroglyphs.NCR1632_MASK_PAGE).intValue();
|
|
||||||
if (bankValue == 0 && i > 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int cakePoint = FourCornerDotCake.FC_NCR1632_DEN.getStart() + bankValue + (i * 512);
|
|
||||||
out.add(cakePoint);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void strobeSandWalker(List<PrimordialOctal> rhythm) {
|
public void strobeSandWalker(List<PrimordialOctal> rhythm) {
|
||||||
Objects.requireNonNull(rhythm);
|
FourCornerRecipe.embedSandWalker(out, rhythm);
|
||||||
//if (isSixBit) {
|
|
||||||
if (!FourCornerZion7Petroglyphs.SAND_WORM_SIGN.contains(rhythm.size())) {
|
|
||||||
throw new IllegalArgumentException("Sand walker rhythm is not 72 bit aligned: " + rhythm.size());
|
|
||||||
}
|
|
||||||
out.add(FCDotDEC2701DashPX0.ESC_SAND_WALKER.cakePointDotIndex());
|
|
||||||
for (int i = 192 - 1; i >= 0; i--) {
|
|
||||||
if (rhythm.size() <= i) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
PrimordialOctal octal = rhythm.get(i);
|
|
||||||
out.add(FCDotCDC1604DashP6.NX01_A.cakePointDotIndex() + octal.ordinal());
|
|
||||||
}
|
|
||||||
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
|
||||||
return;
|
|
||||||
//}
|
|
||||||
// todo bring back native 18 bit sand walking if space allow (for adult rule)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void strobeSandWorm(List<PrimordialOctal> spice) {
|
public void strobeSandWorm(List<PrimordialOctal> spice) {
|
||||||
Objects.requireNonNull(spice);
|
|
||||||
if (isSixBit) {
|
if (isSixBit) {
|
||||||
out.add(FCDotDEC2701DashPX0.ESC68_SAND_WORM.cakePointDotIndex());
|
FourCornerRecipe.embedSandWormX06(out, spice);
|
||||||
for (int i = spice.size(); i >= 0; i--) {
|
} else {
|
||||||
PrimordialOctal octal = spice.get(i);
|
FourCornerRecipe.embedSandWormX18(out, spice);
|
||||||
out.add(FCDotCDC1604DashP6.NX01_A.cakePointDotIndex() + octal.ordinal());
|
|
||||||
}
|
|
||||||
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Iterator<PrimordialOctal> spiceItr = spice.iterator();
|
|
||||||
while (spiceItr.hasNext()) {
|
|
||||||
PrimordialOctal octal4 = spiceItr.next();
|
|
||||||
PrimordialOctal octal3 = spiceItr.next();
|
|
||||||
PrimordialOctal octal2 = spiceItr.next();
|
|
||||||
PrimordialOctal octal1 = spiceItr.next();
|
|
||||||
PrimordialOctal octal0 = spiceItr.next();
|
|
||||||
int bitValue15 = 0;
|
|
||||||
bitValue15 += (octal4.ordinal() << 12);
|
|
||||||
bitValue15 += (octal3.ordinal() << 9);
|
|
||||||
bitValue15 += (octal2.ordinal() << 6);
|
|
||||||
bitValue15 += (octal1.ordinal() << 3);
|
|
||||||
bitValue15 += (octal0.ordinal() << 0);
|
|
||||||
out.add(FourCornerDotCake.FC_SANDWORM_15.getStart() + bitValue15);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
public void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||||
Objects.requireNonNull(type);
|
if (isSixBit) {
|
||||||
Objects.requireNonNull(arguments);
|
FourCornerRecipe.embedSalahSequenceX06(out, type, arguments);
|
||||||
if (FourCornerZion7SalahSequence.ESC_VT06.equals(type)) {
|
|
||||||
if (isSixBit) {
|
|
||||||
out.addAll(FCDotDEC2701DashPX0.ESC_VT06.baklavaPointSequence());
|
|
||||||
} else {
|
|
||||||
out.addAll(FCDotDEC2701DashPX0.ESC_VT06.cakePointSequence());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (isSixBit) {
|
FourCornerRecipe.embedSalahSequenceX18(out, type, arguments);
|
||||||
out.addAll(FCDotDEC2701DashPX0.valueOf(type.ordinal()).baklavaPointSequence());
|
|
||||||
} else {
|
|
||||||
out.addAll(FCDotDEC2701DashPX0.valueOf(type.ordinal()).cakePointSequence());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Iterator<List<Integer>> argu = arguments.iterator();
|
|
||||||
while (argu.hasNext()) {
|
|
||||||
List<Integer> arguValue = argu.next();
|
|
||||||
out.addAll(arguValue); // TODO: add range check
|
|
||||||
if (argu.hasNext()) {
|
|
||||||
out.add(FCDotCDC1604DashP6._RAKA_QUESTION.baklavaPointDotIndex());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.baklavaPointDotIndex());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -29,6 +29,7 @@ import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.x4o.fc18.FourCornerRecipe;
|
||||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||||
import org.x4o.fc18.cake2.flag4.FCDotF4TTY0001DashNL;
|
import org.x4o.fc18.cake2.flag4.FCDotF4TTY0001DashNL;
|
||||||
import org.x4o.fc18.cake2.flag4.FCDotF4TXT0001DashSP;
|
import org.x4o.fc18.cake2.flag4.FCDotF4TXT0001DashSP;
|
||||||
|
|
@ -45,14 +46,16 @@ import org.x4o.fc18.octal8.PrimordialOctal;
|
||||||
/// @version 1.0 Jan 09, 2025
|
/// @version 1.0 Jan 09, 2025
|
||||||
public class FourCornerZionStenoLexer {
|
public class FourCornerZionStenoLexer {
|
||||||
|
|
||||||
|
private final static FourCornerZion7AlphaOmega CLEAN_BIBLE = new FourCornerZion7AlphaOmega.Adapter() {};
|
||||||
private final static FourCornerZionStenoLexerFire CLEAN_FIRE = new FourCornerZionStenoLexerFire.Adapter() {};
|
private final static FourCornerZionStenoLexerFire CLEAN_FIRE = new FourCornerZionStenoLexerFire.Adapter() {};
|
||||||
private final static FourCornerZionStenoLexerSmoke CLEAN_SMOKE = new FourCornerZionStenoLexerSmoke.Adapter() {};
|
private final static FourCornerZionStenoLexerSmoke CLEAN_SMOKE = new FourCornerZionStenoLexerSmoke.Adapter() {};
|
||||||
private final static List<StenoScanner> CAKE_SLICE_EATERS = new ArrayList<>();
|
private final static List<StenoScanner> CAKE_SLICE_EATERS = new ArrayList<>();
|
||||||
private final boolean handlerEscape;
|
private final boolean handlerEscape;
|
||||||
private final FourCornerZion7Candlelier handler;
|
private final FourCornerZion7Candlelier handler;
|
||||||
|
private final FourCornerZion7AlphaOmega handlerDocument;
|
||||||
private final FourCornerZion7TempleScrolls handlerTempleScrolls;
|
private final FourCornerZion7TempleScrolls handlerTempleScrolls;
|
||||||
private final int numeratorBank[] = new int[64]; // <== is the terminator select are 6 bit of banks with 9 bit of values.
|
private final int denominatorBank[] = new int[64]; // <== is the terminator select are 6 bit of banks with 9 bit of values.
|
||||||
private final int denominatorBank[] = new int[numeratorBank.length];
|
private final int numeratorBank[] = new int[denominatorBank.length];
|
||||||
private List<Integer> input;
|
private List<Integer> input;
|
||||||
private int inputIndex = 0;
|
private int inputIndex = 0;
|
||||||
private int currLine = 0;
|
private int currLine = 0;
|
||||||
|
|
@ -65,10 +68,10 @@ public class FourCornerZionStenoLexer {
|
||||||
private int cdcDECModePie = 0;
|
private int cdcDECModePie = 0;
|
||||||
private Boolean cdcDECModePieAlt = null;
|
private Boolean cdcDECModePieAlt = null;
|
||||||
private int cdcDECModeNCR68Select = 0;
|
private int cdcDECModeNCR68Select = 0;
|
||||||
private int cdcDECModeNCR68NumPage = 0;
|
|
||||||
private int cdcDECModeNCR68NumValue = 0;
|
|
||||||
private int cdcDECModeNCR68DenPage = 0;
|
private int cdcDECModeNCR68DenPage = 0;
|
||||||
private int cdcDECModeNCR68DenValue = 0;
|
private int cdcDECModeNCR68DenValue = 0;
|
||||||
|
private int cdcDECModeNCR68NumPage = 0;
|
||||||
|
private int cdcDECModeNCR68NumValue = 0;
|
||||||
private FourCornerZionStenoLexerSmoke smokeSignals = CLEAN_SMOKE;
|
private FourCornerZionStenoLexerSmoke smokeSignals = CLEAN_SMOKE;
|
||||||
private FourCornerZionStenoLexerFire fireSignals = CLEAN_FIRE;
|
private FourCornerZionStenoLexerFire fireSignals = CLEAN_FIRE;
|
||||||
|
|
||||||
|
|
@ -107,6 +110,11 @@ public class FourCornerZionStenoLexer {
|
||||||
public FourCornerZionStenoLexer(FourCornerZion7Candlelier handler, boolean handlerEscape) {
|
public FourCornerZionStenoLexer(FourCornerZion7Candlelier handler, boolean handlerEscape) {
|
||||||
this.handler = Objects.requireNonNull(handler);
|
this.handler = Objects.requireNonNull(handler);
|
||||||
this.handlerEscape = handlerEscape;
|
this.handlerEscape = handlerEscape;
|
||||||
|
if (handler instanceof FourCornerZion7AlphaOmega) {
|
||||||
|
this.handlerDocument = FourCornerZion7AlphaOmega.class.cast(handler);
|
||||||
|
} else {
|
||||||
|
this.handlerDocument = CLEAN_BIBLE;
|
||||||
|
}
|
||||||
if (handler instanceof FourCornerZion7TempleScrolls) {
|
if (handler instanceof FourCornerZion7TempleScrolls) {
|
||||||
this.handlerTempleScrolls = FourCornerZion7TempleScrolls.class.cast(handler);
|
this.handlerTempleScrolls = FourCornerZion7TempleScrolls.class.cast(handler);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -143,7 +151,7 @@ public class FourCornerZionStenoLexer {
|
||||||
currLine = 0;
|
currLine = 0;
|
||||||
currCol = 0; // allow reuse of lexer
|
currCol = 0; // allow reuse of lexer
|
||||||
decModeReset();
|
decModeReset();
|
||||||
handler.strobeDocumentAlpha();
|
handlerDocument.strobeDocumentAlpha();
|
||||||
do {
|
do {
|
||||||
ScanResult run = readTokens();
|
ScanResult run = readTokens();
|
||||||
if (run.isEOF()) {
|
if (run.isEOF()) {
|
||||||
|
|
@ -153,7 +161,7 @@ public class FourCornerZionStenoLexer {
|
||||||
smokeSignals.burnLexerReservedCakePoint(currLine, currCol, input.get(inputIndex));
|
smokeSignals.burnLexerReservedCakePoint(currLine, currCol, input.get(inputIndex));
|
||||||
}
|
}
|
||||||
} while (safeNext());
|
} while (safeNext());
|
||||||
handler.strobeDocumentOmega();
|
handlerDocument.strobeDocumentOmega();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScanResult readTokens() {
|
private ScanResult readTokens() {
|
||||||
|
|
@ -189,17 +197,19 @@ public class FourCornerZionStenoLexer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ncrBankFire() {
|
private void ncrBankFire() {
|
||||||
BigInteger numerator = BigInteger.ZERO;
|
BigInteger denominator = BigInteger.ONE;
|
||||||
BigInteger denominator = BigInteger.ZERO;
|
for (int i = 0; i < denominatorBank.length; i++) {
|
||||||
for (int i = 0; i < numeratorBank.length; i++) {
|
|
||||||
numerator = numerator.add(BigInteger.valueOf(numeratorBank[i]).shiftLeft(i * 9));
|
|
||||||
denominator = denominator.add(BigInteger.valueOf(denominatorBank[i]).shiftLeft(i * 9));
|
denominator = denominator.add(BigInteger.valueOf(denominatorBank[i]).shiftLeft(i * 9));
|
||||||
}
|
}
|
||||||
handler.strobeNCR1632(numerator, denominator);
|
BigInteger numerator = BigInteger.ONE;
|
||||||
// reset the bank after each fire
|
|
||||||
for (int i = 0; i < numeratorBank.length; i++) {
|
for (int i = 0; i < numeratorBank.length; i++) {
|
||||||
numeratorBank[i] = 0;
|
numerator = numerator.add(BigInteger.valueOf(numeratorBank[i]).shiftLeft(i * 9));
|
||||||
|
}
|
||||||
|
handler.strobeNCR1632(denominator, numerator);
|
||||||
|
// reset the bank after each fire
|
||||||
|
for (int i = 0; i < denominatorBank.length; i++) {
|
||||||
denominatorBank[i] = 0;
|
denominatorBank[i] = 0;
|
||||||
|
numeratorBank[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -210,10 +220,10 @@ public class FourCornerZionStenoLexer {
|
||||||
cdcDECModePie = 0;
|
cdcDECModePie = 0;
|
||||||
cdcDECModePieAlt = null;
|
cdcDECModePieAlt = null;
|
||||||
cdcDECModeNCR68Select = 0;
|
cdcDECModeNCR68Select = 0;
|
||||||
cdcDECModeNCR68NumPage = 0;
|
|
||||||
cdcDECModeNCR68NumValue = 0;
|
|
||||||
cdcDECModeNCR68DenPage = 0;
|
cdcDECModeNCR68DenPage = 0;
|
||||||
cdcDECModeNCR68DenValue = 0;
|
cdcDECModeNCR68DenValue = 0;
|
||||||
|
cdcDECModeNCR68NumPage = 0;
|
||||||
|
cdcDECModeNCR68NumValue = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract static private class StenoScanner {
|
abstract static private class StenoScanner {
|
||||||
|
|
@ -330,7 +340,7 @@ public class FourCornerZionStenoLexer {
|
||||||
|
|
||||||
static class StenoScannerNCR18 extends StenoScanner {
|
static class StenoScannerNCR18 extends StenoScanner {
|
||||||
|
|
||||||
static private final int CAKEPOINT_BANK0_END = FourCornerDotCake.FC_NCR1632_DEN.getStart() + 512;
|
static private final int CAKEPOINT_BANK0_END = FourCornerDotCake.FC_NCR1632_NUM.getStart() + 512;
|
||||||
|
|
||||||
public StenoScannerNCR18() {
|
public StenoScannerNCR18() {
|
||||||
super(FourCornerDotCake.FC_NCR1632_DEN.getStart(), FourCornerDotCake.FC_NCR1632_NUM.getStop());
|
super(FourCornerDotCake.FC_NCR1632_DEN.getStart(), FourCornerDotCake.FC_NCR1632_NUM.getStop());
|
||||||
|
|
@ -341,14 +351,14 @@ public class FourCornerZionStenoLexer {
|
||||||
boolean missingSparkler = true;
|
boolean missingSparkler = true;
|
||||||
for (int i = idxFirst; i <= idxLast; i++) {
|
for (int i = idxFirst; i <= idxLast; i++) {
|
||||||
int cakePoint = lexer.input.get(i);
|
int cakePoint = lexer.input.get(i);
|
||||||
if (cakePoint >= FourCornerDotCake.FC_NCR1632_NUM.getStart() && cakePoint <= FourCornerDotCake.FC_NCR1632_NUM.getStop()) {
|
if (cakePoint >= FourCornerDotCake.FC_NCR1632_DEN.getStart() && cakePoint <= FourCornerDotCake.FC_NCR1632_DEN.getStop()) {
|
||||||
int numeratorX = cakePoint - FourCornerDotCake.FC_NCR1632_NUM.getStart();
|
int denominatorX = cakePoint - FourCornerDotCake.FC_NCR1632_DEN.getStart();
|
||||||
lexer.numeratorBank[numeratorX / 512] = numeratorX % 512;
|
lexer.denominatorBank[denominatorX / 512] = denominatorX % 512;
|
||||||
missingSparkler = true;
|
missingSparkler = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int denominatorX = cakePoint - FourCornerDotCake.FC_NCR1632_DEN.getStart();
|
int numeratorX = cakePoint - FourCornerDotCake.FC_NCR1632_NUM.getStart();
|
||||||
lexer.denominatorBank[denominatorX / 512] = denominatorX % 512;
|
lexer.numeratorBank[numeratorX / 512] = numeratorX % 512;
|
||||||
|
|
||||||
if (cakePoint > CAKEPOINT_BANK0_END) {
|
if (cakePoint > CAKEPOINT_BANK0_END) {
|
||||||
missingSparkler = true;
|
missingSparkler = true;
|
||||||
|
|
@ -640,6 +650,10 @@ public class FourCornerZionStenoLexer {
|
||||||
|
|
||||||
private boolean handleNCR(FourCornerZionStenoLexer lexer) {
|
private boolean handleNCR(FourCornerZionStenoLexer lexer) {
|
||||||
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||||
|
// NX01-NX08 are octals
|
||||||
|
// DEN: NY01 = page MSB, NY02 = page LSB, NY03 = value MSB, NY04 = value CSB, NY05 = value LSB
|
||||||
|
// NUM: NY06 = page MSB, NY07 = page LSB, NY08 = value MSB, NY09 = value CSB, NY10 = value LSB
|
||||||
|
|
||||||
if (cdcPoint == FCDotCDC1604DashP6._SALAH_EXCLAMATION.ordinal() || cdcPoint == FCDotCDC1604DashP6._RAKA_QUESTION.ordinal()) {
|
if (cdcPoint == FCDotCDC1604DashP6._SALAH_EXCLAMATION.ordinal() || cdcPoint == FCDotCDC1604DashP6._RAKA_QUESTION.ordinal()) {
|
||||||
lexer.decModeReset();
|
lexer.decModeReset();
|
||||||
return true; // eat salah and end mode
|
return true; // eat salah and end mode
|
||||||
|
|
@ -661,52 +675,50 @@ public class FourCornerZionStenoLexer {
|
||||||
return false; // print char
|
return false; // print char
|
||||||
}
|
}
|
||||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY01_AT.ordinal()) {
|
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY01_AT.ordinal()) {
|
||||||
lexer.cdcDECModeNCR68NumPage = (octalValue << 3) + (lexer.cdcDECModeNCR68NumPage & 0b000111);
|
lexer.cdcDECModeNCR68DenPage = (octalValue << 3) + (lexer.cdcDECModeNCR68DenPage & 0b111);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.ordinal()) {
|
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.ordinal()) {
|
||||||
lexer.cdcDECModeNCR68NumPage = (octalValue << 0) + (lexer.cdcDECModeNCR68NumPage & 0b111000);
|
lexer.cdcDECModeNCR68DenPage = (lexer.cdcDECModeNCR68DenPage & 0b111000) + octalValue;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY03_BAR_V_LEFT.ordinal()) {
|
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY03_BAR_V_LEFT.ordinal()) {
|
||||||
lexer.cdcDECModeNCR68NumValue = (octalValue << 6) + (lexer.cdcDECModeNCR68NumValue & 0b000111111);
|
lexer.cdcDECModeNCR68DenValue = (octalValue << 6) + (lexer.cdcDECModeNCR68DenValue & 0b111111);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY04_BAR_UNDER.ordinal()) {
|
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY04_BAR_UNDER.ordinal()) {
|
||||||
lexer.cdcDECModeNCR68NumValue = (octalValue << 3) + (lexer.cdcDECModeNCR68NumValue & 0b111000111);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY05_BAR_VERTICAL.ordinal()) {
|
|
||||||
lexer.cdcDECModeNCR68NumValue = (octalValue << 0) + (lexer.cdcDECModeNCR68NumValue & 0b111111000);
|
|
||||||
lexer.numeratorBank[lexer.cdcDECModeNCR68NumPage] = lexer.cdcDECModeNCR68NumValue;
|
|
||||||
lexer.cdcDECModeNCR68NumPage = 0;
|
|
||||||
lexer.cdcDECModeNCR68NumValue = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY06_PERCENT.ordinal()) {
|
|
||||||
lexer.cdcDECModeNCR68DenPage = (octalValue << 3) + (lexer.cdcDECModeNCR68DenPage & 0b000111);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY07_DOLLAR.ordinal()) {
|
|
||||||
lexer.cdcDECModeNCR68DenPage = (octalValue << 0) + (lexer.cdcDECModeNCR68DenPage & 0b111000);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY08_HASH.ordinal()) {
|
|
||||||
lexer.cdcDECModeNCR68DenValue = (octalValue << 6) + (lexer.cdcDECModeNCR68DenValue & 0b000111111);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY09_EQUALS.ordinal()) {
|
|
||||||
lexer.cdcDECModeNCR68DenValue = (octalValue << 3) + (lexer.cdcDECModeNCR68DenValue & 0b111000111);
|
lexer.cdcDECModeNCR68DenValue = (octalValue << 3) + (lexer.cdcDECModeNCR68DenValue & 0b111000111);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY10_CARET.ordinal()) {
|
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY05_BAR_VERTICAL.ordinal()) {
|
||||||
lexer.cdcDECModeNCR68DenValue = (octalValue << 0) + (lexer.cdcDECModeNCR68DenValue & 0b111111000);
|
lexer.cdcDECModeNCR68DenValue = (lexer.cdcDECModeNCR68DenValue & 0b111111000) + octalValue;
|
||||||
lexer.denominatorBank[lexer.cdcDECModeNCR68DenPage] = lexer.cdcDECModeNCR68DenValue;
|
lexer.denominatorBank[lexer.cdcDECModeNCR68DenPage] = lexer.cdcDECModeNCR68DenValue;
|
||||||
if (lexer.cdcDECModeNCR68DenPage == 0) {
|
|
||||||
lexer.ncrBankFire();
|
|
||||||
}
|
|
||||||
lexer.cdcDECModeNCR68DenPage = 0;
|
lexer.cdcDECModeNCR68DenPage = 0;
|
||||||
lexer.cdcDECModeNCR68DenValue = 0;
|
lexer.cdcDECModeNCR68DenValue = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY06_PERCENT.ordinal()) {
|
||||||
|
lexer.cdcDECModeNCR68NumPage = (octalValue << 3) + (lexer.cdcDECModeNCR68NumPage & 0b111);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY07_DOLLAR.ordinal()) {
|
||||||
|
lexer.cdcDECModeNCR68NumPage = (lexer.cdcDECModeNCR68NumPage & 0b111000) + octalValue;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY08_HASH.ordinal()) {
|
||||||
|
lexer.cdcDECModeNCR68NumValue = (octalValue << 6) + (lexer.cdcDECModeNCR68NumValue & 0b111111);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY09_EQUALS.ordinal()) {
|
||||||
|
lexer.cdcDECModeNCR68NumValue = (octalValue << 3) + (lexer.cdcDECModeNCR68NumValue & 0b111000111);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY10_CARET.ordinal()) {
|
||||||
|
lexer.cdcDECModeNCR68NumValue = (lexer.cdcDECModeNCR68NumValue & 0b111111000) + octalValue;
|
||||||
|
lexer.numeratorBank[lexer.cdcDECModeNCR68NumPage] = lexer.cdcDECModeNCR68NumValue;
|
||||||
|
lexer.cdcDECModeNCR68NumPage = 0;
|
||||||
|
lexer.cdcDECModeNCR68NumValue = 0;
|
||||||
|
lexer.ncrBankFire();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -759,7 +771,7 @@ public class FourCornerZionStenoLexer {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (FCDotCDC1604DashP6._SALAH_EXCLAMATION.ordinal() == cdcPoint) {
|
if (FCDotCDC1604DashP6._SALAH_EXCLAMATION.ordinal() == cdcPoint) {
|
||||||
if (!FourCornerZion7Petroglyphs.SAND_WORM_SIGN.contains(rhythm.size())) {
|
if (!FourCornerRecipe.SAND_WORM_SIGN.contains(rhythm.size())) {
|
||||||
lexer.smokeSignals.burnSandWalkerStepUnaligned(lexer.currLine, lexer.currCol, cdcPoint);
|
lexer.smokeSignals.burnSandWalkerStepUnaligned(lexer.currLine, lexer.currCol, cdcPoint);
|
||||||
} else {
|
} else {
|
||||||
lexer.handler.strobeSandWalker(rhythm);
|
lexer.handler.strobeSandWalker(rhythm);
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,14 @@
|
||||||
*/
|
*/
|
||||||
package org.x4o.fc18;
|
package org.x4o.fc18;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.x4o.fc18.octal8.PrimordialOctal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests FourCornerRecipe methods.
|
* Tests FourCornerRecipe methods.
|
||||||
*
|
*
|
||||||
|
|
@ -30,4 +38,73 @@ package org.x4o.fc18;
|
||||||
*/
|
*/
|
||||||
public class FourCornerRecipeTest {
|
public class FourCornerRecipeTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSandWalker() throws Exception {
|
||||||
|
List<Integer> cdc = new ArrayList<>();
|
||||||
|
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||||
|
FourCornerRecipe.embedSandWalker(cdc, List.of(PrimordialOctal.PART_1));
|
||||||
|
});
|
||||||
|
List<PrimordialOctal> octalMine = new ArrayList<>();
|
||||||
|
for (int i=0;i<24;i++) {
|
||||||
|
octalMine.add(PrimordialOctal.PART_1);
|
||||||
|
}
|
||||||
|
FourCornerRecipe.embedSandWalker(cdc, octalMine);
|
||||||
|
String res = FourCornerUnicodeDisplay.text().renderFromInt18(cdc);
|
||||||
|
Assertions.assertTrue(res.endsWith("PART_1PART_1"), "missing " + res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNCRValues() throws Exception {
|
||||||
|
List<Integer> cdcX06 = new ArrayList<>();
|
||||||
|
List<Integer> cdcX18 = new ArrayList<>();
|
||||||
|
BigInteger v1 = BigInteger.valueOf(123);
|
||||||
|
FourCornerRecipe.embedNCR1632FractionX06(cdcX06, v1, BigInteger.ONE);
|
||||||
|
FourCornerRecipe.embedNCR1632FractionX18(cdcX18, v1, BigInteger.ONE);
|
||||||
|
BigInteger v2 = BigInteger.valueOf(12345);
|
||||||
|
FourCornerRecipe.embedNCR1632FractionX06(cdcX06, v2, BigInteger.ONE);
|
||||||
|
FourCornerRecipe.embedNCR1632FractionX18(cdcX18, v2, BigInteger.ONE);
|
||||||
|
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(cdcX06);
|
||||||
|
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(cdcX18);
|
||||||
|
Assertions.assertEquals(resX18, resX06);
|
||||||
|
Assertions.assertEquals("¹/₁₂₃¹/₁₂₃₄₅", resX06);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNCRCount1024() throws Exception {
|
||||||
|
List<Integer> cdcX06 = new ArrayList<>();
|
||||||
|
List<Integer> cdcX18 = new ArrayList<>();
|
||||||
|
for (int x = 1; x <= 1025; x++) {
|
||||||
|
BigInteger v = BigInteger.valueOf(x);
|
||||||
|
FourCornerRecipe.embedNCR1632FractionX06(cdcX06, v, BigInteger.ONE);
|
||||||
|
FourCornerRecipe.embedNCR1632FractionX18(cdcX18, v, BigInteger.ONE);
|
||||||
|
}
|
||||||
|
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(cdcX06);
|
||||||
|
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(cdcX18);
|
||||||
|
Assertions.assertEquals(resX18, resX06);
|
||||||
|
Assertions.assertTrue(resX06.startsWith("¹/₁¹/₂¹/₃"), "missing " + resX06);
|
||||||
|
Assertions.assertTrue(resX06.contains("¹/₅₁₂¹/₅₁₃¹/₅₁₄"), "missing " + resX06);
|
||||||
|
Assertions.assertTrue(resX06.endsWith("¹/₁₀₂₃¹/₁₀₂₄¹/₁₀₂₅"), "missing " + resX06);
|
||||||
|
Assertions.assertTrue(resX18.startsWith("¹/₁¹/₂¹/₃"), "missing " + resX18);
|
||||||
|
Assertions.assertTrue(resX18.contains("¹/₅₁₂¹/₅₁₃¹/₅₁₄"), "missing " + resX18);
|
||||||
|
Assertions.assertTrue(resX18.endsWith("¹/₁₀₂₃¹/₁₀₂₄¹/₁₀₂₅"), "missing " + resX18);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNCRMaxValue() throws Exception {
|
||||||
|
BigInteger maxValue = new BigInteger("FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
|
||||||
|
FourCornerRecipe.embedNCR1632FractionX06(maxValue, maxValue);
|
||||||
|
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||||
|
FourCornerRecipe.embedNCR1632FractionX06(maxValue.add(BigInteger.ONE), maxValue);
|
||||||
|
});
|
||||||
|
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||||
|
FourCornerRecipe.embedNCR1632FractionX06(maxValue, maxValue.add(BigInteger.ONE));
|
||||||
|
});
|
||||||
|
FourCornerRecipe.embedNCR1632FractionX18(maxValue, maxValue);
|
||||||
|
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||||
|
FourCornerRecipe.embedNCR1632FractionX18(maxValue.add(BigInteger.ONE), maxValue);
|
||||||
|
});
|
||||||
|
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||||
|
FourCornerRecipe.embedNCR1632FractionX18(maxValue, maxValue.add(BigInteger.ONE));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Aug 4, 2025
|
* @version 1.0 Aug 4, 2025
|
||||||
*/
|
*/
|
||||||
public class StenoLexerInvalidTest {
|
public class LexerInvalidTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalid18Plus() throws Exception {
|
public void testInvalid18Plus() throws Exception {
|
||||||
|
|
@ -38,7 +38,7 @@ import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Jan 14, 2025
|
* @version 1.0 Jan 14, 2025
|
||||||
*/
|
*/
|
||||||
public class StenoLexerNCRTest {
|
public class LexerNCRTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNCRSmokeSignals() throws Exception {
|
public void testNCRSmokeSignals() throws Exception {
|
||||||
|
|
@ -61,15 +61,17 @@ public class StenoLexerNCRTest {
|
||||||
Assertions.assertEquals(2, smokeReader.pipeSmokeClouds);
|
Assertions.assertEquals(2, smokeReader.pipeSmokeClouds);
|
||||||
|
|
||||||
cdc.addAll(FCDotDEC2701DashPX0.ESC_STOP.cakePointSequence()); // the print above auto value + next test (normal bank reset)
|
cdc.addAll(FCDotDEC2701DashPX0.ESC_STOP.cakePointSequence()); // the print above auto value + next test (normal bank reset)
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 11);
|
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() - 1 + 11);
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + (512*3) + 12);
|
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + (512*3) + 12);
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + (512*4) + 13);
|
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + (512*4) + 13);
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + (512*5) + 14);
|
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + (512*5) + 14);
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart()); // and one which prints
|
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart()); // and one which prints
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 123); // normal NXX_123
|
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStop());
|
||||||
|
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStop()); // embedded bank reset
|
||||||
|
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() - 1 + 123); // normal NXX_123
|
||||||
smokeReader.reset();
|
smokeReader.reset();
|
||||||
lexer.read(cdc);
|
lexer.read(cdc);
|
||||||
String res = "[0:1:burnNCR1632MissingBankSparkler][0:8:burnNCR1632MissingBankSparkler]¹³⁷⁴³⁸⁹⁵³⁵⁹⁴/₁₃₄₂₁₇₇₃₉[0:16:burnNCR1632MissingBankSparkler]";
|
String res = "[0:1:burnNCR1632MissingBankSparkler]¹²³/₁₃₄₂₁₇₇₂₉[0:8:burnNCR1632MissingBankSparkler]⁴⁹³⁴⁷⁴⁵⁶²⁴⁴¹²¹⁷/₁₆₁₀₆₁₂₇₄₇²⁴⁶⁸⁴⁷³³⁴²⁸²⁷²⁷³⁷⁶⁷⁶⁷⁴¹⁵⁶⁰²⁰³³²⁸⁰⁶⁹¹⁶¹⁷⁰⁹³⁹⁸³¹⁸⁴⁹⁹⁸⁵³⁵⁵³⁹²³⁰⁹⁰¹⁶⁸⁶⁴⁶⁵⁷⁸⁵²¹³⁷⁴⁵⁶⁷²¹¹⁷²⁴⁹³⁷⁶⁸⁴⁰⁴²⁰³⁰⁴⁶⁶⁷³⁵²³⁶³⁴⁷⁴⁰¹²²⁰¹⁵⁶⁷²⁰⁴¹⁹⁴³⁹⁹⁴⁷⁴¹²⁰⁸³⁶⁵¹⁰⁵⁷⁸²⁹¹⁵¹⁷⁷⁰⁹⁷⁸²⁸²³⁰¹⁹⁶⁴⁹⁵⁴⁶⁸⁴⁶³³¹/₁";
|
||||||
Assertions.assertEquals(res, FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
Assertions.assertEquals(res, FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,23 +80,17 @@ public class StenoLexerNCRTest {
|
||||||
List<Integer> cdc = new ArrayList<>();
|
List<Integer> cdc = new ArrayList<>();
|
||||||
cdc.add(FCDotCDC1604DashP6.NX24_X.ordinal()); // = X
|
cdc.add(FCDotCDC1604DashP6.NX24_X.ordinal()); // = X
|
||||||
cdc.add(FCDotCDC1604DashP6.NY09_EQUALS.ordinal());
|
cdc.add(FCDotCDC1604DashP6.NY09_EQUALS.ordinal());
|
||||||
|
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() - 1 + 11); // NXX_011
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 11);
|
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart()); // T001
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 1);
|
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart()); // NXX_001
|
||||||
|
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() - 1 + 15); // T015
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 1);
|
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() - 1 + 14); // NXX_014
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 1);
|
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() - 1 + 1); // one
|
||||||
|
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 512 + 2); // T1024 + one
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 14);
|
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() - 1 + 123); // NXX_123
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 15);
|
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() - 1 + 4); // NXX_004 (/1 as above 123 resets bank)
|
||||||
|
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 123);
|
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 512 + 2); // 1024
|
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 1); // +1 = 1025
|
|
||||||
|
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 4);
|
|
||||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 1);
|
|
||||||
cdc.add(FCDotCDC1604DashP6.NY14_SEMICOLON.ordinal());
|
cdc.add(FCDotCDC1604DashP6.NY14_SEMICOLON.ordinal());
|
||||||
|
//cdc.add(FCDotCDC1604DashP6._NEWLINE.ordinal());
|
||||||
|
|
||||||
Assertions.assertEquals("X=¹¹/₁¹/₁¹⁴/₁₅¹²³/₁₀₂₅⁴/₁;", FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
Assertions.assertEquals("X=¹¹/₁¹/₁¹⁴/₁₅¹²³/₁₀₂₅⁴/₁;", FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||||
}
|
}
|
||||||
|
|
@ -102,14 +98,14 @@ public class StenoLexerNCRTest {
|
||||||
@Test
|
@Test
|
||||||
public void testNCRLargestF576() throws Exception {
|
public void testNCRLargestF576() throws Exception {
|
||||||
List<Integer> cdc = new ArrayList<>();
|
List<Integer> cdc = new ArrayList<>();
|
||||||
for (int i = FourCornerDotCake.FC_NCR1632_NUM.getStop(); i >= FourCornerDotCake.FC_NCR1632_NUM.getStart(); i = i - 512) {
|
|
||||||
cdc.add(i);
|
|
||||||
}
|
|
||||||
for (int i = FourCornerDotCake.FC_NCR1632_DEN.getStop(); i >= FourCornerDotCake.FC_NCR1632_DEN.getStart(); i = i - 512) {
|
for (int i = FourCornerDotCake.FC_NCR1632_DEN.getStop(); i >= FourCornerDotCake.FC_NCR1632_DEN.getStart(); i = i - 512) {
|
||||||
cdc.add(i);
|
cdc.add(i);
|
||||||
}
|
}
|
||||||
String resSuper = "²⁴⁷³³⁰⁴⁰¹⁴⁷³¹⁰⁴⁵³⁴⁰⁶⁰⁵⁰²⁵²¹⁰¹⁹⁶⁴⁷¹⁹⁰⁰³⁵¹³¹³⁴⁹¹⁰¹²¹¹⁸³⁹⁹¹⁴⁰⁶³⁰⁵⁶⁰⁹²⁸⁹⁷²²⁵¹⁰⁶⁵³¹⁸⁶⁷¹⁷⁰³¹⁶⁴⁰¹⁰⁶¹²⁴³⁰⁴⁴⁹⁸⁹⁵⁹⁷⁶⁷¹⁴²⁶⁰¹⁶¹³⁹³³⁹³⁵¹³⁶⁵⁰³⁴³⁰⁶⁷⁵¹²⁰⁹⁹⁶⁷⁵⁴⁶¹⁵⁵¹⁰¹⁸⁹³¹⁶⁷⁹¹⁶⁶⁰⁶⁷⁷²¹⁴⁸⁶⁹⁹¹³⁵";
|
for (int i = FourCornerDotCake.FC_NCR1632_NUM.getStop(); i >= FourCornerDotCake.FC_NCR1632_NUM.getStart(); i = i - 512) {
|
||||||
String resSuber = "₂₄₇₃₃₀₄₀₁₄₇₃₁₀₄₅₃₄₀₆₀₅₀₂₅₂₁₀₁₉₆₄₇₁₉₀₀₃₅₁₃₁₃₄₉₁₀₁₂₁₁₈₃₉₉₁₄₀₆₃₀₅₆₀₉₂₈₉₇₂₂₅₁₀₆₅₃₁₈₆₇₁₇₀₃₁₆₄₀₁₀₆₁₂₄₃₀₄₄₉₈₉₅₉₇₆₇₁₄₂₆₀₁₆₁₃₉₃₃₉₃₅₁₃₆₅₀₃₄₃₀₆₇₅₁₂₀₉₉₆₇₅₄₆₁₅₅₁₀₁₈₉₃₁₆₇₉₁₆₆₀₆₇₇₂₁₄₈₆₉₉₁₃₅";
|
cdc.add(i);
|
||||||
|
}
|
||||||
|
String resSuper = "²⁴⁷³³⁰⁴⁰¹⁴⁷³¹⁰⁴⁵³⁴⁰⁶⁰⁵⁰²⁵²¹⁰¹⁹⁶⁴⁷¹⁹⁰⁰³⁵¹³¹³⁴⁹¹⁰¹²¹¹⁸³⁹⁹¹⁴⁰⁶³⁰⁵⁶⁰⁹²⁸⁹⁷²²⁵¹⁰⁶⁵³¹⁸⁶⁷¹⁷⁰³¹⁶⁴⁰¹⁰⁶¹²⁴³⁰⁴⁴⁹⁸⁹⁵⁹⁷⁶⁷¹⁴²⁶⁰¹⁶¹³⁹³³⁹³⁵¹³⁶⁵⁰³⁴³⁰⁶⁷⁵¹²⁰⁹⁹⁶⁷⁵⁴⁶¹⁵⁵¹⁰¹⁸⁹³¹⁶⁷⁹¹⁶⁶⁰⁶⁷⁷²¹⁴⁸⁶⁹⁹¹³⁶";
|
||||||
|
String resSuber = "₂₄₇₃₃₀₄₀₁₄₇₃₁₀₄₅₃₄₀₆₀₅₀₂₅₂₁₀₁₉₆₄₇₁₉₀₀₃₅₁₃₁₃₄₉₁₀₁₂₁₁₈₃₉₉₁₄₀₆₃₀₅₆₀₉₂₈₉₇₂₂₅₁₀₆₅₃₁₈₆₇₁₇₀₃₁₆₄₀₁₀₆₁₂₄₃₀₄₄₉₈₉₅₉₇₆₇₁₄₂₆₀₁₆₁₃₉₃₃₉₃₅₁₃₆₅₀₃₄₃₀₆₇₅₁₂₀₉₉₆₇₅₄₆₁₅₅₁₀₁₈₉₃₁₆₇₉₁₆₆₀₆₇₇₂₁₄₈₆₉₉₁₃₆";
|
||||||
Assertions.assertEquals(resSuper + "/" + resSuber, FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
Assertions.assertEquals(resSuper + "/" + resSuber, FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,120 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2004-2014, Willem Cazander
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 org.x4o.fc18.zion7;
|
|
||||||
|
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Assertions;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.x4o.fc18.FourCornerUnicodeDisplay;
|
|
||||||
import org.x4o.fc18.octal8.PrimordialOctal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests four corner grapher parts.
|
|
||||||
*
|
|
||||||
* @author Willem Cazander
|
|
||||||
* @version 1.0 Aug 24, 2025
|
|
||||||
*/
|
|
||||||
public class StenoGrapherTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSandWalker() throws Exception {
|
|
||||||
List<Integer> out = new ArrayList<>();
|
|
||||||
FourCornerZion7Candlelier writerX06 = FourCornerZionStenoGrapher.writerX06(out);
|
|
||||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
|
||||||
writerX06.strobeSandWalker(List.of(PrimordialOctal.PART_1));
|
|
||||||
});
|
|
||||||
List<PrimordialOctal> octalMine = new ArrayList<>();
|
|
||||||
for (int i=0;i<24;i++) {
|
|
||||||
octalMine.add(PrimordialOctal.PART_1);
|
|
||||||
}
|
|
||||||
writerX06.strobeSandWalker(octalMine);
|
|
||||||
String res = FourCornerUnicodeDisplay.text().renderFromInt18(out);
|
|
||||||
Assertions.assertTrue(res.endsWith("PART_1PART_1"), "missing " + res);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testNCRValues() throws Exception {
|
|
||||||
List<Integer> outX06 = new ArrayList<>();
|
|
||||||
List<Integer> outX18 = new ArrayList<>();
|
|
||||||
FourCornerZion7Candlelier writerX06 = FourCornerZionStenoGrapher.writerX06(outX06);
|
|
||||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
|
||||||
BigInteger v1 = BigInteger.valueOf(123);
|
|
||||||
writerX06.strobeNCR1632(BigInteger.ONE, v1);
|
|
||||||
writerX18.strobeNCR1632(BigInteger.ONE, v1);
|
|
||||||
BigInteger v2 = BigInteger.valueOf(12345);
|
|
||||||
writerX06.strobeNCR1632(BigInteger.ONE, v2);
|
|
||||||
writerX18.strobeNCR1632(BigInteger.ONE, v2);
|
|
||||||
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(outX06);
|
|
||||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
|
||||||
Assertions.assertEquals(resX18, resX06);
|
|
||||||
Assertions.assertEquals("¹/₁₂₃¹/₁₂₃₄₅", resX06);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testNCRCount1024() throws Exception {
|
|
||||||
List<Integer> outX06 = new ArrayList<>();
|
|
||||||
List<Integer> outX18 = new ArrayList<>();
|
|
||||||
FourCornerZion7Candlelier writerX06 = FourCornerZionStenoGrapher.writerX06(outX06);
|
|
||||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
|
||||||
for (int x = 1; x <= 1025; x++) {
|
|
||||||
BigInteger v = BigInteger.valueOf(x);
|
|
||||||
writerX06.strobeNCR1632(BigInteger.ONE, v);
|
|
||||||
writerX18.strobeNCR1632(BigInteger.ONE, v);
|
|
||||||
}
|
|
||||||
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(outX06);
|
|
||||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
|
||||||
Assertions.assertEquals(resX18, resX06);
|
|
||||||
Assertions.assertTrue(resX06.startsWith("¹/₁¹/₂¹/₃"), "missing " + resX06);
|
|
||||||
Assertions.assertTrue(resX06.contains("¹/₅₁₂¹/₅₁₃¹/₅₁₄"), "missing " + resX06);
|
|
||||||
Assertions.assertTrue(resX06.endsWith("¹/₁₀₂₃¹/₁₀₂₄¹/₁₀₂₅"), "missing " + resX06);
|
|
||||||
Assertions.assertTrue(resX18.startsWith("¹/₁¹/₂¹/₃"), "missing " + resX18);
|
|
||||||
Assertions.assertTrue(resX18.contains("¹/₅₁₂¹/₅₁₃¹/₅₁₄"), "missing " + resX18);
|
|
||||||
Assertions.assertTrue(resX18.endsWith("¹/₁₀₂₃¹/₁₀₂₄¹/₁₀₂₅"), "missing " + resX18);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testNCRMaxValue() throws Exception {
|
|
||||||
List<Integer> outX06 = new ArrayList<>();
|
|
||||||
List<Integer> outX18 = new ArrayList<>();
|
|
||||||
FourCornerZion7Candlelier writerX06 = FourCornerZionStenoGrapher.writerX06(outX06);
|
|
||||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
|
||||||
BigInteger maxValue = new BigInteger("FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
|
|
||||||
writerX06.strobeNCR1632(maxValue, maxValue);
|
|
||||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
|
||||||
writerX06.strobeNCR1632(maxValue, maxValue.add(BigInteger.ONE));
|
|
||||||
});
|
|
||||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
|
||||||
writerX06.strobeNCR1632(maxValue.add(BigInteger.ONE), maxValue);
|
|
||||||
});
|
|
||||||
writerX18.strobeNCR1632(maxValue, maxValue);
|
|
||||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
|
||||||
writerX18.strobeNCR1632(maxValue, maxValue.add(BigInteger.ONE));
|
|
||||||
});
|
|
||||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
|
||||||
writerX18.strobeNCR1632(maxValue.add(BigInteger.ONE), maxValue);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue