Renamed static interface of enum by value index
This commit is contained in:
parent
b4fec076b0
commit
866983c93b
|
@ -133,11 +133,11 @@ public enum FCDotAPL0127DashP7A implements FourCornerX06BaklavaPoints, FourCorne
|
|||
return new int[] {codePoint};
|
||||
}
|
||||
|
||||
static public int length() {
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
static public FCDotAPL0127DashP7A indexOf(int idx) {
|
||||
static public FCDotAPL0127DashP7A valueOf(int idx) {
|
||||
return VALUES[idx];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,11 +137,11 @@ public enum FCDotAPL0127DashP7B implements FourCornerX06BaklavaPoints, FourCorne
|
|||
return new int[] {codePoint};
|
||||
}
|
||||
|
||||
static public int length() {
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
static public FCDotAPL0127DashP7B indexOf(int idx) {
|
||||
static public FCDotAPL0127DashP7B valueOf(int idx) {
|
||||
return VALUES[idx];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,11 +139,11 @@ public enum FCDotAPL0127DashP7C implements FourCornerX06BaklavaPoints, FourCorne
|
|||
return new int[] {codePoint};
|
||||
}
|
||||
|
||||
static public int length() {
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
static public FCDotAPL0127DashP7C indexOf(int idx) {
|
||||
static public FCDotAPL0127DashP7C valueOf(int idx) {
|
||||
return VALUES[idx];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,11 +95,11 @@ public enum FCDotBYD0127DashP7D implements FourCornerX06BaklavaPoints, FourCorne
|
|||
return new int[] {codePoint};
|
||||
}
|
||||
|
||||
static public int length() {
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
static public FCDotBYD0127DashP7D indexOf(int idx) {
|
||||
static public FCDotBYD0127DashP7D valueOf(int idx) {
|
||||
return VALUES[idx];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,11 +95,11 @@ public enum FCDotBYD0127DashP7E implements FourCornerX06BaklavaPoints, FourCorne
|
|||
return new int[] {codePoint};
|
||||
}
|
||||
|
||||
static public int length() {
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
static public FCDotBYD0127DashP7E indexOf(int idx) {
|
||||
static public FCDotBYD0127DashP7E valueOf(int idx) {
|
||||
return VALUES[idx];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,11 +94,11 @@ public enum FCDotBYD0127DashP7F implements FourCornerX06BaklavaPoints, FourCorne
|
|||
return new int[] {codePoint};
|
||||
}
|
||||
|
||||
static public int length() {
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
static public FCDotBYD0127DashP7F indexOf(int idx) {
|
||||
static public FCDotBYD0127DashP7F valueOf(int idx) {
|
||||
return VALUES[idx];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,18 +79,18 @@ public class FourCornerWriteExampleMD {
|
|||
int startAPL = FourCornerDotCake.FC_APL0127_P7A.getStart();
|
||||
writeTitle3(buf, "FC.APL0127-P7(ABC)");
|
||||
writeTableStart28(buf);
|
||||
writeAPL(buf, startAPL + 0, v -> FCDotAPL0127DashP7A.indexOf(v).codePoints()[0]);
|
||||
writeAPL(buf, startAPL + 27, v -> FCDotAPL0127DashP7B.indexOf(v).codePoints()[0]);
|
||||
writeAPL(buf, startAPL + 54, v -> FCDotAPL0127DashP7C.indexOf(v).codePoints()[0]);
|
||||
writeAPL(buf, startAPL + 0, v -> FCDotAPL0127DashP7A.valueOf(v).codePoints()[0]);
|
||||
writeAPL(buf, startAPL + 27, v -> FCDotAPL0127DashP7B.valueOf(v).codePoints()[0]);
|
||||
writeAPL(buf, startAPL + 54, v -> FCDotAPL0127DashP7C.valueOf(v).codePoints()[0]);
|
||||
writeTableEnd(buf);
|
||||
buf.append("<br><br>\n");
|
||||
|
||||
int startBYD = FourCornerDotCake.FC_BYD0127_P7D.getStart();
|
||||
writeTitle3(buf, "FC.BYD0127-P7(DEF)");
|
||||
writeTableStart28(buf);
|
||||
writeBYD(buf, startBYD + 0, v -> FCDotBYD0127DashP7D.indexOf(v).codePoints()[0]);
|
||||
writeBYD(buf, startBYD + 27, v -> FCDotBYD0127DashP7E.indexOf(v).codePoints()[0]);
|
||||
writeBYD(buf, startBYD + 54, v -> FCDotBYD0127DashP7F.indexOf(v).codePoints()[0]);
|
||||
writeBYD(buf, startBYD + 0, v -> FCDotBYD0127DashP7D.valueOf(v).codePoints()[0]);
|
||||
writeBYD(buf, startBYD + 27, v -> FCDotBYD0127DashP7E.valueOf(v).codePoints()[0]);
|
||||
writeBYD(buf, startBYD + 54, v -> FCDotBYD0127DashP7F.valueOf(v).codePoints()[0]);
|
||||
writeTableEnd(buf);
|
||||
buf.append("<br><br>\n");
|
||||
|
||||
|
|
|
@ -29,18 +29,22 @@ import org.junit.jupiter.api.Assertions;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Tests FCDotAPL1604DashS6 encoding.
|
||||
* Tests APL encoding.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 1, 2025
|
||||
*/
|
||||
public class FCDotAPL1604DashP8LTest {
|
||||
public class FCDotAPLTest {
|
||||
|
||||
@Test
|
||||
public void testValuesLength() throws Exception {
|
||||
Assertions.assertEquals(27, FCDotAPL0127DashP7A.valuesLength());
|
||||
Assertions.assertEquals(27, FCDotAPL0127DashP7B.valuesLength());
|
||||
Assertions.assertEquals(27, FCDotAPL0127DashP7C.valuesLength());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValues() throws Exception {
|
||||
Assertions.assertEquals(27, FCDotAPL0127DashP7A.length());
|
||||
Assertions.assertEquals(27, FCDotAPL0127DashP7B.length());
|
||||
Assertions.assertEquals(27, FCDotAPL0127DashP7C.length());
|
||||
boolean duplicate = false;
|
||||
Map<Integer,FCDotAPL0127DashP7A> global = new HashMap<>();
|
||||
for (FCDotAPL0127DashP7A v : FCDotAPL0127DashP7A.values()) {
|
|
@ -33,16 +33,22 @@ import org.x4o.o2o.fc18.FourCornerUnicodeDisplay;
|
|||
import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints;
|
||||
|
||||
/**
|
||||
* Tests FCDotBYD1604DashC6 encoding.
|
||||
* Tests BYD encoding.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Dec 30, 2024
|
||||
*/
|
||||
public class FCDotBYD1604DashP8HTest {
|
||||
public class FCDotBYDTest {
|
||||
|
||||
@Test
|
||||
public void testValuesLength() throws Exception {
|
||||
Assertions.assertEquals(27, FCDotBYD0127DashP7D.valuesLength());
|
||||
Assertions.assertEquals(27, FCDotBYD0127DashP7E.valuesLength());
|
||||
Assertions.assertEquals(27, FCDotBYD0127DashP7F.valuesLength());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValues() throws Exception {
|
||||
Assertions.assertEquals(27, FCDotBYD0127DashP7D.length());
|
||||
boolean duplicate = false;
|
||||
Map<Integer,FCDotBYD0127DashP7D> global = new HashMap<>();
|
||||
for (FCDotBYD0127DashP7D v : FCDotBYD0127DashP7D.values()) {
|
|
@ -22,24 +22,16 @@
|
|||
*/
|
||||
package org.x4o.o2o.fc18.zero33;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.o2o.fc18.FourCornerUnicodeDisplay;
|
||||
import org.x4o.o2o.fc18.FourCornerUnicodeMapper;
|
||||
import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints;
|
||||
import org.x4o.o2o.fc18.vt06.VTDash06DotZeroACursor;
|
||||
import org.x4o.o2o.fc18.vt06.VTDash06DotZeroCClear;
|
||||
|
||||
/**
|
||||
* Tests FCDotCDC1604DashP6 encoding.
|
||||
* Tests DEC encoding.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 08, 2025
|
||||
*/
|
||||
public class FCDotDEC0127DashP7GTest {
|
||||
public class FCDotDEC0127DashPX0Test {
|
||||
|
||||
@Test
|
||||
public void testSize() throws Exception {
|
||||
|
@ -71,29 +63,4 @@ public class FCDotDEC0127DashP7GTest {
|
|||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X3.ordinal(), seq[1]);
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X3.ordinal(), seq[2]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCusorGoto() throws Exception {
|
||||
List<FourCornerX06BaklavaPoints> cdc = new ArrayList<>();
|
||||
cdc.add(VTDash06DotZeroACursor.NX_CURSOR_GOTO);
|
||||
cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(123));
|
||||
cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_RAKA_AT);
|
||||
cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(456));
|
||||
cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_SALAH);
|
||||
|
||||
Assertions.assertEquals("␁␂␃AG␃␃␁JBCD␂␃␂␃␃␁JEFG␂␃␁", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||
// TODO: Fix lexer embedded escapes, and display external with single unicode escape sign
|
||||
Assertions.assertEquals("?AG?BCD?EFG!", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClearTop5Lines() throws Exception {
|
||||
List<FourCornerX06BaklavaPoints> cdc = new ArrayList<>();
|
||||
cdc.add(VTDash06DotZeroCClear.VT_CLEAR_TOP);
|
||||
cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_RAKA_AT);
|
||||
cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(5));
|
||||
cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_SALAH);
|
||||
|
||||
Assertions.assertEquals("␁␂␃CA␂␃␂␃␃␁JF␂␃␁", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.fc18.zero33;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.o2o.fc18.FourCornerUnicodeDisplay;
|
||||
import org.x4o.o2o.fc18.FourCornerUnicodeMapper;
|
||||
import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints;
|
||||
import org.x4o.o2o.fc18.vt06.VTDash06DotZeroACursor;
|
||||
import org.x4o.o2o.fc18.vt06.VTDash06DotZeroCClear;
|
||||
|
||||
/**
|
||||
* Tests VT-06 encoding.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 14, 2025
|
||||
*/
|
||||
public class FCDotVT06Test {
|
||||
|
||||
@Test
|
||||
public void testCusorGoto() throws Exception {
|
||||
List<FourCornerX06BaklavaPoints> cdc = new ArrayList<>();
|
||||
cdc.add(VTDash06DotZeroACursor.NX_CURSOR_GOTO);
|
||||
cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(123));
|
||||
cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_RAKA_AT);
|
||||
cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(456));
|
||||
cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_SALAH);
|
||||
|
||||
Assertions.assertEquals("␁␂␃AG␃␃␁JBCD␂␃␂␃␃␁JEFG␂␃␁", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||
// TODO: Fix lexer embedded escapes, and display external with single unicode escape sign
|
||||
//Assertions.assertEquals("?AG?BCD?EFG!", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClearTop5Lines() throws Exception {
|
||||
List<FourCornerX06BaklavaPoints> cdc = new ArrayList<>();
|
||||
cdc.add(VTDash06DotZeroCClear.VT_CLEAR_TOP);
|
||||
cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(5));
|
||||
cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_SALAH);
|
||||
|
||||
Assertions.assertEquals("␁␂␃CA␃␃␁JF␂␃␁", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue