From 586b5f9fe397f08133d23800869e044103198bcf Mon Sep 17 00:00:00 2001 From: Willem Date: Sun, 24 Aug 2025 19:43:18 +0200 Subject: [PATCH] FC18: Changed candlelier interface --- .../src/main/java/org/x4o/fc18/FourCornerRecipe.java | 11 ++++------- .../java/org/x4o/fc18/FourCornerUnicodeDisplay.java | 2 +- .../fc18/cake2/zero33/dec1/FCDotDEC2701DashPX0.java | 10 ++++++++++ .../x4o/fc18/zion7/FourCornerZion7AlphaOmega.java | 4 ++-- .../x4o/fc18/zion7/FourCornerZion7Candlelier.java | 8 ++++++-- .../x4o/fc18/zion7/FourCornerZionStenoGrapher.java | 12 ++++++++---- .../org/x4o/fc18/zion7/FourCornerZionStenoLexer.java | 11 ++--------- .../test/java/org/x4o/fc18/FourCornerRecipeTest.java | 4 ++-- 8 files changed, 35 insertions(+), 27 deletions(-) diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerRecipe.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerRecipe.java index f3ae205..0511c06 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerRecipe.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerRecipe.java @@ -30,9 +30,6 @@ import java.util.Objects; 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.FCDotPIE9CDash11; import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash20; @@ -98,11 +95,11 @@ final public class FourCornerRecipe { return out; } - static public List embedSandWalker(List rhythm) { - return embedSandWalker(new ArrayList<>(), rhythm); + static public List embedSandWalkerX06(List rhythm) { + return embedSandWalkerX06(new ArrayList<>(), rhythm); } - static public List embedSandWalker(List out, List rhythm) { + static public List embedSandWalkerX06(List out, List 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()); @@ -266,7 +263,7 @@ final public class FourCornerRecipe { if (denominator.equals(BigInteger.ZERO)) { throw new IllegalArgumentException("The denominator value ZERO is not allowed."); } - if (numerator.equals(BigInteger.ZERO)) { + if (numerator.equals(BigInteger.ZERO)) { // TODO: rm this and make both zero based, 0/1 = zero throw new IllegalArgumentException("The numerator value ZERO is not allowed."); } //if (denominator.signum() == -1) { diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerUnicodeDisplay.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerUnicodeDisplay.java index 23f1d99..616fabf 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerUnicodeDisplay.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerUnicodeDisplay.java @@ -135,7 +135,7 @@ public class FourCornerUnicodeDisplay { lexer.withSmokeSignals(printer).read(chars); } - private final class StenoUnicodePrinter implements FourCornerZion7Candlelier, FourCornerZionStenoLexerSmoke.AdapterMonoPipe { + private final class StenoUnicodePrinter implements FourCornerZion7Candlelier.Adapter, FourCornerZionStenoLexerSmoke.AdapterMonoPipe { private final StringBuilder output; private boolean wasExternalWord = false; diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/cake2/zero33/dec1/FCDotDEC2701DashPX0.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/cake2/zero33/dec1/FCDotDEC2701DashPX0.java index c57bae5..44892d1 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/cake2/zero33/dec1/FCDotDEC2701DashPX0.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/cake2/zero33/dec1/FCDotDEC2701DashPX0.java @@ -69,6 +69,16 @@ public enum FCDotDEC2701DashPX0 implements FourCornerX06BaklavaPointSequence, Fo __ESC_RESERVED_A8, /// _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, // =========== Internal escape sequence, to embed symbols,fractions and adult texts. diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7AlphaOmega.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7AlphaOmega.java index 3a93c6e..1add7a1 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7AlphaOmega.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7AlphaOmega.java @@ -26,13 +26,13 @@ package org.x4o.fc18.zion7; /// /// @author Willem Cazander /// @version 1.0 Jan 11, 2025 -public interface FourCornerZion7AlphaOmega extends FourCornerZion7Candlelier { +public interface FourCornerZion7AlphaOmega { void strobeDocumentAlpha(); void strobeDocumentOmega(); - interface Adapter extends FourCornerZion7AlphaOmega, FourCornerZion7Candlelier.Adapter { + interface Adapter extends FourCornerZion7AlphaOmega { @Override default void strobeDocumentAlpha() { diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7Candlelier.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7Candlelier.java index 7d7606e..00b9cb4 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7Candlelier.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7Candlelier.java @@ -31,7 +31,7 @@ import org.x4o.fc18.octal8.PrimordialOctal; /// /// @author Willem Cazander /// @version 1.0 Jan 09, 2025 -public interface FourCornerZion7Candlelier { +public interface FourCornerZion7Candlelier extends FourCornerZion7AlphaOmega { /// Single word cake point. void strobeWord(int cakePoint); @@ -39,6 +39,10 @@ public interface FourCornerZion7Candlelier { /// Block of word cake points. void strobeWords(List cakePoints); + //void strobeWordGrams(int gramBase, List values); + //void strobeWordDozimal(BigDecimal value); + //void strobeWordDozeger(BigInteger value); // up to 192 bit integer + /// 1152 bit fractions of two 576 bit numbers. void strobeNCR1632(BigInteger denominator, BigInteger numerator); @@ -51,7 +55,7 @@ public interface FourCornerZion7Candlelier { /// Handles the lexer salah sequence strobes void strobeSalahSequence(FourCornerZion7SalahSequence type, List> arguments); - interface Adapter extends FourCornerZion7Candlelier { + interface Adapter extends FourCornerZion7Candlelier, FourCornerZion7AlphaOmega.Adapter { @Override default void strobeWord(int cakePoint) { diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoGrapher.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoGrapher.java index 5ac588c..e19ab4f 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoGrapher.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoGrapher.java @@ -36,15 +36,15 @@ import org.x4o.fc18.octal8.PrimordialOctalOrangeJuice; /// @version 1.0 Jan 11, 2025 public class FourCornerZionStenoGrapher { - static public FourCornerWriter writerX06(List out) { + static public FourCornerZion7Candlelier writerX06(List out) { return new FourCornerWriter(out, true); } - static public FourCornerWriter writerX18(List out) { + static public FourCornerZion7TempleScrolls writerX18(List out) { return new FourCornerWriter(out, false); } - static public final class FourCornerWriter implements FourCornerZion7AlphaOmega,FourCornerZion7TempleScrolls { + static public final class FourCornerWriter implements FourCornerZion7Candlelier,FourCornerZion7TempleScrolls { private final List out; private final boolean isSixBit; @@ -92,7 +92,11 @@ public class FourCornerZionStenoGrapher { @Override public void strobeSandWalker(List rhythm) { - FourCornerRecipe.embedSandWalker(out, rhythm); + //if (isSixBit) { + FourCornerRecipe.embedSandWalkerX06(out, rhythm); + //} else { + // FourCornerRecipe.embedSandWalkerX18(out, rhythm); // mmm bring back... + //} } @Override diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexer.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexer.java index e968f99..7ed1be9 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexer.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexer.java @@ -46,13 +46,11 @@ import org.x4o.fc18.octal8.PrimordialOctal; /// @version 1.0 Jan 09, 2025 public class FourCornerZionStenoLexer { - private final static FourCornerZion7AlphaOmega CLEAN_BIBLE = new FourCornerZion7AlphaOmega.Adapter() {}; private final static FourCornerZionStenoLexerFire CLEAN_FIRE = new FourCornerZionStenoLexerFire.Adapter() {}; private final static FourCornerZionStenoLexerSmoke CLEAN_SMOKE = new FourCornerZionStenoLexerSmoke.Adapter() {}; private final static List CAKE_SLICE_EATERS = new ArrayList<>(); private final boolean handlerEscape; private final FourCornerZion7Candlelier handler; - private final FourCornerZion7AlphaOmega handlerDocument; private final FourCornerZion7TempleScrolls handlerTempleScrolls; private final int denominatorBank[] = new int[64]; // <== is the terminator select are 6 bit of banks with 9 bit of values. private final int numeratorBank[] = new int[denominatorBank.length]; @@ -110,11 +108,6 @@ public class FourCornerZionStenoLexer { public FourCornerZionStenoLexer(FourCornerZion7Candlelier handler, boolean handlerEscape) { this.handler = Objects.requireNonNull(handler); this.handlerEscape = handlerEscape; - if (handler instanceof FourCornerZion7AlphaOmega) { - this.handlerDocument = FourCornerZion7AlphaOmega.class.cast(handler); - } else { - this.handlerDocument = CLEAN_BIBLE; - } if (handler instanceof FourCornerZion7TempleScrolls) { this.handlerTempleScrolls = FourCornerZion7TempleScrolls.class.cast(handler); } else { @@ -151,7 +144,7 @@ public class FourCornerZionStenoLexer { currLine = 0; currCol = 0; // allow reuse of lexer decModeReset(); - handlerDocument.strobeDocumentAlpha(); + handler.strobeDocumentAlpha(); do { ScanResult run = readTokens(); if (run.isEOF()) { @@ -161,7 +154,7 @@ public class FourCornerZionStenoLexer { smokeSignals.burnLexerReservedCakePoint(currLine, currCol, input.get(inputIndex)); } } while (safeNext()); - handlerDocument.strobeDocumentOmega(); + handler.strobeDocumentOmega(); } private ScanResult readTokens() { diff --git a/nx01-x4o-fc18/src/test/java/org/x4o/fc18/FourCornerRecipeTest.java b/nx01-x4o-fc18/src/test/java/org/x4o/fc18/FourCornerRecipeTest.java index b656884..a3f1b91 100644 --- a/nx01-x4o-fc18/src/test/java/org/x4o/fc18/FourCornerRecipeTest.java +++ b/nx01-x4o-fc18/src/test/java/org/x4o/fc18/FourCornerRecipeTest.java @@ -42,13 +42,13 @@ public class FourCornerRecipeTest { public void testSandWalker() throws Exception { List cdc = new ArrayList<>(); Assertions.assertThrows(IllegalArgumentException.class, () -> { - FourCornerRecipe.embedSandWalker(cdc, List.of(PrimordialOctal.PART_1)); + FourCornerRecipe.embedSandWalkerX06(cdc, List.of(PrimordialOctal.PART_1)); }); List octalMine = new ArrayList<>(); for (int i=0;i<24;i++) { octalMine.add(PrimordialOctal.PART_1); } - FourCornerRecipe.embedSandWalker(cdc, octalMine); + FourCornerRecipe.embedSandWalkerX06(cdc, octalMine); String res = FourCornerUnicodeDisplay.text().renderFromInt18(cdc); Assertions.assertTrue(res.endsWith("PART_1PART_1"), "missing " + res); }