예제 #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 override bool fitsValue(string @value)
        {
            if (!fitsListType(@value))
            {
                return(false);
            }

            JDFXYPairRangeList rrl = null;

            try
            {
                rrl = new JDFXYPairRangeList(@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
                // XYRelation
                // In this case test of deliminators is sufficient for evaluation of
                // the whole range
                JDFXYPairRange range = (JDFXYPairRange)rrl[i];

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

                if (left.Equals(right))
                {
                    JDFXYPair xypair = left;
                    if ((fitsValueList(new JDFXYPairRange(xypair)) && fitsXYRelation(xypair)) == false)
                    {
                        return(false);
                    }
                }
                else
                {
                    if ((fitsValueList(range) && fitsXYRelation(left) && fitsXYRelation(right)) == false)
                    {
                        return(false);
                    }
                }
            }
            return(true); // all elements of rangelist fit
        }
예제 #2
0
        ///
        ///	 <summary> * fitsValue - checks whether <code>value</code> matches the Allowed/Present
        ///	 * test lists specified for this State. In this State the test lists are
        ///	 * ValueList AND XYRelation.
        ///	 *  </summary>
        ///	 * <param name="value">
        ///	 *            value to test </param>
        ///	 * <param name="valuelist">
        ///	 *            the test lists the value has to match.<br>
        ///	 *            Choose one of two values: FitsValue_Allowed and
        ///	 *            FitsValue_Present. (Defaults to Allowed)
        ///	 *  </param>
        ///	 * <returns> boolean - true, if the value is in the valuelist or if
        ///	 *         AllowedValueList is not specified </returns>
        ///
        public override bool fitsValue(string @value, EnumFitsValue testlists)
        {
            if (!fitsListType(@value))
            {
                return(false);
            }

            JDFXYPairRangeList rangelist = null;

            try
            {
                rangelist = new JDFXYPairRangeList(@value);
            }
            catch (FormatException)
            {
                return(false);
            }

            int siz = rangelist.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
                // XYRelation
                // In this case test of deliminators is sufficient for evaluation of
                // the whole range
                JDFXYPairRange range = (JDFXYPairRange)rangelist[i];

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

                bool bFitsXY;
                if (left.Equals(right))
                {
                    bFitsXY = fitsXYRelation(left, testlists);
                }
                else
                {
                    bFitsXY = fitsXYRelation(left, testlists) && fitsXYRelation(right, testlists);
                }
                if (!bFitsXY)
                {
                    return(false);
                }
            }

            return(fitsValueList(rangelist, testlists)); // if we are here bFitsXY is
            // true, test ValueList
        }