void addChar(byte c, Encoding enc) { int c_ = c & 0xff; if (map[c_] == 0) { map[c_] = 1; value += positionValue(enc, c_); } }
void addChar(byte c, Encoding enc) { int c_ = c & 0xff; if (map[c_] == 0) { map[c_] = 1; value += positionValue(enc, c_); } }
void select(OptExactInfo alt, Encoding enc) { int v1 = length; int v2 = alt.length; if (v2 == 0) { return; } else if (v1 == 0) { copy(alt); return; } else if (v1 <= 2 && v2 <= 2) { /* ByteValTable[x] is big value --> low price */ v2 = OptMapInfo.positionValue(enc, bytes[0] & 0xff); v1 = OptMapInfo.positionValue(enc, alt.bytes[0] & 0xff); if (length > 1) v1 += 5; if (alt.length > 1) v2 += 5; } if (ignoreCase <= 0) v1 *= 2; if (alt.ignoreCase <= 0) v2 *= 2; if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) copy(alt); }
void select(OptExactInfo alt, Encoding enc) { int v1 = length; int v2 = alt.length; if (v2 == 0) { return; } else if (v1 == 0) { copy(alt); return; } else if (v1 <= 2 && v2 <= 2) { /* ByteValTable[x] is big value --> low price */ v2 = OptMapInfo.positionValue(enc, bytes[0] & 0xff); v1 = OptMapInfo.positionValue(enc, alt.bytes[0] & 0xff); if (length > 1) v1 += 5; if (alt.length > 1) v2 += 5; } if (ignoreCase <= 0) v1 *= 2; if (alt.ignoreCase <= 0) v2 *= 2; if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) copy(alt); }
void altMerge(OptMapInfo other, Encoding enc) { /* if (! is_equal_mml(&to->mmd, &add->mmd)) return ; */ if (value == 0) return; if (other.value == 0 || mmd.max < other.mmd.max) { clear(); return; } mmd.altMerge(other.mmd); int val = 0; for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) { if (other.map[i] != 0) map[i] = 1; if (map[i] != 0) val += positionValue(enc, i); } value = val; anchor.altMerge(other.anchor); }
void altMerge(OptMapInfo other, Encoding enc) { /* if (! is_equal_mml(&to->mmd, &add->mmd)) return ; */ if (value == 0) return; if (other.value == 0 || mmd.max < other.mmd.max) { clear(); return; } mmd.altMerge(other.mmd); int val = 0; for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) { if (other.map[i] != 0) map[i] = 1; if (map[i] != 0) val += positionValue(enc, i); } value = val; anchor.altMerge(other.anchor); }