Removed un-need list conversion in sub/super script unicode mapper

This commit is contained in:
Willem Cazander 2025-01-20 01:29:49 +01:00
parent e5d8bacc5e
commit 72d8ff03a9
2 changed files with 8 additions and 16 deletions

View file

@ -222,17 +222,9 @@ public class FourCornerUnicodeDisplay {
@Override
public void strobeNCR1632(BigInteger denominator, BigInteger numerator) {
List<Integer> math = new ArrayList<>();
FourCornerUnicodeMapper.DICTIONARY.toScriptSuper(numerator).forEach(v -> {
for (int chr : v.cakePointSequence()) {
math.add(chr);
}
});
FourCornerUnicodeMapper.DICTIONARY.toScriptSuper(numerator).forEach(v -> math.add(v.cakePointDotIndex()));
math.add(FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.ordinal());
FourCornerUnicodeMapper.DICTIONARY.toScriptSub(denominator).forEach(v -> {
for (int chr : v.cakePointSequence()) {
math.add(chr);
}
});
FourCornerUnicodeMapper.DICTIONARY.toScriptSub(denominator).forEach(v -> math.add(v.cakePointDotIndex()));
renderFromInt18(math, output);
}

View file

@ -163,24 +163,24 @@ public enum FourCornerUnicodeMapper {
return result;
}
public List<FourCornerX18CakePointSequence> toScriptSuper(int value) {
public List<FourCornerX18CakePointDotIndex> toScriptSuper(int value) {
return toScript(Integer.toString(value), 0);
}
public List<FourCornerX18CakePointSequence> toScriptSub(int value) {
public List<FourCornerX18CakePointDotIndex> toScriptSub(int value) {
return toScript(Integer.toString(value), 10);
}
public List<FourCornerX18CakePointSequence> toScriptSuper(BigInteger value) {
public List<FourCornerX18CakePointDotIndex> toScriptSuper(BigInteger value) {
return toScript(value.toString(10), 0);
}
public List<FourCornerX18CakePointSequence> toScriptSub(BigInteger value) {
public List<FourCornerX18CakePointDotIndex> toScriptSub(BigInteger value) {
return toScript(value.toString(10), 10);
}
private List<FourCornerX18CakePointSequence> toScript(String value, int off) {
List<FourCornerX18CakePointSequence> result = new ArrayList<>();
private List<FourCornerX18CakePointDotIndex> toScript(String value, int off) {
List<FourCornerX18CakePointDotIndex> result = new ArrayList<>();
PrimitiveIterator.OfInt i = value.codePoints().iterator();
while (i.hasNext()) {
int chr = i.nextInt();