All files / output zcl_abapgit_zlib_convert.clas.mjs

100% Statements 70/70
91.66% Branches 11/12
63.63% Functions 7/11
100% Lines 70/70

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 701x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 1x 2x 2x 2x 1x 1x 1x 1x 504x 504x 504x 504x 504x 504x 504x 1634x 1634x 1634x 1634x 1634x 504x 504x 504x 1x 1x 1x 1x 1064x 1064x 1064x 1064x 1064x 1064x 1064x 1064x 1064x 1065x 1065x 1065x 1065x 1065x 8520x 8520x 8520x 8520x 1065x 1065x 1065x 1064x 1064x 1064x 1x 1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_zlib_convert.clas.abap
class zcl_abapgit_zlib_convert {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_ZLIB_CONVERT';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {};
  static METHODS = {"HEX_TO_BITS": {"visibility": "U", "parameters": {"RV_BITS": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_HEX": {"type": () => {return new abap.types.Hex();}, "is_optional": " "}}},
  "BITS_TO_INT": {"visibility": "U", "parameters": {"RV_INT": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " "}, "IV_BITS": {"type": () => {return new abap.types.Character();}, "is_optional": " "}}}};
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
    };
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async bits_to_int(INPUT) {
    return zcl_abapgit_zlib_convert.bits_to_int(INPUT);
  }
  static async bits_to_int(INPUT) {
    let rv_int = new abap.types.Integer({qualifiedName: "I"});
    let iv_bits = INPUT?.iv_bits;
    let lv_i = new abap.types.Integer({qualifiedName: "I"});
    let lv_offset = new abap.types.Integer({qualifiedName: "I"});
    const indexBackup1 = abap.builtin.sy.get().index.get();
    const unique204 = abap.builtin.strlen({val: iv_bits}).get();
    for (let unique205 = 0; unique205 < unique204; unique205++) {
      abap.builtin.sy.get().index.set(unique205 + 1);
      lv_i.set(iv_bits.getOffset({offset: lv_offset, length: 1}));
      rv_int.set(abap.operators.add(abap.operators.multiply(rv_int,abap.IntegerFactory.get(2)),lv_i));
      lv_offset.set(abap.operators.add(lv_offset,abap.IntegerFactory.get(1)));
    }
    abap.builtin.sy.get().index.set(indexBackup1);
    return rv_int;
  }
  async hex_to_bits(INPUT) {
    return zcl_abapgit_zlib_convert.hex_to_bits(INPUT);
  }
  static async hex_to_bits(INPUT) {
    let rv_bits = new abap.types.String({qualifiedName: "STRING"});
    let iv_hex = INPUT?.iv_hex;
    let lv_x = new abap.types.Hex();
    let lv_c = new abap.types.Character(1, {});
    let lv_hex = new abap.types.XString({qualifiedName: "XSTRING"});
    lv_hex.set(iv_hex);
    const indexBackup1 = abap.builtin.sy.get().index.get();
    let unique206 = 1;
    while (abap.compare.initial(lv_hex) === false) {
      abap.builtin.sy.get().index.set(unique206++);
      lv_x.set(lv_hex);
      const indexBackup2 = abap.builtin.sy.get().index.get();
      const unique207 = abap.IntegerFactory.get(8).get();
      for (let unique208 = 0; unique208 < unique207; unique208++) {
        abap.builtin.sy.get().index.set(unique208 + 1);
        abap.statements.getBit(abap.builtin.sy.get().index, lv_x, lv_c);
        abap.statements.concatenate({source: [rv_bits, lv_c], target: rv_bits});
      }
      abap.builtin.sy.get().index.set(indexBackup2);
      lv_hex.set(lv_hex.getOffset({offset: 1}));
    }
    abap.builtin.sy.get().index.set(indexBackup1);
    return rv_bits;
  }
}
abap.Classes['ZCL_ABAPGIT_ZLIB_CONVERT'] = zcl_abapgit_zlib_convert;
export {zcl_abapgit_zlib_convert};