All files / output cl_abap_bigint.clas.mjs

7.1% Statements 12/169
66.66% Branches 2/3
5.26% Functions 1/19
7.1% Lines 12/169

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 165 166 167 168 1691x 1x               1x 1x 1x 1x 1x 1x 1x 1x                                                                                                                                                                                                                                                                                                             1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// cl_abap_bigint.clas.abap
class cl_abap_bigint {
  static STATIC_SUPER = undefined;
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'CL_ABAP_BIGINT';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {"MV_VALUE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "I", "is_constant": " ", "is_class": " "}};
  static METHODS = {"FACTORY_FROM_INT4": {"visibility": "U", "parameters": {"RO_BIGINT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});}, "is_optional": " ", "parm_kind": "R", "type_name": "ObjectReferenceType"}, "IV_VALUE": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "I", "type_name": "IntegerType"}}},
  "ADD_INT4": {"visibility": "U", "parameters": {"RO_MYSELF": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});}, "is_optional": " ", "parm_kind": "R", "type_name": "ObjectReferenceType"}, "IV_VALUE": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "I", "type_name": "IntegerType"}}},
  "TO_STRING": {"visibility": "U", "parameters": {"RV_STRING": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "StringType"}}},
  "SUB": {"visibility": "U", "parameters": {"RO_MYSELF": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});}, "is_optional": " ", "parm_kind": "R", "type_name": "ObjectReferenceType"}, "IO_BIGINT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});}, "is_optional": " ", "parm_kind": "I", "type_name": "ObjectReferenceType"}}},
  "MUL": {"visibility": "U", "parameters": {"RO_MYSELF": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});}, "is_optional": " ", "parm_kind": "R", "type_name": "ObjectReferenceType"}, "IO_BIGINT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});}, "is_optional": " ", "parm_kind": "I", "type_name": "ObjectReferenceType"}}},
  "MOD": {"visibility": "U", "parameters": {"RO_MYSELF": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});}, "is_optional": " ", "parm_kind": "R", "type_name": "ObjectReferenceType"}, "IO_BIGINT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});}, "is_optional": " ", "parm_kind": "I", "type_name": "ObjectReferenceType"}}},
  "CLONE": {"visibility": "U", "parameters": {"RO_BIGINT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});}, "is_optional": " ", "parm_kind": "R", "type_name": "ObjectReferenceType"}}},
  "SQRT": {"visibility": "U", "parameters": {"RO_MYSELF": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});}, "is_optional": " ", "parm_kind": "R", "type_name": "ObjectReferenceType"}}},
  "IS_EQUAL": {"visibility": "U", "parameters": {"RV_EQUAL": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " ", "parm_kind": "R", "type_name": "CharacterType"}, "IO_BIGINT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});}, "is_optional": " ", "parm_kind": "I", "type_name": "ObjectReferenceType"}}},
  "IS_LARGER": {"visibility": "U", "parameters": {"RV_LARGER": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " ", "parm_kind": "R", "type_name": "CharacterType"}, "IO_BIGINT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});}, "is_optional": " ", "parm_kind": "I", "type_name": "ObjectReferenceType"}}}};
  #mv_value;
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
      "add_int4": this.add_int4.bind(this),
      "to_string": this.to_string.bind(this),
      "sub": this.sub.bind(this),
      "mul": this.mul.bind(this),
      "mod": this.mod.bind(this),
      "clone": this.clone.bind(this),
      "sqrt": this.sqrt.bind(this),
      "is_equal": this.is_equal.bind(this),
      "is_larger": this.is_larger.bind(this),
    };
    this.#mv_value = new abap.types.String({qualifiedName: "STRING"});
    this.FRIENDS_ACCESS_INSTANCE["mv_value"] = this.#mv_value;
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async factory_from_int4(INPUT) {
    return cl_abap_bigint.factory_from_int4(INPUT);
  }
  static async factory_from_int4(INPUT) {
    let ro_bigint = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});
    let iv_value = new abap.types.Integer({qualifiedName: "I"});
    if (INPUT && INPUT.iv_value) {iv_value.set(INPUT.iv_value);}
    if (INPUT === undefined || INPUT.iv_value === undefined) {iv_value = abap.IntegerFactory.get(0);}
    ro_bigint.set(await (new abap.Classes['CL_ABAP_BIGINT']()).constructor_());
    ro_bigint.get().#mv_value.set(BigInt(iv_value.get()).toString());
    return ro_bigint;
  }
  async add_int4(INPUT) {
    let ro_myself = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});
    let iv_value = INPUT?.iv_value;
    if (iv_value?.getQualifiedName === undefined || iv_value.getQualifiedName() !== "I") { iv_value = undefined; }
    if (iv_value === undefined) { iv_value = new abap.types.Integer({qualifiedName: "I"}).set(INPUT.iv_value); }
    ro_myself.set(this.me);
    this.#mv_value.set((BigInt(this.#mv_value.get() || "0") + BigInt(iv_value.get())).toString());
    return ro_myself;
  }
  async to_string() {
    let rv_string = new abap.types.String({qualifiedName: "STRING"});
    rv_string.set(this.#mv_value);
    if (abap.compare.initial(rv_string)) {
      rv_string.set(abap.CharacterFactory.get(1, '0'));
    }
    return rv_string;
  }
  async sub(INPUT) {
    let ro_myself = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});
    let io_bigint = INPUT?.io_bigint;
    if (io_bigint?.getQualifiedName === undefined || io_bigint.getQualifiedName() !== "CL_ABAP_BIGINT") { io_bigint = undefined; }
    if (io_bigint === undefined) { io_bigint = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"}).set(INPUT.io_bigint); }
    if (abap.compare.initial(io_bigint)) {
      const unique1398 = await (new abap.Classes['CX_SY_REF_IS_INITIAL']()).constructor_();
      unique1398.EXTRA_CX = {"INTERNAL_FILENAME": "cl_abap_bigint.clas.abap","INTERNAL_LINE": 97};
      throw unique1398;
    }
    ro_myself.set(this.me);
    this.#mv_value.set((BigInt(this.#mv_value.get() || "0") - BigInt(io_bigint.get().#mv_value.get() || "0")).toString());
    return ro_myself;
  }
  async mul(INPUT) {
    let ro_myself = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});
    let io_bigint = INPUT?.io_bigint;
    if (io_bigint?.getQualifiedName === undefined || io_bigint.getQualifiedName() !== "CL_ABAP_BIGINT") { io_bigint = undefined; }
    if (io_bigint === undefined) { io_bigint = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"}).set(INPUT.io_bigint); }
    if (abap.compare.initial(io_bigint)) {
      const unique1399 = await (new abap.Classes['CX_SY_REF_IS_INITIAL']()).constructor_();
      unique1399.EXTRA_CX = {"INTERNAL_FILENAME": "cl_abap_bigint.clas.abap","INTERNAL_LINE": 106};
      throw unique1399;
    }
    ro_myself.set(this.me);
    this.#mv_value.set((BigInt(this.#mv_value.get() || "0") * BigInt(io_bigint.get().#mv_value.get() || "0")).toString());
    return ro_myself;
  }
  async mod(INPUT) {
    let ro_myself = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});
    let io_bigint = INPUT?.io_bigint;
    if (io_bigint?.getQualifiedName === undefined || io_bigint.getQualifiedName() !== "CL_ABAP_BIGINT") { io_bigint = undefined; }
    if (io_bigint === undefined) { io_bigint = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"}).set(INPUT.io_bigint); }
    let lv_divisor = new abap.types.String({qualifiedName: "STRING"});
    if (abap.compare.initial(io_bigint)) {
      const unique1400 = await (new abap.Classes['CX_SY_REF_IS_INITIAL']()).constructor_();
      unique1400.EXTRA_CX = {"INTERNAL_FILENAME": "cl_abap_bigint.clas.abap","INTERNAL_LINE": 117};
      throw unique1400;
    }
    lv_divisor.set((await io_bigint.get().to_string()));
    if (abap.compare.eq(lv_divisor, abap.CharacterFactory.get(1, '0'))) {
      const unique1401 = await (new abap.Classes['CX_SY_ZERODIVIDE']()).constructor_();
      unique1401.EXTRA_CX = {"INTERNAL_FILENAME": "cl_abap_bigint.clas.abap","INTERNAL_LINE": 122};
      throw unique1401;
    }
    ro_myself.set(this.me);
    this.#mv_value.set((BigInt(this.#mv_value.get() || "0") % BigInt(lv_divisor.get())).toString());
    return ro_myself;
  }
  async clone() {
    let ro_bigint = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});
    ro_bigint.set(await (new abap.Classes['CL_ABAP_BIGINT']()).constructor_());
    ro_bigint.get().#mv_value.set(this.#mv_value.get());
    return ro_bigint;
  }
  async sqrt() {
    let ro_myself = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"});
    let lv_value = new abap.types.String({qualifiedName: "STRING"});
    lv_value.set((await this.to_string()));
    if (abap.compare.cp(lv_value, abap.CharacterFactory.get(2, '-*'))) {
      const unique1402 = await (new abap.Classes['CX_SY_ARG_OUT_OF_DOMAIN']()).constructor_();
      unique1402.EXTRA_CX = {"INTERNAL_FILENAME": "cl_abap_bigint.clas.abap","INTERNAL_LINE": 138};
      throw unique1402;
    }
    ro_myself.set(this.me);
    { const n = BigInt(this.#mv_value.get() || "0"); if (n < 2n) { this.#mv_value.set(n.toString()); } else { let x0 = n; let x1 = (x0 + 1n) >> 1n; while (x1 < x0) { x0 = x1; x1 = (x1 + n / x1) >> 1n; } this.#mv_value.set(x0.toString()); } }
    return ro_myself;
  }
  async is_equal(INPUT) {
    let rv_equal = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    let io_bigint = INPUT?.io_bigint;
    if (io_bigint?.getQualifiedName === undefined || io_bigint.getQualifiedName() !== "CL_ABAP_BIGINT") { io_bigint = undefined; }
    if (io_bigint === undefined) { io_bigint = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"}).set(INPUT.io_bigint); }
    if (abap.compare.initial(io_bigint)) {
      const unique1403 = await (new abap.Classes['CX_SY_REF_IS_INITIAL']()).constructor_();
      unique1403.EXTRA_CX = {"INTERNAL_FILENAME": "cl_abap_bigint.clas.abap","INTERNAL_LINE": 147};
      throw unique1403;
    }
    rv_equal.set(abap.builtin.abap_false);
    rv_equal.set(BigInt(this.#mv_value.get() || "0") === BigInt(io_bigint.get().#mv_value.get() || "0") ? "X" : "");
    return rv_equal;
  }
  async is_larger(INPUT) {
    let rv_larger = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    let io_bigint = INPUT?.io_bigint;
    if (io_bigint?.getQualifiedName === undefined || io_bigint.getQualifiedName() !== "CL_ABAP_BIGINT") { io_bigint = undefined; }
    if (io_bigint === undefined) { io_bigint = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_BIGINT", RTTIName: "\\CLASS=CL_ABAP_BIGINT"}).set(INPUT.io_bigint); }
    if (abap.compare.initial(io_bigint)) {
      const unique1404 = await (new abap.Classes['CX_SY_REF_IS_INITIAL']()).constructor_();
      unique1404.EXTRA_CX = {"INTERNAL_FILENAME": "cl_abap_bigint.clas.abap","INTERNAL_LINE": 156};
      throw unique1404;
    }
    rv_larger.set(abap.builtin.abap_false);
    rv_larger.set(BigInt(this.#mv_value.get() || "0") > BigInt(io_bigint.get().#mv_value.get() || "0") ? "X" : "");
    return rv_larger;
  }
}
abap.Classes['CL_ABAP_BIGINT'] = cl_abap_bigint;
export {cl_abap_bigint};