FC18: Use octal enum for sand walker and worm data

This commit is contained in:
Willem Cazander 2025-08-02 23:58:05 +02:00
parent c799b00eaf
commit 144d331f88
4 changed files with 21 additions and 16 deletions

View file

@ -36,6 +36,7 @@ import org.x4o.fc18.cake2.FourCornerX08MuffinPointSequence;
import org.x4o.fc18.cake2.FourCornerX18CakePointSequence; import org.x4o.fc18.cake2.FourCornerX18CakePointSequence;
import org.x4o.fc18.cake2.pie9d.FCDotPIE9DDash09; import org.x4o.fc18.cake2.pie9d.FCDotPIE9DDash09;
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6; import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
import org.x4o.fc18.octal8.PrimordialOctal;
import org.x4o.fc18.zion7.FourCornerZion7Candlelier; import org.x4o.fc18.zion7.FourCornerZion7Candlelier;
import org.x4o.fc18.zion7.FourCornerZion7WaterCodex; import org.x4o.fc18.zion7.FourCornerZion7WaterCodex;
import org.x4o.fc18.zion7.FourCornerZionStenoLexer; import org.x4o.fc18.zion7.FourCornerZionStenoLexer;
@ -240,11 +241,11 @@ public class FourCornerUnicodeDisplay {
} }
@Override @Override
public void strobeSandWalker(List<Integer> rhythm) { public void strobeSandWalker(List<PrimordialOctal> rhythm) {
} }
@Override @Override
public void strobeSandWorm(List<Integer> spice) { public void strobeSandWorm(List<PrimordialOctal> spice) {
} }
@Override @Override

View file

@ -25,6 +25,8 @@ package org.x4o.fc18.zion7;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.List; import java.util.List;
import org.x4o.fc18.octal8.PrimordialOctal;
/// Handles the main lexer four corner cake strobes. /// Handles the main lexer four corner cake strobes.
/// ///
/// @author Willem Cazander /// @author Willem Cazander
@ -44,10 +46,10 @@ public interface FourCornerZion7Candlelier {
void strobeRecursiveCake(List<Integer> cakePoints); void strobeRecursiveCake(List<Integer> cakePoints);
/// 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<Integer> rhythm); void strobeSandWalker(List<PrimordialOctal> rhythm);
/// Octal sand worm spice /// Octal sand worm spice
void strobeSandWorm(List<Integer> spice); void strobeSandWorm(List<PrimordialOctal> spice);
interface Adapter extends FourCornerZion7Candlelier { interface Adapter extends FourCornerZion7Candlelier {
@ -68,11 +70,11 @@ public interface FourCornerZion7Candlelier {
} }
@Override @Override
default void strobeSandWalker(List<Integer> rhythm) { default void strobeSandWalker(List<PrimordialOctal> rhythm) {
} }
@Override @Override
default void strobeSandWorm(List<Integer> spice) { default void strobeSandWorm(List<PrimordialOctal> spice) {
} }
} }
} }

View file

@ -27,6 +27,7 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0; import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
import org.x4o.fc18.octal8.PrimordialOctal;
/// Write steno for zion. /// Write steno for zion.
/// ///
@ -69,11 +70,11 @@ public class FourCornerZionStenoGrapher {
} }
@Override @Override
public void strobeSandWalker(List<Integer> rhythm) { public void strobeSandWalker(List<PrimordialOctal> rhythm) {
} }
@Override @Override
public void strobeSandWorm(List<Integer> spice) { public void strobeSandWorm(List<PrimordialOctal> spice) {
} }
@Override @Override

View file

@ -39,6 +39,7 @@ import org.x4o.fc18.cake2.zero33.dec1.FCDotCMD5401Dash2D;
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC0801DashE10; import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC0801DashE10;
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0; import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
import org.x4o.fc18.cake2.zero33.dec1.FCDotINC0801DashP8; import org.x4o.fc18.cake2.zero33.dec1.FCDotINC0801DashP8;
import org.x4o.fc18.octal8.PrimordialOctal;
/// Parsed FC text and calls the handler methods for the classified strobe lights. /// Parsed FC text and calls the handler methods for the classified strobe lights.
/// ///
@ -347,7 +348,7 @@ public class FourCornerZionStenoLexer {
sandWalking[bitOff] = 1; sandWalking[bitOff] = 1;
bitSize = bitOff; bitSize = bitOff;
} }
List<Integer> sandwormHead = new ArrayList<>(); List<PrimordialOctal> sandwormHead = new ArrayList<>();
PrimitiveIterator.OfInt i = Arrays.stream(sandWalking).iterator(); PrimitiveIterator.OfInt i = Arrays.stream(sandWalking).iterator();
int octalIdx = 2; int octalIdx = 2;
int octalValue = 0; int octalValue = 0;
@ -363,7 +364,7 @@ public class FourCornerZionStenoLexer {
octalIdx--; octalIdx--;
continue; continue;
} }
sandwormHead.add(octalValue); sandwormHead.add(PrimordialOctal.valueOf(octalValue));
octalIdx = 2; octalIdx = 2;
octalValue = 0; octalValue = 0;
} }
@ -389,7 +390,7 @@ public class FourCornerZionStenoLexer {
for (int i = idxFirst; i <= idxLast; i++) { for (int i = idxFirst; i <= idxLast; i++) {
wormBody15.add(lexer.input.get(i)); wormBody15.add(lexer.input.get(i));
} }
List<Integer> wormSpice = new ArrayList<>(); List<PrimordialOctal> wormSpice = new ArrayList<>();
Iterator<Integer> i15 = wormBody15.iterator(); Iterator<Integer> i15 = wormBody15.iterator();
while (i15.hasNext()) { while (i15.hasNext()) {
int bitValue15 = i15.next(); int bitValue15 = i15.next();
@ -413,11 +414,11 @@ public class FourCornerZionStenoLexer {
octal0 += ((bitValue15 >> 2) & 0b1) << 2; octal0 += ((bitValue15 >> 2) & 0b1) << 2;
octal0 += ((bitValue15 >> 1) & 0b1) << 1; octal0 += ((bitValue15 >> 1) & 0b1) << 1;
octal0 += ((bitValue15 >> 0) & 0b1) << 0; octal0 += ((bitValue15 >> 0) & 0b1) << 0;
wormSpice.add(octal4); wormSpice.add(PrimordialOctal.valueOf(octal4));
wormSpice.add(octal3); wormSpice.add(PrimordialOctal.valueOf(octal3));
wormSpice.add(octal2); wormSpice.add(PrimordialOctal.valueOf(octal2));
wormSpice.add(octal1); wormSpice.add(PrimordialOctal.valueOf(octal1));
wormSpice.add(octal0); wormSpice.add(PrimordialOctal.valueOf(octal0));
} }
lexer.handler.strobeSandWorm(wormSpice); lexer.handler.strobeSandWorm(wormSpice);
} }