@@ -62,6 +62,16 @@ public static bool HasSubmodelReference(this IAssetAdministrationShell aas, Refe
62
62
return aas . FindSubmodelReference ( smRef ) != null ;
63
63
}
64
64
65
+ public static void AddSubmodelReference ( this IAssetAdministrationShell assetAdministrationShell , IReference newSubmodelReference )
66
+ {
67
+ if ( assetAdministrationShell . Submodels == null )
68
+ {
69
+ assetAdministrationShell . Submodels = new List < IReference > ( ) ;
70
+ }
71
+
72
+ assetAdministrationShell . Submodels . Add ( newSubmodelReference ) ;
73
+ }
74
+
65
75
/// <summary>
66
76
/// Enumerates any references to Submodels in the AAS. Will not return <c>null</c>.
67
77
/// Is tolerant, if the list is <c>null</c>.
@@ -109,41 +119,6 @@ public static void Add(this IAssetAdministrationShell aas, IReference newSmRef)
109
119
aas . Submodels . Add ( newSmRef ) ;
110
120
}
111
121
112
- /// <summary>
113
- /// Returns the <c>index</c>-th Submodel, if exists. Returns <c>null</c> in any other case.
114
- /// </summary>
115
- public static IReference SubmodelByIndex ( this IAssetAdministrationShell aas , int index )
116
- {
117
- if ( aas ? . Submodels == null || index < 0 || index >= aas . Submodels . Count )
118
- return null ;
119
- return aas . Submodels [ index ] ;
120
- /// <summary>
121
- /// Removes the reference, if contained in list. Might set the list to <c>null</c> !!
122
- /// Note: <c>smRef</c> must be the exact object, not only match it!
123
- /// </summary>
124
- public static void Remove ( this IAssetAdministrationShell aas , IReference smRef )
125
- {
126
- if ( aas ? . Submodels == null )
127
- return ;
128
- if ( aas . Submodels . Contains ( smRef ) )
129
- aas . Submodels . Remove ( smRef ) ;
130
- if ( aas . Submodels . Count < 1 )
131
- aas . Submodels = null ;
132
- }
133
-
134
- /// <summary>
135
- /// Adds. Might create the list.
136
- /// </summary>
137
- public static void Add ( this IAssetAdministrationShell aas , IReference newSmRef )
138
- {
139
- if ( aas == null )
140
- return ;
141
- if ( aas . Submodels == null )
142
- aas . Submodels = new List < IReference > ( ) ;
143
-
144
- aas . Submodels . Add ( newSmRef ) ;
145
- }
146
-
147
122
/// <summary>
148
123
/// Removes the reference, if contained in list. Might set the list to <c>null</c> !!
149
124
/// Note: <c>smRef</c> must be the exact object, not only match it!
0 commit comments