All files / src/abap/4_file_information abap_file_information.ts

100% Statements 57/57
100% Branches 17/17
100% Functions 8/8
100% Lines 57/57

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 571x 1x 1x 1x 1x 1x 1x 8355x 8355x 1x 1x 705x 705x 1x 1x 2235x 2235x 1x 1x 90x 90x 98x 88x 88x 98x 2x 2x 1x 1x 5018x 5018x 1x 1x 1141x 1141x 1115x 1091x 1091x 1115x 50x 50x 1x 1x 178x 178x 189x 164x 164x 189x 14x 14x 1x 1x 267x 267x 1x 1x
import {IABAPFileInformation, InfoClassImplementation, InfoClassDefinition, InfoInterfaceDefinition, InfoFormDefinition} from "./_abap_file_information";
import {ParsedFileInformation} from "./parsed_file_information";
 
export class ABAPFileInformation implements IABAPFileInformation {
  private readonly parsed: ParsedFileInformation;
 
  public constructor(parsed: ParsedFileInformation) {
    this.parsed = parsed;
  }
 
  public listClassImplementations(): readonly InfoClassImplementation[] {
    return this.parsed.implementations;
  }
 
  public listInterfaceDefinitions(): readonly InfoInterfaceDefinition[] {
    return this.parsed.interfaces;
  }
 
  public getInterfaceDefinitionByName(name: string): InfoInterfaceDefinition | undefined {
    const upper = name.toUpperCase();
    for (const i of this.listInterfaceDefinitions()) {
      if (i.identifier.getName().toUpperCase() === upper) {
        return i;
      }
    }
    return undefined;
  }
 
  public listClassDefinitions(): readonly InfoClassDefinition[] {
    return this.parsed.classes;
  }
 
  public getClassDefinitionByName(name: string): InfoClassDefinition | undefined {
    const upper = name.toUpperCase();
    for (const d of this.listClassDefinitions()) {
      if (d.identifier.getName().toUpperCase() === upper) {
        return d;
      }
    }
    return undefined;
  }
 
  public getClassImplementationByName(name: string): InfoClassImplementation | undefined {
    const upper = name.toUpperCase();
    for (const impl of this.listClassImplementations()) {
      if (impl.identifier.getName().toUpperCase() === upper) {
        return impl;
      }
    }
    return undefined;
  }
 
  public listFormDefinitions(): InfoFormDefinition[] {
    return this.parsed.forms;
  }
 
}