First skeleton
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user