Added X08 and X18 display in unicode
This commit is contained in:
parent
6bd01424d8
commit
bac0041239
|
@ -98,14 +98,42 @@ public class FourCornerUnicodeDisplay {
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String renderFromP6(List<FourCornerX06BaklavaPoints> chars) {
|
public String renderFromX06(List<FourCornerX06BaklavaPoints> chars) {
|
||||||
return buildString(v -> renderFromP6(chars, v));
|
return buildString(v -> renderFromX06(chars, v));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderFromP6(List<FourCornerX06BaklavaPoints> chars, StringBuilder buf) {
|
public void renderFromX06(List<FourCornerX06BaklavaPoints> chars, StringBuilder buf) {
|
||||||
List<Integer> charPoints = new ArrayList<>(chars.size());
|
List<Integer> charPoints = new ArrayList<>(chars.size());
|
||||||
for (FourCornerX06BaklavaPoints baklava : chars) {
|
for (FourCornerX06BaklavaPoints oven : chars) {
|
||||||
for (int v : baklava.baklavaPoints()) {
|
for (int v : oven.baklavaPoints()) {
|
||||||
|
charPoints.add(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
renderFromInt18(charPoints, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String renderFromX08(List<FourCornerX08MuffinPoints> chars) {
|
||||||
|
return buildString(v -> renderFromX08(chars, v));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderFromX08(List<FourCornerX08MuffinPoints> chars, StringBuilder buf) {
|
||||||
|
List<Integer> charPoints = new ArrayList<>(chars.size());
|
||||||
|
for (FourCornerX08MuffinPoints oven : chars) {
|
||||||
|
for (int v : oven.muffinPoints()) {
|
||||||
|
charPoints.add(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
renderFromInt18(charPoints, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String renderFromX18(List<FourCornerX18CakePoints> chars) {
|
||||||
|
return buildString(v -> renderFromX18(chars, v));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderFromX18(List<FourCornerX18CakePoints> chars, StringBuilder buf) {
|
||||||
|
List<Integer> charPoints = new ArrayList<>(chars.size());
|
||||||
|
for (FourCornerX18CakePoints oven : chars) {
|
||||||
|
for (int v : oven.cakePoints()) {
|
||||||
charPoints.add(v);
|
charPoints.add(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,9 +161,23 @@ public class FourCornerUnicodeDisplay {
|
||||||
boolean prevWord = false;
|
boolean prevWord = false;
|
||||||
while (cdc.hasNext()) {
|
while (cdc.hasNext()) {
|
||||||
Integer cdcPoint = cdc.next();
|
Integer cdcPoint = cdc.next();
|
||||||
if (FCDotCDC1604DashP6.__ESC6.ordinal() == cdcPoint) {
|
if (cdcPoint >= FourCornerDotCake.FC_DEC1604_P7.getStart() && cdcPoint <= FourCornerDotCake.FC_DEC1604_P7.getStop()) {
|
||||||
|
Integer decPoint = cdcPoint - FourCornerDotCake.FC_DEC1604_P7.getLength();
|
||||||
|
FCDotDEC1604DashP7 decCode = FCDotDEC1604DashP7.indexOf(decPoint);
|
||||||
numberMode = null; // out of range, thus stop
|
numberMode = null; // out of range, thus stop
|
||||||
Integer handled = handleEscape6(cdc, buf);
|
Integer handled = handleEscape6(decCode, cdc, buf);
|
||||||
|
if (handled == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
cdcPoint = handled; // out of range, is back to normal
|
||||||
|
}
|
||||||
|
if (FCDotCDC1604DashP6.__ESC6.ordinal() == cdcPoint) {
|
||||||
|
if (!cdc.hasNext()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
FCDotDEC1604DashP7 decCode = FCDotDEC1604DashP7.indexOf(cdc.next());
|
||||||
|
numberMode = null; // out of range, thus stop
|
||||||
|
Integer handled = handleEscape6(decCode, cdc, buf);
|
||||||
if (handled == null) {
|
if (handled == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -212,14 +254,12 @@ public class FourCornerUnicodeDisplay {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer handleEscape6(Iterator<Integer> cdc, StringBuilder buf) {
|
private Integer handleEscape6(FCDotDEC1604DashP7 decCode, Iterator<Integer> cdc, StringBuilder buf) {
|
||||||
if (!cdc.hasNext()) {
|
if (renderHiddenControls) {
|
||||||
return null;
|
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
|
||||||
}
|
}
|
||||||
FCDotDEC1604DashP7 decCode = FCDotDEC1604DashP7.indexOf(cdc.next());
|
|
||||||
if (FCDotDEC1604DashP7.__NUL_DEC.equals(decCode)) {
|
if (FCDotDEC1604DashP7.__NUL_DEC.equals(decCode)) {
|
||||||
if (renderHiddenControls) {
|
if (renderHiddenControls) {
|
||||||
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
|
|
||||||
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__NUL_DEC.ordinal()));
|
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__NUL_DEC.ordinal()));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -229,7 +269,6 @@ public class FourCornerUnicodeDisplay {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (renderHiddenControls) {
|
if (renderHiddenControls) {
|
||||||
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
|
|
||||||
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__ESC6_APL.ordinal()));
|
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__ESC6_APL.ordinal()));
|
||||||
}
|
}
|
||||||
FCDotAPL1604DashP8L aplCode = FCDotAPL1604DashP8L.indexOf(cdc.next());
|
FCDotAPL1604DashP8L aplCode = FCDotAPL1604DashP8L.indexOf(cdc.next());
|
||||||
|
@ -241,7 +280,6 @@ public class FourCornerUnicodeDisplay {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (renderHiddenControls) {
|
if (renderHiddenControls) {
|
||||||
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
|
|
||||||
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__ESC6_BYD.ordinal()));
|
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__ESC6_BYD.ordinal()));
|
||||||
}
|
}
|
||||||
FCDotBYD1604DashP8H bydCode = FCDotBYD1604DashP8H.indexOf(cdc.next());
|
FCDotBYD1604DashP8H bydCode = FCDotBYD1604DashP8H.indexOf(cdc.next());
|
||||||
|
@ -250,7 +288,6 @@ public class FourCornerUnicodeDisplay {
|
||||||
}
|
}
|
||||||
if (FCDotDEC1604DashP7.__ESC_STOP.equals(decCode)) {
|
if (FCDotDEC1604DashP7.__ESC_STOP.equals(decCode)) {
|
||||||
if (renderHiddenControls) {
|
if (renderHiddenControls) {
|
||||||
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
|
|
||||||
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__ESC_STOP.ordinal()));
|
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__ESC_STOP.ordinal()));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -267,12 +304,16 @@ public class FourCornerUnicodeDisplay {
|
||||||
if (idx > 26 || idx < 0) {
|
if (idx > 26 || idx < 0) {
|
||||||
return checkChr; // can't handle this
|
return checkChr; // can't handle this
|
||||||
}
|
}
|
||||||
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
|
if (!renderHiddenControls) {
|
||||||
|
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
|
||||||
|
}
|
||||||
FCDotPIE9CDash26 lowCode = FCDotPIE9CDash26.values()[idx];
|
FCDotPIE9CDash26 lowCode = FCDotPIE9CDash26.values()[idx];
|
||||||
Arrays.stream(lowCode.codePoints()).forEach(v -> buf.appendCodePoint(v));
|
Arrays.stream(lowCode.codePoints()).forEach(v -> buf.appendCodePoint(v));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
|
if (!renderHiddenControls) {
|
||||||
|
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
|
||||||
|
}
|
||||||
return decCode.ordinal();
|
return decCode.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,13 @@
|
||||||
package org.x4o.o2o.fc18;
|
package org.x4o.o2o.fc18;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.PrimitiveIterator;
|
import java.util.PrimitiveIterator;
|
||||||
|
|
||||||
import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
|
import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
|
||||||
|
import org.x4o.o2o.fc18.zero33.FCDotDEC1604DashP7;
|
||||||
import org.x4o.o2o.octal.PrimordialOctalOrangeJuiceCord;
|
import org.x4o.o2o.octal.PrimordialOctalOrangeJuiceCord;
|
||||||
import org.x4o.o2o.octal.PrimordialOctalOrangeString;
|
import org.x4o.o2o.octal.PrimordialOctalOrangeString;
|
||||||
|
|
||||||
|
@ -41,8 +41,6 @@ import org.x4o.o2o.octal.PrimordialOctalOrangeString;
|
||||||
///
|
///
|
||||||
public class FourCornerUnicodeImport {
|
public class FourCornerUnicodeImport {
|
||||||
|
|
||||||
static private final FourCornerUnicodeImport IMPORT_STRICT = new FourCornerUnicodeImport(false);
|
|
||||||
static private final FourCornerUnicodeImport IMPORT_LOSSY = new FourCornerUnicodeImport(true);
|
|
||||||
private boolean convertDiacritics = false;
|
private boolean convertDiacritics = false;
|
||||||
private final Map<Integer, FourCornerX00PetitVidePoints> int21ToVide = new HashMap<>();
|
private final Map<Integer, FourCornerX00PetitVidePoints> int21ToVide = new HashMap<>();
|
||||||
|
|
||||||
|
@ -52,11 +50,11 @@ public class FourCornerUnicodeImport {
|
||||||
}
|
}
|
||||||
|
|
||||||
static public FourCornerUnicodeImport strict() {
|
static public FourCornerUnicodeImport strict() {
|
||||||
return IMPORT_STRICT;
|
return new FourCornerUnicodeImport(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public FourCornerUnicodeImport lossy() {
|
static public FourCornerUnicodeImport lossy() {
|
||||||
return IMPORT_LOSSY;
|
return new FourCornerUnicodeImport(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrimordialOctalOrangeJuiceCord convertToJuice(String text) {
|
public PrimordialOctalOrangeJuiceCord convertToJuice(String text) {
|
||||||
|
@ -64,13 +62,31 @@ public class FourCornerUnicodeImport {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> convertToInt18(String text) {
|
public List<Integer> convertToInt18(String text) {
|
||||||
return convertToP6(text).stream().map(v -> v.baklavaPoints()[0]).toList();
|
List<Integer> cakePoints = new ArrayList<>(text.length());
|
||||||
|
for (FourCornerX18CakePoints oven : convertToX18(text)) {
|
||||||
|
for (int v : oven.cakePoints()) {
|
||||||
|
cakePoints.add(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cakePoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FourCornerX06BaklavaPoints> convertToP6(String text) {
|
public List<FourCornerX06BaklavaPoints> convertToX06(String text) {
|
||||||
|
return convertToXXX(text, 6).stream().map(v -> v.toX06()).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<FourCornerX08MuffinPoints> convertToX08(String text) {
|
||||||
|
return convertToXXX(text, 8).stream().map(v -> v.toX08()).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<FourCornerX18CakePoints> convertToX18(String text) {
|
||||||
|
return convertToXXX(text, 18).stream().map(v -> v.toX18()).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<FourCornerX00PetitVidePoints> convertToXXX(String text, int bits) {
|
||||||
String textSingleNewLines = text.replaceAll("\r\n", "\n"); // FIXME: regex only allowed in test scope classpath
|
String textSingleNewLines = text.replaceAll("\r\n", "\n"); // FIXME: regex only allowed in test scope classpath
|
||||||
PrimitiveIterator.OfInt i = textSingleNewLines.codePoints().iterator();
|
PrimitiveIterator.OfInt i = textSingleNewLines.codePoints().iterator();
|
||||||
List<FourCornerX06BaklavaPoints> result = new ArrayList<>(text.length());
|
List<FourCornerX00PetitVidePoints> result = new ArrayList<>(text.length());
|
||||||
FCDotCDC1604DashP6 cdcNumberTerminator = null;
|
FCDotCDC1604DashP6 cdcNumberTerminator = null;
|
||||||
FCDotCDC1604DashP6 cdcCaseTerminator = null;
|
FCDotCDC1604DashP6 cdcCaseTerminator = null;
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
|
@ -85,49 +101,77 @@ public class FourCornerUnicodeImport {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle number sequences manual, to escape once
|
// Handle number sequences manual, to escape once
|
||||||
if (codePoint >= '0' && codePoint <= '9') {
|
if (bits != 18) { // 18 direct cake point is found by generic lookup
|
||||||
if (!FCDotCDC1604DashP6.NX10_J.equals(cdcNumberTerminator)) {
|
if (codePoint >= '0' && codePoint <= '9') {
|
||||||
result.add(FCDotCDC1604DashP6.__PIE);
|
if (!FCDotCDC1604DashP6.NX10_J.equals(cdcNumberTerminator)) {
|
||||||
result.add(FCDotCDC1604DashP6.NX10_J);
|
result.add(FCDotCDC1604DashP6.__PIE);
|
||||||
cdcNumberTerminator = FCDotCDC1604DashP6.NX10_J;
|
result.add(FCDotCDC1604DashP6.NX10_J);
|
||||||
|
cdcNumberTerminator = FCDotCDC1604DashP6.NX10_J;
|
||||||
|
}
|
||||||
|
int cdcNumberOff = codePoint - '0';
|
||||||
|
int cdcNumber = FCDotCDC1604DashP6.NX01_A.ordinal() + cdcNumberOff;
|
||||||
|
result.add(FCDotCDC1604DashP6.indexOf(cdcNumber));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (cdcNumberTerminator != null) {
|
||||||
|
cdcNumberTerminator = null;
|
||||||
|
if (bits == 6) {
|
||||||
|
result.add(FCDotCDC1604DashP6.__ESC6);
|
||||||
|
result.add(FCDotCDC1604DashP6.__ESC6);
|
||||||
|
} else {
|
||||||
|
result.add(FCDotDEC1604DashP7.__ESC_STOP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int cdcNumberOff = codePoint - '0';
|
|
||||||
int cdcNumber = FCDotCDC1604DashP6.NX01_A.ordinal() + cdcNumberOff;
|
|
||||||
result.add(FCDotCDC1604DashP6.indexOf(cdcNumber));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (cdcNumberTerminator != null) {
|
|
||||||
cdcNumberTerminator = null;
|
|
||||||
result.add(FCDotCDC1604DashP6.__ESC6);
|
|
||||||
result.add(FCDotCDC1604DashP6.__ESC6);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle lower case sequences manual, to escape once
|
// Handle lower case sequences manual, to escape once
|
||||||
if (codePoint >= 'a' && codePoint <= 'z') {
|
if (bits != 18) { // 18 direct cake point is found by generic lookup
|
||||||
if (!FCDotCDC1604DashP6.NX26_Z.equals(cdcCaseTerminator)) {
|
if (codePoint >= 'a' && codePoint <= 'z') {
|
||||||
result.add(FCDotCDC1604DashP6.__PIE);
|
if (!FCDotCDC1604DashP6.NX26_Z.equals(cdcCaseTerminator)) {
|
||||||
result.add(FCDotCDC1604DashP6.NX26_Z);
|
result.add(FCDotCDC1604DashP6.__PIE);
|
||||||
cdcCaseTerminator = FCDotCDC1604DashP6.NX26_Z;
|
result.add(FCDotCDC1604DashP6.NX26_Z);
|
||||||
|
cdcCaseTerminator = FCDotCDC1604DashP6.NX26_Z;
|
||||||
|
}
|
||||||
|
int cdcNumberOff = codePoint - 'a';
|
||||||
|
int cdcNumber = FCDotCDC1604DashP6.NX01_A.ordinal() + cdcNumberOff;
|
||||||
|
result.add(FCDotCDC1604DashP6.indexOf(cdcNumber));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (cdcCaseTerminator != null) {
|
||||||
|
cdcCaseTerminator = null;
|
||||||
|
if (bits == 6) {
|
||||||
|
result.add(FCDotCDC1604DashP6.__ESC6);
|
||||||
|
result.add(FCDotCDC1604DashP6.__ESC6);
|
||||||
|
} else {
|
||||||
|
result.add(FCDotDEC1604DashP7.__ESC_STOP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int cdcNumberOff = codePoint - 'a';
|
|
||||||
int cdcNumber = FCDotCDC1604DashP6.NX01_A.ordinal() + cdcNumberOff;
|
|
||||||
result.add(FCDotCDC1604DashP6.indexOf(cdcNumber));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (cdcCaseTerminator != null) {
|
|
||||||
cdcCaseTerminator = null;
|
|
||||||
result.add(FCDotCDC1604DashP6.__ESC6);
|
|
||||||
result.add(FCDotCDC1604DashP6.__ESC6);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lookup mapped values
|
// Lookup mapped values
|
||||||
FourCornerX00PetitVidePoints chs = int21ToVide.get(codePoint);
|
FourCornerX00PetitVidePoints chs = int21ToVide.get(codePoint);
|
||||||
if (chs != null) {
|
if (chs != null) {
|
||||||
if (!chs.isX06()) {
|
if (bits == 6) {
|
||||||
|
if (!chs.isX06()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
result.add(chs.toX06());
|
||||||
|
//Arrays.stream(chs.toX06().baklavaPoints()).mapToObj(v -> FCDotCDC1604DashP6.indexOf(v)).forEach(v -> result.add(v));
|
||||||
|
continue;
|
||||||
|
} else if (bits == 8) {
|
||||||
|
if (!chs.isX08()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
result.add(chs.toX08());
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
if (!chs.isX18()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
result.add(chs.toX18());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Arrays.stream(chs.toX06().baklavaPoints()).mapToObj(v -> FCDotCDC1604DashP6.indexOf(v)).forEach(v -> result.add(v));
|
// fails below in exception
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check lossy aliases
|
// Check lossy aliases
|
||||||
|
|
|
@ -37,16 +37,16 @@ import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
|
||||||
*/
|
*/
|
||||||
public enum FCDotPIE9CDash10 implements FourCornerX06BaklavaPoints, FourCornerX08MuffinPoints, FourCornerX18CakePoints, FourCornerX21CodePoints {
|
public enum FCDotPIE9CDash10 implements FourCornerX06BaklavaPoints, FourCornerX08MuffinPoints, FourCornerX18CakePoints, FourCornerX21CodePoints {
|
||||||
|
|
||||||
NXX_01('0'),
|
DECIMAL_0('0'),
|
||||||
NXX_02('1'),
|
DECIMAL_1('1'),
|
||||||
NXX_03('2'),
|
DECIMAL_2('2'),
|
||||||
NXX_04('3'),
|
DECIMAL_3('3'),
|
||||||
NXX_05('4'),
|
DECIMAL_4('4'),
|
||||||
NXX_06('5'),
|
DECIMAL_5('5'),
|
||||||
NXX_07('6'),
|
DECIMAL_6('6'),
|
||||||
NXX_08('7'),
|
DECIMAL_7('7'),
|
||||||
NXX_09('8'),
|
DECIMAL_8('8'),
|
||||||
NXX_10('9'),
|
DECIMAL_9('9'),
|
||||||
;
|
;
|
||||||
private final int[] codePoints;
|
private final int[] codePoints;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
*/
|
*/
|
||||||
package org.x4o.o2o.fc18.zero33;
|
package org.x4o.o2o.fc18.zero33;
|
||||||
|
|
||||||
import org.x4o.o2o.fc18.FourCornerDotCake;
|
|
||||||
import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints;
|
import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints;
|
||||||
import org.x4o.o2o.fc18.FourCornerX08MuffinPoints;
|
import org.x4o.o2o.fc18.FourCornerX08MuffinPoints;
|
||||||
import org.x4o.o2o.fc18.FourCornerX18CakePoints;
|
import org.x4o.o2o.fc18.FourCornerX18CakePoints;
|
||||||
|
@ -140,12 +139,12 @@ public enum FCDotCDC1604DashP6 implements FourCornerX06BaklavaPoints, FourCorner
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] muffinPoints() {
|
public int[] muffinPoints() {
|
||||||
return cakePoints();
|
return new int[] {ordinal()};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] cakePoints() {
|
public int[] cakePoints() {
|
||||||
return new int[] {FourCornerDotCake.FC_CDC1604_P6.getStart() + ordinal()};
|
return new int[] {ordinal()};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class FourCornerUnicodeDisplayTest {
|
||||||
cdc.add(FCDotCDC1604DashP6.NX03_C); // T003
|
cdc.add(FCDotCDC1604DashP6.NX03_C); // T003
|
||||||
cdc.add(FCDotCDC1604DashP6.NX01_A); // NXX_001
|
cdc.add(FCDotCDC1604DashP6.NX01_A); // NXX_001
|
||||||
|
|
||||||
String out = FourCornerUnicodeDisplay.text().renderFromP6(cdc);
|
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
|
||||||
Assertions.assertEquals("X¹/₃", out);
|
Assertions.assertEquals("X¹/₃", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@ public class FourCornerUnicodeDisplayTest {
|
||||||
cdc.add(FCDotDEC1604DashP7.__ESC_STOP);
|
cdc.add(FCDotDEC1604DashP7.__ESC_STOP);
|
||||||
cdc.add(FCDotCDC1604DashP6.NX15_O);
|
cdc.add(FCDotCDC1604DashP6.NX15_O);
|
||||||
|
|
||||||
Assertions.assertEquals("ab B␃cD.jklmO", FourCornerUnicodeDisplay.text().renderFromP6(cdc));
|
Assertions.assertEquals("ab B␃cD.jklmO", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||||
Assertions.assertEquals("ab B␃cD.jklm␃␃O", FourCornerUnicodeDisplay.text(true).renderFromP6(cdc));
|
Assertions.assertEquals("ab B␃cD.jklm␃␃O", FourCornerUnicodeDisplay.text(true).renderFromX06(cdc));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -96,7 +96,7 @@ public class FourCornerUnicodeDisplayTest {
|
||||||
cdc.add(FCDotCDC1604DashP6._AT);
|
cdc.add(FCDotCDC1604DashP6._AT);
|
||||||
cdc.add(FCDotCDC1604DashP6.NX11_K); // = K
|
cdc.add(FCDotCDC1604DashP6.NX11_K); // = K
|
||||||
|
|
||||||
String out = FourCornerUnicodeDisplay.text().renderFromP6(cdc);
|
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
|
||||||
Assertions.assertEquals("X^%@K", out);
|
Assertions.assertEquals("X^%@K", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ public class FourCornerUnicodeDisplayTest {
|
||||||
cdc.add(FCDotCDC1604DashP6.NX04_D); // 3
|
cdc.add(FCDotCDC1604DashP6.NX04_D); // 3
|
||||||
cdc.add(FCDotCDC1604DashP6.NX11_K); // K
|
cdc.add(FCDotCDC1604DashP6.NX11_K); // K
|
||||||
|
|
||||||
String out = FourCornerUnicodeDisplay.text().renderFromP6(cdc);
|
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
|
||||||
Assertions.assertEquals("B3K", out);
|
Assertions.assertEquals("B3K", out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,10 @@ import java.util.List;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash10;
|
||||||
|
import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash26;
|
||||||
import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
|
import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
|
||||||
|
import org.x4o.o2o.fc18.zero33.FCDotDEC1604DashP7;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests four corner unicode import.
|
* Tests four corner unicode import.
|
||||||
|
@ -37,8 +40,25 @@ import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
|
||||||
public class FourCornerUnicodeImportTest {
|
public class FourCornerUnicodeImportTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAsciiSimple() throws Exception {
|
public void testAsciiUpper() throws Exception {
|
||||||
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.lossy().convertToP6("foobar");
|
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.strict().convertToX06("FOOBAR");
|
||||||
|
Assertions.assertNotNull(cdc);
|
||||||
|
Assertions.assertFalse(cdc.isEmpty());
|
||||||
|
Assertions.assertEquals(6, cdc.size());
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX06_F, cdc.get(0));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX15_O, cdc.get(1));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX15_O, cdc.get(2));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdc.get(3));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(4));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdc.get(5));
|
||||||
|
|
||||||
|
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
|
||||||
|
Assertions.assertEquals("FOOBAR", out);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAsciiLower() throws Exception {
|
||||||
|
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.strict().convertToX06("foobar");
|
||||||
Assertions.assertNotNull(cdc);
|
Assertions.assertNotNull(cdc);
|
||||||
Assertions.assertFalse(cdc.isEmpty());
|
Assertions.assertFalse(cdc.isEmpty());
|
||||||
Assertions.assertEquals(8, cdc.size());
|
Assertions.assertEquals(8, cdc.size());
|
||||||
|
@ -51,16 +71,16 @@ public class FourCornerUnicodeImportTest {
|
||||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(6));
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(6));
|
||||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdc.get(7));
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdc.get(7));
|
||||||
|
|
||||||
String out = FourCornerUnicodeDisplay.text().renderFromP6(cdc);
|
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
|
||||||
Assertions.assertEquals("foobar", out);
|
Assertions.assertEquals("foobar", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAsciiUpper() throws Exception {
|
public void testAsciiMixedX06() throws Exception {
|
||||||
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.lossy().convertToP6("fooBAR");
|
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.strict().convertToX06("fooBAR");
|
||||||
Assertions.assertNotNull(cdc);
|
Assertions.assertNotNull(cdc);
|
||||||
Assertions.assertFalse(cdc.isEmpty());
|
Assertions.assertFalse(cdc.isEmpty());
|
||||||
Assertions.assertEquals(10, cdc.size());
|
Assertions.assertEquals(10, cdc.size()); // = 60 bit
|
||||||
Assertions.assertEquals(FCDotCDC1604DashP6.__PIE, cdc.get(0));
|
Assertions.assertEquals(FCDotCDC1604DashP6.__PIE, cdc.get(0));
|
||||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX26_Z, cdc.get(1));
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX26_Z, cdc.get(1));
|
||||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX06_F, cdc.get(2));
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX06_F, cdc.get(2));
|
||||||
|
@ -72,25 +92,63 @@ public class FourCornerUnicodeImportTest {
|
||||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(8));
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(8));
|
||||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdc.get(9));
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdc.get(9));
|
||||||
|
|
||||||
String out = FourCornerUnicodeDisplay.text().renderFromP6(cdc);
|
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
|
||||||
Assertions.assertEquals("fooBAR", out);
|
Assertions.assertEquals("fooBAR", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCheckDiacritics() throws Exception {
|
public void testAsciiMixedX08() throws Exception {
|
||||||
String foobar = "ꞘȍőḆẬř";
|
List<FourCornerX08MuffinPoints> cdc = FourCornerUnicodeImport.strict().convertToX08("fooBAR");
|
||||||
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.lossy().convertToP6(foobar);
|
|
||||||
Assertions.assertNotNull(cdc);
|
Assertions.assertNotNull(cdc);
|
||||||
Assertions.assertFalse(cdc.isEmpty());
|
Assertions.assertFalse(cdc.isEmpty());
|
||||||
Assertions.assertEquals("FOOBAR", FourCornerUnicodeDisplay.text().renderFromP6(cdc));
|
Assertions.assertEquals(9, cdc.size()); // = 72 bit
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.__PIE, cdc.get(0));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX26_Z, cdc.get(1));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX06_F, cdc.get(2));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX15_O, cdc.get(3));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX15_O, cdc.get(4));
|
||||||
|
Assertions.assertEquals(FCDotDEC1604DashP7.__ESC_STOP, cdc.get(5));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdc.get(6));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(7));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdc.get(8));
|
||||||
|
|
||||||
|
String out = FourCornerUnicodeDisplay.text().renderFromX08(cdc);
|
||||||
|
Assertions.assertEquals("fooBAR", out);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAsciiMixedX18() throws Exception {
|
||||||
|
List<FourCornerX18CakePoints> cdc = FourCornerUnicodeImport.strict().convertToX18("fooBAR");
|
||||||
|
Assertions.assertNotNull(cdc);
|
||||||
|
Assertions.assertFalse(cdc.isEmpty());
|
||||||
|
Assertions.assertEquals(6, cdc.size()); // = 108 bit
|
||||||
|
Assertions.assertEquals(FCDotPIE9CDash26.LOW_F, cdc.get(0));
|
||||||
|
Assertions.assertEquals(FCDotPIE9CDash26.LOW_O, cdc.get(1));
|
||||||
|
Assertions.assertEquals(FCDotPIE9CDash26.LOW_O, cdc.get(2));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdc.get(3));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(4));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdc.get(5));
|
||||||
|
|
||||||
|
String out = FourCornerUnicodeDisplay.text().renderFromX18(cdc);
|
||||||
|
Assertions.assertEquals("fooBAR", out);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCheckDiacritics() throws Exception {
|
||||||
|
String foobar = "ꞘȍőḆẬř";
|
||||||
|
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.lossy().convertToX06(foobar);
|
||||||
|
Assertions.assertNotNull(cdc);
|
||||||
|
Assertions.assertFalse(cdc.isEmpty());
|
||||||
|
Assertions.assertEquals("FOOBAR", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||||
FourCornerUnicodeImport.strict().convertToP6(foobar);
|
FourCornerUnicodeImport.strict().convertToX06(foobar);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNumber012() throws Exception {
|
public void testNumberX06() throws Exception {
|
||||||
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.lossy().convertToP6("01201337");
|
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.strict().convertToX06("01201337");
|
||||||
Assertions.assertNotNull(cdc);
|
Assertions.assertNotNull(cdc);
|
||||||
Assertions.assertFalse(cdc.isEmpty());
|
Assertions.assertFalse(cdc.isEmpty());
|
||||||
Assertions.assertEquals(10, cdc.size());
|
Assertions.assertEquals(10, cdc.size());
|
||||||
|
@ -105,13 +163,53 @@ public class FourCornerUnicodeImportTest {
|
||||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdc.get(8)); // 3
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdc.get(8)); // 3
|
||||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX08_H, cdc.get(9)); // 7
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX08_H, cdc.get(9)); // 7
|
||||||
|
|
||||||
String out = FourCornerUnicodeDisplay.text().renderFromP6(cdc);
|
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
|
||||||
|
Assertions.assertEquals("01201337", out);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNumberX08() throws Exception {
|
||||||
|
List<FourCornerX08MuffinPoints> cdc = FourCornerUnicodeImport.strict().convertToX08("01201337");
|
||||||
|
Assertions.assertNotNull(cdc);
|
||||||
|
Assertions.assertFalse(cdc.isEmpty());
|
||||||
|
Assertions.assertEquals(10, cdc.size());
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.__PIE, cdc.get(0));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX10_J, cdc.get(1));
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(2)); // 0
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdc.get(3)); // 1
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX03_C, cdc.get(4)); // 2
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(5)); // 0
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdc.get(6)); // 1
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdc.get(7)); // 3
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdc.get(8)); // 3
|
||||||
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX08_H, cdc.get(9)); // 7
|
||||||
|
|
||||||
|
String out = FourCornerUnicodeDisplay.text().renderFromX08(cdc);
|
||||||
|
Assertions.assertEquals("01201337", out);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNumberX18() throws Exception {
|
||||||
|
List<FourCornerX18CakePoints> cdc = FourCornerUnicodeImport.strict().convertToX18("01201337");
|
||||||
|
Assertions.assertNotNull(cdc);
|
||||||
|
Assertions.assertFalse(cdc.isEmpty());
|
||||||
|
Assertions.assertEquals(8, cdc.size());
|
||||||
|
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_0, cdc.get(0)); // 0
|
||||||
|
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_1, cdc.get(1)); // 1
|
||||||
|
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_2, cdc.get(2)); // 2
|
||||||
|
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_0, cdc.get(3)); // 0
|
||||||
|
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_1, cdc.get(4)); // 1
|
||||||
|
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_3, cdc.get(5)); // 3
|
||||||
|
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_3, cdc.get(6)); // 3
|
||||||
|
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_7, cdc.get(7)); // 7
|
||||||
|
|
||||||
|
String out = FourCornerUnicodeDisplay.text().renderFromX18(cdc);
|
||||||
Assertions.assertEquals("01201337", out);
|
Assertions.assertEquals("01201337", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLineEndings() throws Exception {
|
public void testLineEndings() throws Exception {
|
||||||
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.strict().convertToP6("A\nB\rC\r\nD\n");
|
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.strict().convertToX06("A\nB\rC\r\nD\n");
|
||||||
Assertions.assertNotNull(cdc);
|
Assertions.assertNotNull(cdc);
|
||||||
Assertions.assertFalse(cdc.isEmpty());
|
Assertions.assertFalse(cdc.isEmpty());
|
||||||
Assertions.assertEquals(8, cdc.size());
|
Assertions.assertEquals(8, cdc.size());
|
||||||
|
@ -124,7 +222,7 @@ public class FourCornerUnicodeImportTest {
|
||||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdc.get(6));
|
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdc.get(6));
|
||||||
Assertions.assertEquals(FCDotCDC1604DashP6.__LINE, cdc.get(7));
|
Assertions.assertEquals(FCDotCDC1604DashP6.__LINE, cdc.get(7));
|
||||||
|
|
||||||
String out = FourCornerUnicodeDisplay.text().renderFromP6(cdc);
|
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
|
||||||
Assertions.assertEquals("A\nB\nC\nD\n", out);
|
Assertions.assertEquals("A\nB\nC\nD\n", out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue