First skeleton

This commit is contained in:
Daniel Kluge
2023-10-16 12:55:31 +02:00
parent 696da82e10
commit 2bf455b44a
11 changed files with 189 additions and 40 deletions
+36
View File
@@ -0,0 +1,36 @@
import { types } from "@aas-core-works/aas-core3.0rc02-typescript";
export class AASStore {
private static instance: AASStore;
private shells: Array<types.AssetAdministrationShell> = [];
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<types.AssetAdministrationShell> {
return this.shells;
}
}