UNPKG

@abaplint/runtime

Version:
122 lines (121 loc) 4.08 kB
import { INumeric } from "./_numeric"; import { ICharacter } from "./_character"; import { ABAPObject } from "./abap_object"; import { Structure } from "./structure"; export declare enum TableAccessType { standard = "STANDARD", sorted = "SORTED", hashed = "HASHED", index = "INDEX", any = "ANY" } export declare enum TableKeyType { default = "DEFAULT", user = "USER", empty = "EMPTY" } export declare class LoopController { index: number; loopTo: number; array: any[]; constructor(from: number, loopTo: number, array: any[]); } export type ITableKey = { name: string; type?: TableAccessType; keyFields: string[]; isUnique: boolean; }; export type ITableOptions = { withHeader: boolean; keyType: TableKeyType; primaryKey?: ITableKey; secondary?: ITableKey[]; }; export type TableRowType = INumeric | Structure | ICharacter | Table | ABAPObject; interface ITable { getQualifiedName(): string | undefined; getOptions(): ITableOptions | undefined; getRowType(): TableRowType; getArrayLength(): number; clear(): void; set(tab: Table | HashedTable | TableRowType): ITable; getHeader(): TableRowType; } export declare class TableFactory { static construct(rowType: TableRowType, options?: ITableOptions, qualifiedName?: string): Table | HashedTable; } export declare class HashedTable implements ITable { private value; private readonly header; private readonly rowType; private readonly loops; private readonly options; private readonly qualifiedName; private readonly isStructured; private secondaryIndexes; constructor(rowType: TableRowType, options: ITableOptions, qualifiedName?: string); clone(): HashedTable; getArrayLength(): number; getKeyByName(name: string): ITableKey | undefined; getSecondaryIndex(name: string): any[]; buildHashFromData(data: TableRowType): string; deleteIndex(_index: number): void; deleteFrom(row: TableRowType): void; buildHashFromSimple(data: { [key: string]: any; }): string; read(hash: string): TableRowType | undefined; insert(data: TableRowType): { value: TableRowType | undefined; subrc: number; }; appendThis(data: TableRowType): this; array(): any[]; startLoop(from: number, to: number, array: any[]): LoopController; unregisterLoop(loop: LoopController): void; insertIndex(_item: TableRowType, _index: number): void; append(_item: TableRowType): void; getQualifiedName(): string | undefined; getOptions(): ITableOptions; getRowType(): TableRowType; clear(): void; set(tab: HashedTable | TableRowType): ITable; getHeader(): TableRowType; private cloneRow; } export declare class Table implements ITable { private value; private readonly header; private readonly rowType; private readonly loops; private readonly options; private readonly qualifiedName; private readonly isStructured; private secondaryIndexes; constructor(rowType: TableRowType, options: ITableOptions, qualifiedName?: string); clone(): Table; getArrayLength(): number; getKeyByName(name: string): ITableKey | undefined; getSecondaryIndex(name: string): TableRowType[]; getQualifiedName(): string | undefined; getOptions(): ITableOptions; startLoop(from: number, to: number, array: any[]): LoopController; getCurrentLoopIndex(): number; unregisterLoop(loop: LoopController): void; getRowType(): TableRowType; array(): any[]; clear(): void; set(tab: Table | HashedTable | TableRowType): this; getHeader(): TableRowType; get(): TableRowType; insertIndex(item: TableRowType, index: number, noClone?: boolean): any; /** index = javascript indexed */ deleteIndex(index: number): void; append(item: TableRowType): any; appendThis(item: TableRowType): this; appendInitial(): TableRowType; sort(compareFn: (a: TableRowType, b: TableRowType) => number): void; private cloneRow; } export {};