Esempio n. 1
0
        /// <summary>
        /// Checks if the specified value is compatible with this
        /// constraint.Only octet string values can be compatible with a
        /// size constraint, and only if the string length is compatible
        /// with the value range in the size constraint.
        /// </summary>
        /// <param name="value">The value to check</param>
        /// <returns>True if the value is compatible, false if not</returns>
        public bool IsCompatible(MibValue value)
        {
            int size;

            if (value is StringValue)
            {
                size = value.ToString().Length;
                return(this.values.IsCompatible(new NumberValue((BigInteger)size)));
            }

            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// Checks if the specified value is compatible with this
        /// constraint.
        /// </summary>
        /// <param name="value">The value to check</param>
        /// <returns>True if the value is compatible, or
        /// false otherwise
        /// </returns>
        public bool IsCompatible(MibValue value)
        {
            string str1 = this.value.ToString();
            string str2 = value.ToString();

            if (this.value is NumberValue &&
                value is NumberValue)
            {
                return(str1.Equals(str2));
            }
            else if (this.value is StringValue &&
                     value is StringValue)
            {
                return(str1.Equals(str2));
            }
            else
            {
                return(false);
            }
        }