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 64664ec..03119c6 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 @@ -98,11 +98,11 @@ final public class FourCornerRecipe { return out; } - static public List embedSandWalkerX06(List rhythm) { - return embedSandWalkerX06(new ArrayList<>(), rhythm); + static public List embedSandWalker(List rhythm) { + return embedSandWalker(new ArrayList<>(), rhythm); } - static public List embedSandWalkerX06(List out, List rhythm) { + static public List embedSandWalker(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()); @@ -307,52 +307,99 @@ final public class FourCornerRecipe { return out; } - static public List toScriptSuper(int value) { - return toScript(new ArrayList<>(), Integer.toString(value), 0); + static public List toScriptSuperX06(int value) { + return toScript(new ArrayList<>(), Integer.toString(value), 0, true); } - static public List toScriptSub(int value) { - return toScript(new ArrayList<>(), Integer.toString(value), 10); + static public List toScriptSubX06(int value) { + return toScript(new ArrayList<>(), Integer.toString(value), 10, true); } - static public List toScriptSuper(BigInteger value) { - return toScript(new ArrayList<>(), value.toString(10), 0); + static public List toScriptSuperX06(BigInteger value) { + return toScript(new ArrayList<>(), value.toString(10), 0, true); } - static public List toScriptSub(BigInteger value) { - return toScript(new ArrayList<>(), value.toString(10), 10); + static public List toScriptSubX06(BigInteger value) { + return toScript(new ArrayList<>(), value.toString(10), 10, true); } - static public void toScriptSuper(List out, int value) { - toScript(out, Integer.toString(value), 0); + static public void toScriptSuperX06(List out, int value) { + toScript(out, Integer.toString(value), 0, true); } - static public void toScriptSub(List out, int value) { - toScript(out, Integer.toString(value), 10); + static public void toScriptSubX06(List out, int value) { + toScript(out, Integer.toString(value), 10, true); } - static public void toScriptSuper(List out, BigInteger value) { - toScript(out, value.toString(10), 0); + static public void toScriptSuperX06(List out, BigInteger value) { + toScript(out, value.toString(10), 0, true); } - static public void toScriptSub(List out, BigInteger value) { - toScript(out, value.toString(10), 10); + static public void toScriptSubX06(List out, BigInteger value) { + toScript(out, value.toString(10), 10, true); } - static private List toScript(List out, String value, int off) { + static public List toScriptSuperX18(int value) { + return toScript(new ArrayList<>(), Integer.toString(value), 0, false); + } + + static public List toScriptSubX18(int value) { + return toScript(new ArrayList<>(), Integer.toString(value), 10, false); + } + + static public List toScriptSuperX18(BigInteger value) { + return toScript(new ArrayList<>(), value.toString(10), 0, false); + } + + static public List toScriptSubX18(BigInteger value) { + return toScript(new ArrayList<>(), value.toString(10), 10, false); + } + + static public void toScriptSuperX18(List out, int value) { + toScript(out, Integer.toString(value), 0, false); + } + + static public void toScriptSubX18(List out, int value) { + toScript(out, Integer.toString(value), 10, false); + } + + static public void toScriptSuperX18(List out, BigInteger value) { + toScript(out, value.toString(10), 0, false); + } + + static public void toScriptSubX18(List out, BigInteger value) { + toScript(out, value.toString(10), 10, false); + } + + static private List toScript(List out, String value, int off, boolean isSixBit) { PrimitiveIterator.OfInt i = value.codePoints().iterator(); while (i.hasNext()) { int chr = i.nextInt(); if (chr == '-') { if (off == 0) { - out.add(FCDotPIE9CDash11.NXX_03.cakePointDotIndex()); + if (isSixBit) { + out.addAll(FCDotPIE9CDash11.NXX_03.baklavaPointSequence()); + } else { + out.add(FCDotPIE9CDash11.NXX_03.cakePointDotIndex()); + } } else { - out.add(FCDotPIE9CDash11.NXX_08.cakePointDotIndex()); + if (isSixBit) { + out.addAll(FCDotPIE9CDash11.NXX_08.baklavaPointSequence()); + } else { + out.add(FCDotPIE9CDash11.NXX_08.cakePointDotIndex()); + } } continue; } int num = chr - '0'; - out.add(FCDotPIE9CDash20.valueOf(num + off).cakePointDotIndex()); + if (isSixBit) { + out.addAll(FCDotPIE9CDash20.valueOf(num + off).baklavaPointSequence()); + } else { + out.add(FCDotPIE9CDash20.valueOf(num + off).cakePointDotIndex()); + } + } + if (isSixBit) { + out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex()); // fixme improve: see FourCornerDotCollePie9.baklavaPointsPIE9C } return out; } 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 5445082..6140f0e 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 @@ -233,9 +233,9 @@ public class FourCornerUnicodeDisplay { @Override public void strobeNCR1632(BigInteger denominator, BigInteger numerator) { List math = new ArrayList<>(); - FourCornerRecipe.toScriptSuper(math, numerator); + FourCornerRecipe.toScriptSuperX18(math, numerator); math.add(FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.ordinal()); - FourCornerRecipe.toScriptSub(math, denominator); + FourCornerRecipe.toScriptSubX18(math, denominator); renderFromInt18(math, output); } 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 a484e27..5ac588c 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 @@ -92,7 +92,7 @@ public class FourCornerZionStenoGrapher { @Override public void strobeSandWalker(List rhythm) { - FourCornerRecipe.embedSandWalkerX06(out, rhythm); + FourCornerRecipe.embedSandWalker(out, rhythm); } @Override 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 a3f1b91..b656884 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.embedSandWalkerX06(cdc, List.of(PrimordialOctal.PART_1)); + FourCornerRecipe.embedSandWalker(cdc, List.of(PrimordialOctal.PART_1)); }); List octalMine = new ArrayList<>(); for (int i=0;i<24;i++) { octalMine.add(PrimordialOctal.PART_1); } - FourCornerRecipe.embedSandWalkerX06(cdc, octalMine); + FourCornerRecipe.embedSandWalker(cdc, octalMine); String res = FourCornerUnicodeDisplay.text().renderFromInt18(cdc); Assertions.assertTrue(res.endsWith("PART_1PART_1"), "missing " + res); }