示例#1
0
        private void VerifyMinMax()
        {
            if ((RestrictionField & RestrictionField.MinExclusive) == RestrictionField.MinExclusive)
            {
                Debug.Assert(MinExclusive.CompareTo(MinValue) >= 0);
            }
            if ((RestrictionField & RestrictionField.MaxExclusive) == RestrictionField.MaxExclusive)
            {
                Debug.Assert(MaxExclusive.CompareTo(MaxValue) <= 0);
            }
            if ((RestrictionField & RestrictionField.MinMaxExclusive) == RestrictionField.MinMaxExclusive)
            {
                Debug.Assert(MinExclusive.CompareTo(MaxExclusive) < 0);
            }

            if ((RestrictionField & RestrictionField.MinInclusive) == RestrictionField.MinInclusive)
            {
                Debug.Assert(MinInclusive.CompareTo(MinValue) >= 0);
            }
            if ((RestrictionField & RestrictionField.MaxInclusive) == RestrictionField.MaxInclusive)
            {
                Debug.Assert(MaxInclusive.CompareTo(MaxValue) <= 0);
            }
            if ((RestrictionField & RestrictionField.MinMaxInclusive) == RestrictionField.MinMaxInclusive)
            {
                Debug.Assert(MinInclusive.CompareTo(MaxInclusive) <= 0);
            }
        }
示例#2
0
        /// <summary>
        /// <see cref="System.Object.GetHashCode"/>
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            int hash = base.GetHashCode();

            hash = hash * 23 + Range.GetHashCode();
            hash = hash * 23 + MaxInclusive.GetHashCode();
            return(hash);
        }
示例#3
0
        /// <inheritdoc />
        public override bool IsMaxInclusiveValid(OpenXmlSimpleType attributeValue)
        {
            Debug.Assert(attributeValue is ST);
            ST simpleValue = (ST)attributeValue;

            if ((RestrictionField & RestrictionField.MaxInclusive) == RestrictionField.MaxInclusive)
            {
                // true if this.MaxInclusive >= simpleValue.Value
                if (MaxInclusive.CompareTo(simpleValue.Value) < 0)
                {
                    return(false);
                }
            }
            return(true);
        }
示例#4
0
        /// <inheritdoc />
        public override string GetRestrictionValue(RestrictionField restrictionField)
        {
            switch (restrictionField)
            {
            case RestrictionField.MinExclusive:
                return(MinExclusive.ToString());

            case RestrictionField.MaxExclusive:
                return(MaxExclusive.ToString());

            case RestrictionField.MinInclusive:
                return(MinInclusive.ToString());

            case RestrictionField.MaxInclusive:
                return(MaxInclusive.ToString());

            default:
                return(base.GetRestrictionValue(restrictionField));
            }
        }