玖星尚缘 v1.2.7版本的 MD5 值为:a5d3a854f0a33133433102e91a1193e3
以下内容为反编译后的 HighLevelEncoder.java 源代码,内容仅作参考
package com.dcloud.zxing2.aztec.encoder;
import com.alipay.sdk.m.u.n;
import com.dcloud.zxing2.common.BitArray;
import io.dcloud.common.DHInterface.IApp;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedList;
import uni.www.buchangjiuye.com.BuildConfig;
public final class HighLevelEncoder {
private static final int[][] CHAR_MAP;
static final int MODE_DIGIT = 2;
static final int MODE_LOWER = 1;
static final int MODE_MIXED = 3;
static final int MODE_PUNCT = 4;
static final int MODE_UPPER = 0;
static final int[][] SHIFT_TABLE;
private final byte[] text;
static final String[] MODE_NAMES = {"UPPER", "LOWER", "DIGIT", "MIXED", "PUNCT"};
static final int[][] LATCH_TABLE = {new int[]{0, 327708, 327710, 327709, 656318}, new int[]{590318, 0, 327710, 327709, 656318}, new int[]{262158, 590300, 0, 590301, 932798}, new int[]{327709, 327708, 656318, 0, 327710}, new int[]{327711, 656380, 656382, 656381, 0}};
static {
int[][] iArr = (int[][]) Array.newInstance(int.class, 5, 256);
CHAR_MAP = iArr;
iArr[0][32] = 1;
for (int i = 65; i <= 90; i++) {
CHAR_MAP[0][i] = (i - 65) + 2;
}
CHAR_MAP[1][32] = 1;
for (int i2 = 97; i2 <= 122; i2++) {
CHAR_MAP[1][i2] = (i2 - 97) + 2;
}
CHAR_MAP[2][32] = 1;
for (int i3 = 48; i3 <= 57; i3++) {
CHAR_MAP[2][i3] = (i3 - 48) + 2;
}
int[][] iArr2 = CHAR_MAP;
iArr2[2][44] = 12;
iArr2[2][46] = 13;
int[] iArr3 = {0, 32, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 27, 28, 29, 30, 31, 64, 92, 94, 95, 96, 124, 126, BuildConfig.VERSION_CODE};
for (int i4 = 0; i4 < 28; i4++) {
CHAR_MAP[3][iArr3[i4]] = i4;
}
int[] iArr4 = {0, 13, 0, 0, 0, 0, 33, 39, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 58, 59, 60, 61, 62, 63, 91, 93, 123, n.f};
for (int i5 = 0; i5 < 31; i5++) {
if (iArr4[i5] > 0) {
CHAR_MAP[4][iArr4[i5]] = i5;
}
}
int[][] iArr5 = (int[][]) Array.newInstance(int.class, 6, 6);
SHIFT_TABLE = iArr5;
for (int[] iArr6 : iArr5) {
Arrays.fill(iArr6, -1);
}
int[][] iArr7 = SHIFT_TABLE;
iArr7[0][4] = 0;
iArr7[1][4] = 0;
iArr7[1][0] = 28;
iArr7[3][4] = 0;
iArr7[2][4] = 0;
iArr7[2][0] = 15;
}
public HighLevelEncoder(byte[] bArr) {
this.text = bArr;
}
private static Collection<State> simplifyStates(Iterable<State> iterable) {
LinkedList linkedList = new LinkedList();
for (State state : iterable) {
boolean z = true;
Iterator it = linkedList.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
State state2 = (State) it.next();
if (state2.isBetterThanOrEqualTo(state)) {
z = false;
break;
} else if (state.isBetterThanOrEqualTo(state2)) {
it.remove();
}
}
if (z) {
linkedList.add(state);
}
}
return linkedList;
}
private void updateStateForChar(State state, int i, Collection<State> collection) {
char c = (char) (this.text[i] & IApp.ABS_PRIVATE_WWW_DIR_APP_MODE);
boolean z = CHAR_MAP[state.getMode()][c] > 0;
State state2 = null;
for (int i2 = 0; i2 <= 4; i2++) {
int i3 = CHAR_MAP[i2][c];
if (i3 > 0) {
if (state2 == null) {
state2 = state.endBinaryShift(i);
}
if (!z || i2 == state.getMode() || i2 == 2) {
collection.add(state2.latchAndAppend(i2, i3));
}
if (!z && SHIFT_TABLE[state.getMode()][i2] >= 0) {
collection.add(state2.shiftAndAppend(i2, i3));
}
}
}
if (state.getBinaryShiftByteCount() > 0 || CHAR_MAP[state.getMode()][c] == 0) {
collection.add(state.addBinaryShiftChar(i));
}
}
private static void updateStateForPair(State state, int i, int i2, Collection<State> collection) {
State endBinaryShift = state.endBinaryShift(i);
collection.add(endBinaryShift.latchAndAppend(4, i2));
if (state.getMode() != 4) {
collection.add(endBinaryShift.shiftAndAppend(4, i2));
}
if (i2 == 3 || i2 == 4) {
collection.add(endBinaryShift.latchAndAppend(2, 16 - i2).latchAndAppend(2, 1));
}
if (state.getBinaryShiftByteCount() > 0) {
collection.add(state.addBinaryShiftChar(i).addBinaryShiftChar(i + 1));
}
}
private Collection<State> updateStateListForChar(Iterable<State> iterable, int i) {
LinkedList linkedList = new LinkedList();
for (State state : iterable) {
updateStateForChar(state, i, linkedList);
}
return simplifyStates(linkedList);
}
private static Collection<State> updateStateListForPair(Iterable<State> iterable, int i, int i2) {
LinkedList linkedList = new LinkedList();
for (State state : iterable) {
updateStateForPair(state, i, i2, linkedList);
}
return simplifyStates(linkedList);
}
public BitArray encode() {
int i;
Collection<State> singletonList = Collections.singletonList(State.INITIAL_STATE);
int i2 = 0;
while (true) {
byte[] bArr = this.text;
if (i2 < bArr.length) {
int i3 = i2 + 1;
byte b = i3 < bArr.length ? bArr[i3] : (byte) 0;
byte b2 = bArr[i2];
if (b2 == 13) {
if (b == 10) {
i = 2;
}
i = 0;
} else if (b2 == 44) {
if (b == 32) {
i = 4;
}
i = 0;
} else if (b2 != 46) {
if (b2 == 58 && b == 32) {
i = 5;
}
i = 0;
} else {
if (b == 32) {
i = 3;
}
i = 0;
}
if (i > 0) {
singletonList = updateStateListForPair(singletonList, i2, i);
i2 = i3;
} else {
singletonList = updateStateListForChar(singletonList, i2);
}
i2++;
} else {
return ((State) Collections.min(singletonList, new Comparator<State>() {
@Override
public int compare(State state, State state2) {
return state.getBitCount() - state2.getBitCount();
}
})).toBitArray(this.text);
}
}
}
}