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 ef64388..26ed5c1 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 @@ -152,6 +152,18 @@ public class FourCornerZionStenoLexer { } abstract ScanResult process(Iterator input); + + protected ScanResult safeReadCakePoints(Iterator input, List result) { + return safeReadRange(input, result, false); + } + + protected ScanResult safeReadSliceOffsets(Iterator input, List result) { + return safeReadRange(input, result, true); + } + + protected ScanResult safeReadRange(Iterator input, List result, boolean offset) { + return safeReadRanged(input, blockStart, blockStop, result, offset); + } } public void read(List points) { @@ -214,15 +226,7 @@ public class FourCornerZionStenoLexer { return ScanResult.DONE; } - private ScanResult safeReadCakePoints(Iterator input, int start, int stop, List result) { - return safeReadRange(input, start, stop, result, false); - } - - private ScanResult safeReadSliceOffsets(Iterator input, int start, int stop, List result) { - return safeReadRange(input, start, stop, result, true); - } - - private ScanResult safeReadRange(Iterator input, int start, int stop, List result, boolean offset) { + private ScanResult safeReadRanged(Iterator input, int start, int stop, List result, boolean offset) { while (cakePoint >= start && cakePoint <= stop) { if (offset) { result.add(cakePoint - start); @@ -248,7 +252,7 @@ public class FourCornerZionStenoLexer { @Override public ScanResult process(Iterator input) { List result = new ArrayList<>(); - ScanResult status = safeReadSliceOffsets(input, cakeSlice.getStart(), cakeSlice.getStop(), result); + ScanResult status = safeReadSliceOffsets(input, result); if (!result.isEmpty()) { handler.strobeWords(cakeSlice, result); } @@ -265,7 +269,7 @@ public class FourCornerZionStenoLexer { @Override public ScanResult process(Iterator input) { List result = new ArrayList<>(); - ScanResult status = safeReadCakePoints(input, FourCornerDotCake.FC_NETHER.getStart(), FourCornerDotCake.FC_NETHER.getStop(), result); + ScanResult status = safeReadCakePoints(input, result); if (!result.isEmpty()) { handlePoints(result); } @@ -287,7 +291,7 @@ public class FourCornerZionStenoLexer { @Override public ScanResult process(Iterator input) { List result = new ArrayList<>(); - ScanResult status = safeReadCakePoints(input, FourCornerDotCake.FC_NCR1632_XD.getStart(), FourCornerDotCake.FC_NCR1632_XN.getStop(), result); + ScanResult status = safeReadCakePoints(input, result); if (!result.isEmpty()) { handlePoints(result); // mix of the two blocks } @@ -342,7 +346,7 @@ public class FourCornerZionStenoLexer { @Override public ScanResult process(Iterator input) { List result = new ArrayList<>(); - ScanResult status = safeReadCakePoints(input, FourCornerDotCake.FC_UNI2K_11.getStart(), FourCornerDotCake.FC_UNI2K_22.getStop(), result); + ScanResult status = safeReadCakePoints(input, result); if (!result.isEmpty()) { handlePoints(result); // mix of the two unicode blocks pages } @@ -386,7 +390,7 @@ public class FourCornerZionStenoLexer { @Override public ScanResult process(Iterator input) { List result = new ArrayList<>(); - ScanResult status = safeReadCakePoints(input, FourCornerDotCake.FC_CDC1604_P6.getStart(), FourCornerDotCake.__MIND_THE_GAP8.getStop(), result); + ScanResult status = safeReadCakePoints(input, result); if (!result.isEmpty()) { handlePoints(result); }