/// <summary> /// Return the entity type <code>entityType</code> of the attribute definition with <code>key</code>. If the key /// does not exist in this configuration, <code>null</code> is returned. /// </summary> public Entity?GetTypeForKey(ushort key) { if (PartAttributesDict.ContainsKey(key)) { return(Entity.Part); } if (CharacteristicAttributesDict.ContainsKey(key)) { return(Entity.Characteristic); } if (MeasurementAttributesDict.ContainsKey(key)) { return(Entity.Measurement); } if (ValueAttributesDict.ContainsKey(key)) { return(Entity.Value); } if (CatalogAttributesDict.ContainsKey(key)) { return(Entity.Catalog); } return(null); }
/// <summary> /// Returns the attribute definition with <code>key</code> for entity type <code>entity</code>. /// </summary> /// <param name="key">The key of the attribute definition.</param> /// <param name="type">The entity type for which the definition should be returned.</param> public AbstractAttributeDefinition GetDefinition(Entity type, ushort key) { AbstractAttributeDefinition result = null; switch (type) { case Entity.Part: PartAttributesDict.TryGetValue(key, out result); break; case Entity.Characteristic: CharacteristicAttributesDict.TryGetValue(key, out result); break; case Entity.Measurement: MeasurementAttributesDict.TryGetValue(key, out result); break; case Entity.Value: ValueAttributesDict.TryGetValue(key, out result); break; case Entity.Catalog: CatalogAttributesDict.TryGetValue(key, out result); break; } return(result); }
/// <summary> /// Returns <code>true</code> if the attribute definition with key <code>key</code> belongs to an entity /// with type <code>entityType</code>. /// </summary> public bool IsKeyOfType(Entity entityType, ushort key) { switch (entityType) { case Entity.Part: return(PartAttributesDict.ContainsKey(key)); case Entity.Characteristic: return(CharacteristicAttributesDict.ContainsKey(key)); case Entity.Measurement: return(MeasurementAttributesDict.ContainsKey(key)); case Entity.Value: return(ValueAttributesDict.ContainsKey(key)); case Entity.Catalog: return(CatalogAttributesDict.ContainsKey(key)); } return(false); }