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 eaa095f..9676435 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 @@ -204,14 +204,16 @@ public class FourCornerZionStenoLexer { return true; } - private void ncrBankReset() { + private void ncrBankReset(boolean magic) { + fireSignals.fireStateNCR1632BankReset(magic); for (int i = 0; i < denominatorBank.length; i++) { denominatorBank[i] = 0; numeratorBank[i] = 0; } } - private void ncrBankFire() { + private void ncrBankFire(boolean magic) { + fireSignals.fireStateNCR1632BankSparkler(magic); BigInteger denominator = BigInteger.ONE; for (int i = 0; i < denominatorBank.length; i++) { denominator = denominator.add(BigInteger.valueOf(denominatorBank[i]).shiftLeft(i * 9)); @@ -310,7 +312,7 @@ public class FourCornerZionStenoLexer { @Override public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) { - lexer.ncrBankReset(); + lexer.ncrBankReset(false); boolean magicSparkler = true; boolean requestBankReset = false; for (int i = idxFirst; i <= idxLast; i++) { @@ -323,13 +325,11 @@ public class FourCornerZionStenoLexer { } int numeratorX = cakePoint - FourCornerDotCake.FC_NCR1632_XN.getStart(); lexer.numeratorBank[numeratorX / 512] = numeratorX % 512; - - // highest number, 1st select + enable request, if second than reset bank + // 1st select + enable request, if second than reset bank if (cakePoint == FourCornerDotCake.FC_NCR1632_XN.getStop()) { if (requestBankReset) { requestBankReset = false; - lexer.fireSignals.fireStateNCR1632BankReset(); - lexer.ncrBankReset(); + lexer.ncrBankReset(true); magicSparkler = false; // if block ends with bank reset, don't leak a sparkler continue; } @@ -337,17 +337,15 @@ public class FourCornerZionStenoLexer { } else { requestBankReset = false; } - if (cakePoint > FourCornerDotCake.FC_NCR1632_XN.getStart() + 512) { magicSparkler = true; continue; // Only fire fraction on lowest value select } else - lexer.ncrBankFire(); + lexer.ncrBankFire(false); magicSparkler = false; } if (magicSparkler) { - lexer.fireSignals.fireStateNCR1632BankSparkler(); - lexer.ncrBankFire(); + lexer.ncrBankFire(true); } } } diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexerFire.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexerFire.java index 1e8b14b..0e63e0b 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexerFire.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexerFire.java @@ -34,9 +34,9 @@ public interface FourCornerZionStenoLexerFire { void fireStateScanner(int blockStart, int blockStop, int cakePoint); - void fireStateNCR1632BankSparkler(); + void fireStateNCR1632BankSparkler(boolean magic); - void fireStateNCR1632BankReset(); + void fireStateNCR1632BankReset(boolean magic); interface Adapter extends FourCornerZionStenoLexerFire { @@ -53,11 +53,11 @@ public interface FourCornerZionStenoLexerFire { } @Override - default void fireStateNCR1632BankSparkler() { + default void fireStateNCR1632BankSparkler(boolean magic) { } @Override - default void fireStateNCR1632BankReset() { + default void fireStateNCR1632BankReset(boolean magic) { } } } diff --git a/nx01-x4o-fc18/src/test/java/org/x4o/fc18/zion7/TestFireWalker.java b/nx01-x4o-fc18/src/test/java/org/x4o/fc18/zion7/TestFireWalker.java index db8edf0..8d9da92 100644 --- a/nx01-x4o-fc18/src/test/java/org/x4o/fc18/zion7/TestFireWalker.java +++ b/nx01-x4o-fc18/src/test/java/org/x4o/fc18/zion7/TestFireWalker.java @@ -68,12 +68,16 @@ public class TestFireWalker implements FourCornerZionStenoLexerFire.Adapter { } @Override - public void fireStateNCR1632BankSparkler() { - ncr1632BankSparkler++; + public void fireStateNCR1632BankSparkler(boolean magic) { + if (magic) { + ncr1632BankSparkler++; + } } @Override - public void fireStateNCR1632BankReset() { - ncr1632BankReset++; + public void fireStateNCR1632BankReset(boolean magic) { + if (magic) { + ncr1632BankReset++; + } } }