Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- switch (type) {
- case V_LIST:
- case V_SPACED:
- char sep = type == V_LIST ? ';' : ' ';
- int cnt = 0;
- for (int i = 0; i < value.length(); i++)
- if (value.charAt(i) == sep)
- cnt++;
- assert cnt >= 1;
- int addToCode = 0;
- switch (cnt) {
- case 1:
- cld.addCode(out, name, type);
- addToCode = 1;
- break;
- case 2:
- cld.addCode(out, name, type - 1);
- addToCode = 1;
- break;
- default: // 3+
- cld.addCode(out, name, type - 2);
- cld.addCode(out, name, cnt - 3);
- addToCode = 2;
- }
- for (int i = 0; i <= value.length();) {
- int j = value.indexOf(sep, i);
- if (j < 0)
- j = value.length();
- long res = writeValueItem(out, name, value.substring(i, j), deltasListForField, deltaIndex, cld, false);
- deltaIndex = (int) (res >> 32);
- int addCodes = (int) (res << 32 >> 32);
- addToCode += addCodes;
- i = j + 1;
- }
- currentFieldCodes += addToCode;
- cld.addFieldSizeInCodes(addFieldSize, addToCode);
- break;
- case V_STR_DECIMAL:
- int ofs = ((int)typeCode) >>> OFS_SHIFT;
- String s = value.substring(0, ofs);
- cld.addCode(out, name, type);
- long res = writeValueItem(out, name, s, deltasListForField, deltaIndex, cld, false);
- deltaIndex = (int) (res >> 32);
- int addCodes = (int) (res << 32 >> 32);
- addToCode = addCodes + 1;
- if (Decimal.toDouble(num) - decimalToDouble(delta.prevNum) < 0) {
- addToCode += 2;
- } else {
- addToCode++;
- }
- currentFieldCodes += addToCode;
- cld.addFieldSizeInCodes(addFieldSize, addToCode);
- // FALLS THOUGH TO DECIMAL-DELTA WRITING !
- case V_DECIMAL:
- double beforeCompose = Decimal.toDouble(num) - decimalToDouble(delta.prevNum);
- d = Decimal.compose(beforeCompose);
- delta.prevNum = num;
- int addToCodeDecimal = 1;
- if (type == V_DECIMAL) {
- cld.addCode(out, name, type);
- }
- if (beforeCompose < 0) {
- cld.addCode(out, name, BinaryIPF.NOT_DELTA_FOR_DECIMAL);
- addToCodeDecimal++;
- d = num;
- }
- cld.addCode(out, name, d);
- addToCodeDecimal++;
- if (type == V_DECIMAL) {
- currentFieldCodes += addToCodeDecimal;
- cld.addFieldSizeInCodes(addFieldSize, addToCodeDecimal);
- }
- break;
- case V_DATE_COMPACT:
- case V_DATE_FULL:
- d = num - delta.prevDateNum;
- delta.prevDateNum = num;
- cld.addCode(out, name, type);
- cld.addCode(out, name, d);
- currentFieldCodes += 2;
- cld.addFieldSizeInCodes(addFieldSize, 2);
- break;
- default:
- throw new AssertionError();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement