Even more documentation
This commit is contained in:
@@ -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 = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user