Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }