Esempio n. 1
0
        //
        //	 * // FitsValue Methods
        //

        ///
        ///	 <summary> * fitsValue - checks whether <code>value</code> matches the testlists
        ///	 * specified for this Evaluation
        ///	 *  </summary>
        ///	 * <param name="value">
        ///	 *            value to test </param>
        ///	 * <returns> boolean - true, if <code>value</code> matches the testlists or if
        ///	 *         testlists are not specified </returns>
        ///
        public sealed override bool fitsValue(string @value)
        {
            if (!fitsListType(@value))
            {
                return(false);
            }

            JDFRectangleRangeList rrl = null;

            try
            {
                rrl = new JDFRectangleRangeList(@value);
            }
            catch (FormatException)
            {
                return(false);
            }

            int siz = rrl.Count;

            for (int i = 0; i < siz; i++) // For every range, that rangelist
            // consists of,
            {                             // we test both of range deliminators - right and left, if they fit
                // HWRelation
                // In this case test of deliminators is sufficient for evaluation of
                // the whole range
                JDFRectangleRange range = (JDFRectangleRange)rrl[i];

                JDFRectangle left  = range.Left;
                JDFRectangle right = range.Right;

                if (left.Equals(right))
                {
                    JDFRectangle rectangle = left;
                    if ((fitsValueList(new JDFRectangleRange(rectangle)) && fitsHWRelation(rectangle)) == false)
                    {
                        return(false);
                    }
                }
                else
                {
                    if ((fitsValueList(range) && fitsHWRelation(left) && fitsHWRelation(right)) == false)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Esempio n. 2
0
        ///
        ///	 <summary> * fitsValue - checks whether <code>value</code> matches the Allowed/Present
        ///	 * test lists specified for this State
        ///	 *  </summary>
        ///	 * <param name="value">
        ///	 *            value to test </param>
        ///	 * <param name="testlists">
        ///	 *            the test lists the value has to match. In this State the test
        ///	 *            lists are ValueList and HWRelation.<br>
        ///	 *            Choose one of two values: FitsValue_Allowed or
        ///	 *            FitsValue_Present. (Defaults to Allowed)
        ///	 *  </param>
        ///	 * <returns> boolean - true, if <code>value</code> matches testlists or if
        ///	 *         AllowedValueList and AllowedValueMod are not specified </returns>
        ///
        public sealed override bool fitsValue(string @value, EnumFitsValue testlists)
        {
            if (fitsListType(@value))
            {
                JDFRectangleRangeList rrl = null;
                try
                {
                    rrl = new JDFRectangleRangeList(@value);
                }
                catch (FormatException)
                {
                    return(false);
                }

                int siz = rrl.Count;
                for (int i = 0; i < siz; i++) // For every range, that rangelist
                // consists of,
                {                             // we test both of range deliminators - right and left, if they
                    // fit HWRelation
                    // In this case test of deliminators is sufficient for
                    // evaluation of the whole range
                    JDFRectangleRange range = (JDFRectangleRange)rrl[i];

                    JDFRectangle left  = range.Left;
                    JDFRectangle right = range.Right;

                    bool bFitsHW;
                    if (left.Equals(right))
                    {
                        bFitsHW = fitsHWRelation(left, testlists);
                    }
                    else
                    {
                        bFitsHW = fitsHWRelation(left, testlists) && fitsHWRelation(right, testlists);
                    }
                    if (!bFitsHW)
                    {
                        return(false);
                    }
                }
                return(fitsValueList(rrl, testlists)); // if we are here bFitsHW is
                // true, test ValueList
            }
            return(false); // the value doesn't fit ListType attribute of this State
        }