import { types } from "@aas-core-works/aas-core3.0rc02-typescript"; export class AASStore { private static instance: AASStore; private shells: Array = []; private constructor() { } public static getInstance(): AASStore { if (!AASStore.instance) { AASStore.instance = new AASStore(); } return AASStore.instance; } public addAAS(aas: types.AssetAdministrationShell | types.Environment): void { if (aas instanceof types.Environment) { if (aas.assetAdministrationShells) this.shells = this.shells.concat(aas.assetAdministrationShells); } else { this.shells.push(aas); } } public getAAS(id: string): types.AssetAdministrationShell | undefined { return this.shells.find((aas) => aas.id === id); } public removeAAS(id: string): void { this.shells = this.shells.filter((aas) => aas.id !== id); } public getAll(): Array { return this.shells; } }