Documentation should be done

This commit is contained in:
Daniel Kluge
2023-11-02 18:29:04 +01:00
parent 591cf6662b
commit 819a0b1a72
21 changed files with 571 additions and 29 deletions
+13 -6
View File
@@ -1,25 +1,27 @@
import { types } from "@aas-core-works/aas-core3.0-typescript";
import { ConnectionConfiguration, AIMCMap } from "./types/aimcConf";
import type { types } from "@aas-core-works/aas-core3.0-typescript";
import type { ConnectionConfiguration, AIMCMap } from "./types/aimcConf";
import AIMCParser from "./parser/AIMCParser";
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.
* This class is used to map properties to endpoints.
* @public
*/
export default class AIMCMapper {
/**
* The map.
* @private
*/
private map: AIMCMap = new Map();
/**
* Creates the mapper.
* @param env The AAS Environment
* @public
*/
public constructor(private readonly env: types.Environment) {
this.generate();
@@ -27,6 +29,7 @@ export default class AIMCMapper {
/**
* Generates the map from the AAS Environment.
* @private
*/
private generate(): void {
const aimc = AIMCParser.parse(this.env);
@@ -48,11 +51,11 @@ export default class AIMCMapper {
let {first, second} = resolved;
let parsedPropConf = AIDParser.parseInterfaceMetadataProperty(first as SubmodelElementCollection);
let parsedPropConf = AIDParser.parseInterfaceMetadataProperty(first as types.SubmodelElementCollection);
if (parsedPropConf === null) {
// maybe the property is in the first element
[first, second] = [second, first];
parsedPropConf = AIDParser.parseInterfaceMetadataProperty(first as SubmodelElementCollection);
parsedPropConf = AIDParser.parseInterfaceMetadataProperty(first as types.SubmodelElementCollection);
}
if (parsedPropConf === null) continue;
@@ -69,6 +72,7 @@ export default class AIMCMapper {
/**
*
* @returns The complete map
* @public
*/
public getMap(): AIMCMap {
return this.map;
@@ -78,6 +82,7 @@ export default class AIMCMapper {
* Get endpoint for a specific Element
* @param element Element
* @returns Endpoint description or undefined if not found
* @public
*/
public get(element: types.Class): ConnectionConfiguration | undefined {
return this.map.get(element);
@@ -88,6 +93,7 @@ export default class AIMCMapper {
* Can return multiple as idShorts are not necessarily unique
* @param idShort idShort of the element
* @returns Endpoints descriptions of elements with that idShort
* @public
*/
public getByIdShort(idShort: string): ConnectionConfiguration[] {
const result = [];
@@ -101,6 +107,7 @@ export default class AIMCMapper {
* Get an element by its endpoint
* @param path Absolute endpoint path
* @returns Elements that use that path
* @public
*/
public reverseGet(path: string): types.Class[] {
const result = [];