Even more documentation

This commit is contained in:
Daniel Kluge
2023-11-01 23:44:43 +01:00
parent 86dcd8d2f8
commit 591cf6662b
10 changed files with 506 additions and 8 deletions
+35
View File
@@ -5,14 +5,29 @@ import Traverser from "./helper/traverser";
import AIDParser from "./parser/AIDParser";
import { SubmodelElementCollection } from "@aas-core-works/aas-core3.0-typescript/dist/types/types";
/**
* The AIMC Mapper.
* @remarks
* This class is used to map properties t endpoints.
*/
export default class AIMCMapper {
/**
* The map.
*/
private map: AIMCMap = new Map();
/**
* Creates the mapper.
* @param env The AAS Environment
*/
public constructor(private readonly env: types.Environment) {
this.generate();
}
/**
* Generates the map from the AAS Environment.
*/
private generate(): void {
const aimc = AIMCParser.parse(this.env);
if (aimc === null) return;
@@ -51,14 +66,29 @@ export default class AIMCMapper {
}
}
/**
*
* @returns The complete map
*/
public getMap(): AIMCMap {
return this.map;
}
/**
* Get endpoint for a specific Element
* @param element Element
* @returns Endpoint description or undefined if not found
*/
public get(element: types.Class): ConnectionConfiguration | undefined {
return this.map.get(element);
}
/**
* Returns all endpoints for a idShort
* Can return multiple as idShorts are not necessarily unique
* @param idShort idShort of the element
* @returns Endpoints descriptions of elements with that idShort
*/
public getByIdShort(idShort: string): ConnectionConfiguration[] {
const result = [];
for (const [e, cc] of this.map.entries()) {
@@ -67,6 +97,11 @@ export default class AIMCMapper {
return result;
}
/**
* Get an element by its endpoint
* @param path Absolute endpoint path
* @returns Elements that use that path
*/
public reverseGet(path: string): types.Class[] {
const result = [];