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 | 1x 1x 1x 1x | const {cx_root} = await import("./cx_root.clas.mjs");
// cl_abap_random_int.clas.abap
class cl_abap_random_int {
static STATIC_SUPER = undefined;
static INTERNAL_TYPE = 'CLAS';
static INTERNAL_NAME = 'CL_ABAP_RANDOM_INT';
static IMPLEMENTED_INTERFACES = [];
static ATTRIBUTES = {"MV_MIN": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "visibility": "I", "is_constant": " ", "is_class": " "},
"MV_MAX": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "visibility": "I", "is_constant": " ", "is_class": " "}};
static METHODS = {"CREATE": {"visibility": "U", "parameters": {"PRNG": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "CL_ABAP_RANDOM_INT", RTTIName: "\\CLASS=CL_ABAP_RANDOM_INT"});}, "is_optional": " ", "parm_kind": "R", "type_name": "ObjectReferenceType"}, "SEED": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "I", "type_name": "IntegerType"}, "MIN": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "I", "type_name": "IntegerType"}, "MAX": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "I", "type_name": "IntegerType"}}},
"GET_NEXT": {"visibility": "U", "parameters": {"VALUE": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "R", "type_name": "IntegerType"}}}};
#mv_min;
#mv_max;
constructor() {
this.me = new abap.types.ABAPObject();
this.me.set(this);
this.INTERNAL_ID = abap.internalIdCounter++;
this.FRIENDS_ACCESS_INSTANCE = {
"get_next": this.get_next.bind(this),
};
this.#mv_min = new abap.types.Integer({qualifiedName: "I"});
this.FRIENDS_ACCESS_INSTANCE["mv_min"] = this.#mv_min;
this.#mv_max = new abap.types.Integer({qualifiedName: "I"});
this.FRIENDS_ACCESS_INSTANCE["mv_max"] = this.#mv_max;
}
async constructor_(INPUT) {
if (super.constructor_) { await super.constructor_(INPUT); }
return this;
}
async create(INPUT) {
return cl_abap_random_int.create(INPUT);
}
static async create(INPUT) {
let prng = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_RANDOM_INT", RTTIName: "\\CLASS=CL_ABAP_RANDOM_INT"});
let seed = new abap.types.Integer({qualifiedName: "I"});
if (INPUT && INPUT.seed) {seed.set(INPUT.seed);}
let min = new abap.types.Integer({qualifiedName: "I"});
if (INPUT && INPUT.min) {min.set(INPUT.min);}
if (INPUT === undefined || INPUT.min === undefined) {min = new abap.types.Integer().set(-2147483648);}
let max = new abap.types.Integer({qualifiedName: "I"});
if (INPUT && INPUT.max) {max.set(INPUT.max);}
if (INPUT === undefined || INPUT.max === undefined) {max = new abap.types.Integer().set(2147483647);}
prng.set(await (new abap.Classes['CL_ABAP_RANDOM_INT']()).constructor_());
prng.get().FRIENDS_ACCESS_INSTANCE["mv_min"].set(min);
prng.get().FRIENDS_ACCESS_INSTANCE["mv_max"].set(max);
return prng;
}
async get_next() {
let value = new abap.types.Integer({qualifiedName: "I"});
value.set((await (await abap.Classes['CL_ABAP_RANDOM'].create()).get().intinrange({low: this.#mv_min, high: this.#mv_max})));
return value;
}
}
abap.Classes['CL_ABAP_RANDOM_INT'] = cl_abap_random_int;
export {cl_abap_random_int}; |