-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathAasAmlMatcher.cs
61 lines (50 loc) · 1.75 KB
/
AasAmlMatcher.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
Copyright (c) 2018-2023 Festo SE & Co. KG <https://www.festo.com/net/de_de/Forms/web/contact_international>
Author: Michael Hoffmeister
This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
*/
using Aml.Engine.CAEX;
using System.Collections.Generic;
namespace AasxAmlImExport
{
/// <summary>
/// Maintains a bidirectinal dictionary between AAS Referables and AML / CAEX Objects
/// </summary>
public class AasAmlMatcher
{
private Dictionary<IReferable, CAEXObject> aasToAml =
new Dictionary<IReferable, CAEXObject>();
private Dictionary<CAEXObject, IReferable> amlToAas =
new Dictionary<CAEXObject, IReferable>();
public void AddMatch(IReferable aasReferable, CAEXObject amlObject)
{
aasToAml.Add(aasReferable, amlObject);
amlToAas.Add(amlObject, aasReferable);
}
public ICollection<IReferable> GetAllAasReferables()
{
return aasToAml.Keys;
}
public CAEXObject GetAmlObject(IReferable aasReferable)
{
if (aasToAml.ContainsKey(aasReferable))
return aasToAml[aasReferable];
return null;
}
public IReferable GetAasObject(CAEXObject amlObject)
{
if (amlToAas.ContainsKey(amlObject))
return amlToAas[amlObject];
return null;
}
public bool ContainsAasObject(IReferable aasReferable)
{
return aasToAml.ContainsKey(aasReferable);
}
public bool ContainsAmlObject(CAEXObject amlObject)
{
return amlToAas.ContainsKey(amlObject);
}
}
}