Made cake point block check scan in steno lexer abstract
This commit is contained in:
parent
3cbc754251
commit
79d8b977a6
|
@ -130,8 +130,28 @@ public class FourCornerZionStenoLexer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private interface StenoScanner {
|
abstract private class StenoScanner {
|
||||||
ScanResult scan(Iterator<Integer> input);
|
|
||||||
|
private final int blockStart;
|
||||||
|
private final int blockStop;
|
||||||
|
|
||||||
|
public StenoScanner(int blockStart, int blockStop) {
|
||||||
|
this.blockStart = blockStart;
|
||||||
|
this.blockStop = blockStop;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StenoScanner(FourCornerDotCake cakeSlice) {
|
||||||
|
this(cakeSlice.getStart(), cakeSlice.getStop());
|
||||||
|
}
|
||||||
|
|
||||||
|
final public ScanResult scan(Iterator<Integer> input) {
|
||||||
|
if (cakePoint < blockStart || cakePoint > blockStop) {
|
||||||
|
return ScanResult.NEXT;
|
||||||
|
}
|
||||||
|
return process(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract ScanResult process(Iterator<Integer> input);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void read(List<Integer> points) {
|
public void read(List<Integer> points) {
|
||||||
|
@ -216,19 +236,17 @@ public class FourCornerZionStenoLexer {
|
||||||
return ScanResult.DONE;
|
return ScanResult.DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
class StenoScannerWordCakeSlice implements StenoScanner {
|
class StenoScannerWordCakeSlice extends StenoScanner {
|
||||||
|
|
||||||
private final FourCornerDotCake cakeSlice;
|
private final FourCornerDotCake cakeSlice;
|
||||||
|
|
||||||
public StenoScannerWordCakeSlice(FourCornerDotCake cakeSlice) {
|
public StenoScannerWordCakeSlice(FourCornerDotCake cakeSlice) {
|
||||||
|
super(cakeSlice);
|
||||||
this.cakeSlice = Objects.requireNonNull(cakeSlice);
|
this.cakeSlice = Objects.requireNonNull(cakeSlice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScanResult scan(Iterator<Integer> input) {
|
public ScanResult process(Iterator<Integer> input) {
|
||||||
if (cakeSlice.containsNot(cakePoint)) {
|
|
||||||
return ScanResult.NEXT;
|
|
||||||
}
|
|
||||||
List<Integer> result = new ArrayList<>();
|
List<Integer> result = new ArrayList<>();
|
||||||
ScanResult status = safeReadSliceOffsets(input, cakeSlice.getStart(), cakeSlice.getStop(), result);
|
ScanResult status = safeReadSliceOffsets(input, cakeSlice.getStart(), cakeSlice.getStop(), result);
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
|
@ -238,13 +256,14 @@ public class FourCornerZionStenoLexer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class StenoScannerNether implements StenoScanner {
|
class StenoScannerNether extends StenoScanner {
|
||||||
|
|
||||||
|
public StenoScannerNether() {
|
||||||
|
super(FourCornerDotCake.FC_NETHER);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScanResult scan(Iterator<Integer> input) {
|
public ScanResult process(Iterator<Integer> input) {
|
||||||
if (FourCornerDotCake.FC_NETHER.containsNot(cakePoint)) {
|
|
||||||
return ScanResult.NEXT;
|
|
||||||
}
|
|
||||||
List<Integer> result = new ArrayList<>();
|
List<Integer> result = new ArrayList<>();
|
||||||
ScanResult status = safeReadCakePoints(input, FourCornerDotCake.FC_NETHER.getStart(), FourCornerDotCake.FC_NETHER.getStop(), result);
|
ScanResult status = safeReadCakePoints(input, FourCornerDotCake.FC_NETHER.getStart(), FourCornerDotCake.FC_NETHER.getStop(), result);
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
|
@ -259,13 +278,14 @@ public class FourCornerZionStenoLexer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class StenoScannerNCR18 implements StenoScanner {
|
class StenoScannerNCR18 extends StenoScanner {
|
||||||
|
|
||||||
|
public StenoScannerNCR18() {
|
||||||
|
super(FourCornerDotCake.FC_NCR1632_XD.getStart(), FourCornerDotCake.FC_NCR1632_XN.getStop());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScanResult scan(Iterator<Integer> input) {
|
public ScanResult process(Iterator<Integer> input) {
|
||||||
if (cakePoint < FourCornerDotCake.FC_NCR1632_XD.getStart() || cakePoint > FourCornerDotCake.FC_NCR1632_XN.getStop()) {
|
|
||||||
return ScanResult.NEXT;
|
|
||||||
}
|
|
||||||
List<Integer> result = new ArrayList<>();
|
List<Integer> result = new ArrayList<>();
|
||||||
ScanResult status = safeReadCakePoints(input, FourCornerDotCake.FC_NCR1632_XD.getStart(), FourCornerDotCake.FC_NCR1632_XN.getStop(), result);
|
ScanResult status = safeReadCakePoints(input, FourCornerDotCake.FC_NCR1632_XD.getStart(), FourCornerDotCake.FC_NCR1632_XN.getStop(), result);
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
|
@ -313,13 +333,14 @@ public class FourCornerZionStenoLexer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class StenoScannerUNI21 implements StenoScanner {
|
class StenoScannerUNI21 extends StenoScanner {
|
||||||
|
|
||||||
|
public StenoScannerUNI21() {
|
||||||
|
super(FourCornerDotCake.FC_UNI2K_11.getStart(), FourCornerDotCake.FC_UNI2K_22.getStop());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScanResult scan(Iterator<Integer> input) {
|
public ScanResult process(Iterator<Integer> input) {
|
||||||
if (cakePoint < FourCornerDotCake.FC_UNI2K_11.getStart() || cakePoint > FourCornerDotCake.FC_UNI2K_22.getStop()) {
|
|
||||||
return ScanResult.NEXT;
|
|
||||||
}
|
|
||||||
List<Integer> result = new ArrayList<>();
|
List<Integer> result = new ArrayList<>();
|
||||||
ScanResult status = safeReadCakePoints(input, FourCornerDotCake.FC_UNI2K_11.getStart(), FourCornerDotCake.FC_UNI2K_22.getStop(), result);
|
ScanResult status = safeReadCakePoints(input, FourCornerDotCake.FC_UNI2K_11.getStart(), FourCornerDotCake.FC_UNI2K_22.getStop(), result);
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
|
@ -352,17 +373,18 @@ public class FourCornerZionStenoLexer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class StenoScannerCDCDECMuffin implements StenoScanner {
|
class StenoScannerCDCDECMuffin extends StenoScanner {
|
||||||
|
|
||||||
private Integer numberMode = null;
|
private Integer numberMode = null;
|
||||||
private boolean numberPIE = true;
|
private boolean numberPIE = true;
|
||||||
private FCDotDEC0127DashPX0 decMode = null;
|
private FCDotDEC0127DashPX0 decMode = null;
|
||||||
|
|
||||||
@Override
|
public StenoScannerCDCDECMuffin() {
|
||||||
public ScanResult scan(Iterator<Integer> input) {
|
super(0x00, FourCornerDotCake.__MIND_THE_GAP8.getStop());
|
||||||
if (cakePoint < FourCornerDotCake.FC_CDC1604_P6.getStart() || cakePoint > FourCornerDotCake.__MIND_THE_GAP8.getStop()) {
|
|
||||||
return ScanResult.NEXT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScanResult process(Iterator<Integer> input) {
|
||||||
List<Integer> result = new ArrayList<>();
|
List<Integer> result = new ArrayList<>();
|
||||||
ScanResult status = safeReadCakePoints(input, FourCornerDotCake.FC_CDC1604_P6.getStart(), FourCornerDotCake.__MIND_THE_GAP8.getStop(), result);
|
ScanResult status = safeReadCakePoints(input, FourCornerDotCake.FC_CDC1604_P6.getStart(), FourCornerDotCake.__MIND_THE_GAP8.getStop(), result);
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
|
|
Loading…
Reference in a new issue