All files / output zcl_abapgit_zlib_stream.clas.mjs

98.78% Statements 163/165
100% Branches 26/26
44% Functions 11/25
98.78% Lines 163/165

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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 1651x 1x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 1x 1x 1x 1x 1x 1x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x     23x 1x 1x 1x 1x 1x 1x 1x 256x 256x 256x 256x 256x 256x 256x 2048x 2048x 2048x 2048x 256x 256x 256x 1x 1x 23x 7x 7x 23x 23x 23x 23x 23x 23x 23x 23x 23x 92x 92x 92x 92x 23x 570x 570x 570x 570x 570x 570x 570x 570x 570x 550x 550x 245x 245x 245x 245x 245x 550x 550x 239x 239x 550x 311x 311x 311x 311x 550x 570x 570x 570x 23x 6945x 6945x 6945x 6945x 871x 871x 871x 871x 871x 6945x 6945x 6945x 6945x 6945x 23x 10x 10x 10x 10x 10x 10x 10x 10x 23x 519x 519x 519x 519x 519x 519x 519x 519x 519x 519x 519x 1841x 1841x 1841x 1841x 1841x 519x 519x 519x 23x 1x 1x 1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_zlib_stream.clas.abap
class zcl_abapgit_zlib_stream {
  static STATIC_SUPER = undefined;
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_ZLIB_STREAM';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {"GT_BYTE_BITS": {"type": () => {return abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "");}, "visibility": "I", "is_constant": " ", "is_class": "X"},
  "MV_BITS": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "MV_COMPRESSED": {"type": () => {return new abap.types.XString({qualifiedName: "XSTRING"});}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "MV_OFFSET": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "visibility": "I", "is_constant": " ", "is_class": " "}};
  static METHODS = {"CLASS_CONSTRUCTOR": {"visibility": "U", "parameters": {}},
  "CONSTRUCTOR": {"visibility": "U", "parameters": {"IV_DATA": {"type": () => {return new abap.types.XString({qualifiedName: "XSTRING"});}, "is_optional": " ", "parm_kind": "I", "type_name": "XStringType"}}},
  "TAKE_BITS": {"visibility": "U", "parameters": {"RV_BITS": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "StringType"}, "IV_LENGTH": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "I", "type_name": "IntegerType"}}},
  "TAKE_BIT": {"visibility": "U", "parameters": {"RV_BIT": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "R", "type_name": "IntegerType"}}},
  "TAKE_INT": {"visibility": "U", "parameters": {"RV_INT": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "R", "type_name": "IntegerType"}, "IV_LENGTH": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "I", "type_name": "IntegerType"}}},
  "REMAINING": {"visibility": "U", "parameters": {"RV_LENGTH": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "R", "type_name": "IntegerType"}}},
  "TAKE_BYTES": {"visibility": "U", "parameters": {"RV_BYTES": {"type": () => {return new abap.types.XString({qualifiedName: "XSTRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "XStringType"}, "IV_LENGTH": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "I", "type_name": "IntegerType"}}},
  "CLEAR_BITS": {"visibility": "U", "parameters": {}}};
  #gt_byte_bits;
  #mv_bits;
  #mv_compressed;
  #mv_offset;
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
      "take_bits": this.take_bits.bind(this),
      "take_bit": this.take_bit.bind(this),
      "take_int": this.take_int.bind(this),
      "remaining": this.remaining.bind(this),
      "take_bytes": this.take_bytes.bind(this),
      "clear_bits": this.clear_bits.bind(this),
    };
    this.gt_byte_bits = zcl_abapgit_zlib_stream.gt_byte_bits;
    this.#mv_bits = new abap.types.String({qualifiedName: "STRING"});
    this.FRIENDS_ACCESS_INSTANCE["mv_bits"] = this.#mv_bits;
    this.#mv_compressed = new abap.types.XString({qualifiedName: "XSTRING"});
    this.FRIENDS_ACCESS_INSTANCE["mv_compressed"] = this.#mv_compressed;
    this.#mv_offset = new abap.types.Integer({qualifiedName: "I"});
    this.FRIENDS_ACCESS_INSTANCE["mv_offset"] = this.#mv_offset;
  }
  async class_constructor() {
    return zcl_abapgit_zlib_stream.class_constructor();
  }
  static async class_constructor() {
    let lv_x = new abap.types.Hex();
    let lv_bits = new abap.types.String({qualifiedName: "STRING"});
    let lv_c = new abap.types.Character(1, {});
    let lv_int = new abap.types.Integer({qualifiedName: "I"});
    const indexBackup1 = abap.builtin.sy.get().index.get();
    const unique486 = new abap.types.Integer().set(256).get();
    for (let unique487 = 0; unique487 < unique486; unique487++) {
      abap.builtin.sy.get().index.set(unique487 + 1);
      lv_int.set(abap.operators.minus(abap.builtin.sy.get().index,abap.IntegerFactory.get(1)));
      lv_x.set(lv_int);
      lv_bits.clear();
      const indexBackup2 = abap.builtin.sy.get().index.get();
      const unique488 = abap.IntegerFactory.get(8).get();
      for (let unique489 = 0; unique489 < unique488; unique489++) {
        abap.builtin.sy.get().index.set(unique489 + 1);
        abap.statements.getBit(abap.builtin.sy.get().index, lv_x, lv_c);
        abap.statements.concatenate({source: [lv_bits, lv_c], target: lv_bits});
      }
      abap.builtin.sy.get().index.set(indexBackup2);
      abap.statements.append({source: lv_bits, target: zcl_abapgit_zlib_stream.gt_byte_bits});
    }
    abap.builtin.sy.get().index.set(indexBackup1);
  }
  async clear_bits() {
    this.#mv_bits.clear();
  }
  async constructor_(INPUT) {
    let iv_data = INPUT?.iv_data;
    if (iv_data?.getQualifiedName === undefined || iv_data.getQualifiedName() !== "XSTRING") { iv_data = undefined; }
    if (iv_data === undefined) { iv_data = new abap.types.XString({qualifiedName: "XSTRING"}).set(INPUT.iv_data); }
    this.#mv_compressed.set(iv_data);
    this.#mv_offset.set(abap.IntegerFactory.get(0));
    return this;
  }
  async remaining() {
    let rv_length = new abap.types.Integer({qualifiedName: "I"});
    rv_length.set(abap.operators.minus(abap.operators.add(abap.builtin.xstrlen({val: this.#mv_compressed}),abap.IntegerFactory.get(1)),this.#mv_offset));
    return rv_length;
  }
  async take_bits(INPUT) {
    let rv_bits = new abap.types.String({qualifiedName: "STRING"});
    let iv_length = INPUT?.iv_length;
    if (iv_length?.getQualifiedName === undefined || iv_length.getQualifiedName() !== "I") { iv_length = undefined; }
    if (iv_length === undefined) { iv_length = new abap.types.Integer({qualifiedName: "I"}).set(INPUT.iv_length); }
    let lv_left = new abap.types.Integer({qualifiedName: "I"});
    let lv_index = new abap.types.Integer({qualifiedName: "I"});
    const indexBackup1 = abap.builtin.sy.get().index.get();
    let unique490 = 1;
    while (abap.compare.lt(abap.builtin.strlen({val: rv_bits}), iv_length)) {
      abap.builtin.sy.get().index.set(unique490++);
      if (abap.compare.initial(this.#mv_bits)) {
        lv_index.set(abap.operators.add(this.#mv_compressed.getOffset({offset: this.#mv_offset, length: 1}),abap.IntegerFactory.get(1)));
        abap.statements.readTable(zcl_abapgit_zlib_stream.gt_byte_bits,{index: lv_index,
          into: this.#mv_bits});
        this.#mv_offset.set(abap.operators.add(this.#mv_offset,abap.IntegerFactory.get(1)));
      }
      lv_left.set(abap.operators.minus(iv_length,abap.builtin.strlen({val: rv_bits})));
      if (abap.compare.ge(lv_left, abap.builtin.strlen({val: this.#mv_bits}))) {
        abap.statements.concatenate({source: [this.#mv_bits, rv_bits], target: rv_bits});
        this.#mv_bits.clear();
      } else {
        lv_index.set(abap.operators.minus(abap.builtin.strlen({val: this.#mv_bits}),lv_left));
        abap.statements.concatenate({source: [this.#mv_bits.getOffset({offset: lv_index, length: lv_left}), rv_bits], target: rv_bits});
        this.#mv_bits.set(this.#mv_bits.getOffset({length: lv_index}));
      }
    }
    abap.builtin.sy.get().index.set(indexBackup1);
    return rv_bits;
  }
  async take_bit() {
    let rv_bit = new abap.types.Integer({qualifiedName: "I"});
    let lv_index = new abap.types.Integer({qualifiedName: "I"});
    let lv_len = new abap.types.Integer({qualifiedName: "I"});
    if (abap.compare.initial(this.#mv_bits)) {
      lv_index.set(abap.operators.add(this.#mv_compressed.getOffset({offset: this.#mv_offset, length: 1}),abap.IntegerFactory.get(1)));
      abap.statements.readTable(zcl_abapgit_zlib_stream.gt_byte_bits,{index: lv_index,
        into: this.#mv_bits});
      this.#mv_offset.set(abap.operators.add(this.#mv_offset,abap.IntegerFactory.get(1)));
    }
    lv_len.set(abap.operators.minus(abap.builtin.strlen({val: this.#mv_bits}),abap.IntegerFactory.get(1)));
    rv_bit.set(this.#mv_bits.getOffset({offset: lv_len, length: 1}));
    this.#mv_bits.set(this.#mv_bits.getOffset({length: lv_len}));
    return rv_bit;
  }
  async take_bytes(INPUT) {
    let rv_bytes = new abap.types.XString({qualifiedName: "XSTRING"});
    let iv_length = INPUT?.iv_length;
    if (iv_length?.getQualifiedName === undefined || iv_length.getQualifiedName() !== "I") { iv_length = undefined; }
    if (iv_length === undefined) { iv_length = new abap.types.Integer({qualifiedName: "I"}).set(INPUT.iv_length); }
    rv_bytes.set(this.#mv_compressed.getOffset({offset: this.#mv_offset, length: iv_length}));
    this.#mv_offset.set(abap.operators.add(this.#mv_offset,iv_length));
    return rv_bytes;
  }
  async take_int(INPUT) {
    let rv_int = new abap.types.Integer({qualifiedName: "I"});
    let iv_length = INPUT?.iv_length;
    if (iv_length?.getQualifiedName === undefined || iv_length.getQualifiedName() !== "I") { iv_length = undefined; }
    if (iv_length === undefined) { iv_length = new abap.types.Integer({qualifiedName: "I"}).set(INPUT.iv_length); }
    let lv_bits = new abap.types.String({qualifiedName: "STRING"});
    let lv_i = new abap.types.Integer({qualifiedName: "I"});
    let lv_offset = new abap.types.Integer({qualifiedName: "I"});
    lv_bits.set((await this.take_bits({iv_length: iv_length})));
    const indexBackup1 = abap.builtin.sy.get().index.get();
    const unique491 = abap.builtin.strlen({val: lv_bits}).get();
    for (let unique492 = 0; unique492 < unique491; unique492++) {
      abap.builtin.sy.get().index.set(unique492 + 1);
      lv_i.set(lv_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;
  }
}
abap.Classes['ZCL_ABAPGIT_ZLIB_STREAM'] = zcl_abapgit_zlib_stream;
zcl_abapgit_zlib_stream.gt_byte_bits = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "");
await abap.Classes['ZCL_ABAPGIT_ZLIB_STREAM'].class_constructor();
export {zcl_abapgit_zlib_stream};