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 | 1x 1x 1x 1x 1x 1x | const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_timer.clas.abap
class zcl_abapgit_timer {
static STATIC_SUPER = undefined;
static INTERNAL_TYPE = 'CLAS';
static INTERNAL_NAME = 'ZCL_ABAPGIT_TIMER';
static IMPLEMENTED_INTERFACES = [];
static ATTRIBUTES = {"MV_TEXT": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "I", "is_constant": " ", "is_class": " "},
"MV_COUNT": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "visibility": "I", "is_constant": " ", "is_class": " "},
"MV_TIMER": {"type": () => {return new abap.types.Packed({length: 21, decimals: 7, qualifiedName: "TIMESTAMPL"});}, "visibility": "I", "is_constant": " ", "is_class": " "}};
static METHODS = {"CREATE": {"visibility": "U", "parameters": {"RO_TIMER": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_TIMER", RTTIName: "\\CLASS=ZCL_ABAPGIT_TIMER"});}, "is_optional": " ", "parm_kind": "R", "type_name": "ObjectReferenceType"}, "IV_TEXT": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "I", "type_name": "StringType"}, "IV_COUNT": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "I", "type_name": "IntegerType"}}},
"CONSTRUCTOR": {"visibility": "U", "parameters": {"IV_TEXT": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "I", "type_name": "StringType"}, "IV_COUNT": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "I", "type_name": "IntegerType"}}},
"START": {"visibility": "U", "parameters": {"RO_TIMER": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_TIMER", RTTIName: "\\CLASS=ZCL_ABAPGIT_TIMER"});}, "is_optional": " ", "parm_kind": "R", "type_name": "ObjectReferenceType"}}},
"END": {"visibility": "U", "parameters": {"RV_RESULT": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "StringType"}, "IV_OUTPUT_AS_STATUS_MESSAGE": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " ", "parm_kind": "I", "type_name": "CharacterType"}}}};
#mv_text;
#mv_count;
#mv_timer;
constructor() {
this.me = new abap.types.ABAPObject();
this.me.set(this);
this.INTERNAL_ID = abap.internalIdCounter++;
this.FRIENDS_ACCESS_INSTANCE = {
"start": this.start.bind(this),
"end": this.end.bind(this),
};
this.#mv_text = new abap.types.String({qualifiedName: "STRING"});
this.FRIENDS_ACCESS_INSTANCE["mv_text"] = this.#mv_text;
this.#mv_count = new abap.types.Integer({qualifiedName: "I"});
this.FRIENDS_ACCESS_INSTANCE["mv_count"] = this.#mv_count;
this.#mv_timer = new abap.types.Packed({length: 21, decimals: 7, qualifiedName: "TIMESTAMPL"});
this.FRIENDS_ACCESS_INSTANCE["mv_timer"] = this.#mv_timer;
}
async constructor_(INPUT) {
let iv_text = new abap.types.String({qualifiedName: "STRING"});
if (INPUT && INPUT.iv_text) {iv_text.set(INPUT.iv_text);}
let iv_count = new abap.types.Integer({qualifiedName: "I"});
if (INPUT && INPUT.iv_count) {iv_count.set(INPUT.iv_count);}
this.#mv_text.set(iv_text);
this.#mv_count.set(iv_count);
return this;
}
async create(INPUT) {
return zcl_abapgit_timer.create(INPUT);
}
static async create(INPUT) {
let ro_timer = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_TIMER", RTTIName: "\\CLASS=ZCL_ABAPGIT_TIMER"});
let iv_text = new abap.types.String({qualifiedName: "STRING"});
if (INPUT && INPUT.iv_text) {iv_text.set(INPUT.iv_text);}
let iv_count = new abap.types.Integer({qualifiedName: "I"});
if (INPUT && INPUT.iv_count) {iv_count.set(INPUT.iv_count);}
ro_timer.set(await (new abap.Classes['ZCL_ABAPGIT_TIMER']()).constructor_({iv_text: iv_text, iv_count: iv_count}));
return ro_timer;
}
async end(INPUT) {
let rv_result = new abap.types.String({qualifiedName: "STRING"});
let iv_output_as_status_message = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
if (INPUT && INPUT.iv_output_as_status_message) {iv_output_as_status_message.set(INPUT.iv_output_as_status_message);}
if (INPUT === undefined || INPUT.iv_output_as_status_message === undefined) {iv_output_as_status_message = abap.builtin.abap_false;}
let lv_timestamp = new abap.types.Packed({length: 21, decimals: 7, qualifiedName: "TIMESTAMPL"});
let lv_runtime = new abap.types.Packed({length: 21, decimals: 7, qualifiedName: "TIMESTAMPL"});
let lv_sec = new abap.types.Packed({length: 11, decimals: 2});
if (abap.compare.initial(this.#mv_timer)) {
rv_result.set(abap.CharacterFactory.get(40, 'Runtime measurement has not been started'));
} else {
abap.statements.getTime({stamp: lv_timestamp});
try {
lv_runtime.set((await abap.Classes['CL_ABAP_TSTMP'].subtract({tstmp1: lv_timestamp, tstmp2: this.#mv_timer})));
lv_sec.set(lv_runtime);
if (abap.compare.eq(this.#mv_count, abap.IntegerFactory.get(1))) {
rv_result.set(new abap.types.String().set(`1 object, `));
} else if (abap.compare.gt(this.#mv_count, abap.IntegerFactory.get(1))) {
rv_result.set(new abap.types.String().set(`${abap.templateFormatting(this.#mv_count)} objects, `));
}
rv_result.set(abap.operators.concat(rv_result,new abap.types.String().set(`${abap.templateFormatting(lv_sec)} seconds`)));
} catch (e) {
if ((abap.Classes['CX_PARAMETER_INVALID'] && e instanceof abap.Classes['CX_PARAMETER_INVALID'])) {
rv_result.set(abap.CharacterFactory.get(33, 'Error getting runtime measurement'));
} else {
throw e;
}
}
}
if (abap.compare.eq(iv_output_as_status_message, abap.builtin.abap_true)) {
await abap.statements.message({id: "oo", number: "000", type: "S", with: [this.#mv_text,rv_result]});
}
if (abap.compare.initial(this.#mv_text) === false) {
rv_result.set(new abap.types.String().set(`${abap.templateFormatting(this.#mv_text)} ${abap.templateFormatting(rv_result)}`));
}
return rv_result;
}
async start() {
let ro_timer = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_TIMER", RTTIName: "\\CLASS=ZCL_ABAPGIT_TIMER"});
abap.statements.getTime({stamp: this.#mv_timer});
ro_timer.set(this.me);
return ro_timer;
}
}
abap.Classes['ZCL_ABAPGIT_TIMER'] = zcl_abapgit_timer;
export {zcl_abapgit_timer}; |