Esempio n. 1
0
        ///
        ///	 <summary> * fitsTolerance - checks whether this Evaluation has a specified Tolerance
        ///	 * that it is not equal to "0 0", and expands original the rangelist to the
        ///	 * rangelist that fits Tolerance.
        ///	 *  </summary>
        ///	 * <param name="rangeList">
        ///	 *            original rangelist </param>
        ///	 * <returns> NumberRangeList - expanded rangelist, returns original range if
        ///	 *         Tolerance=="0 0" </returns>
        ///
        private JDFRectangleRangeList fitsTolerance(JDFRectangleRangeList origRangeList)
        {
            double nt = getTolerance().X; // negative tolerance
            double pt = getTolerance().Y; // positive tolerance

            if ((nt == 0) && (pt == 0))
            {
                return(origRangeList);
            }

            // expand our original range into the range +/- Tolerance

            JDFRectangleRangeList rangeList = new JDFRectangleRangeList(origRangeList);

            JDFRectangleRangeList tolRangeList = new JDFRectangleRangeList();

            int size = rangeList.Count;

            for (int i = 0; i < size; i++)
            {
                JDFRectangleRange range = (JDFRectangleRange)rangeList[i];

                JDFRectangle left    = range.Left;
                double       leftLlx = left.Llx;
                double       leftLly = left.Lly;
                double       leftUrx = left.Urx;
                double       leftUry = left.Ury;
                left.Llx = leftLlx - nt;
                left.Lly = leftLly - nt;
                left.Urx = leftUrx - nt;
                left.Ury = leftUry - nt;

                JDFRectangle right    = range.Right;
                double       rightLlx = right.Llx;
                double       rightLly = right.Lly;
                double       rightUrx = right.Urx;
                double       rightUry = right.Ury;
                right.Llx = rightLlx + pt;
                right.Lly = rightLly + pt;
                right.Urx = rightUrx + pt;
                right.Ury = rightUry + pt;

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

                tolRangeList.Append(range);
            }
            return(tolRangeList);
        }
Esempio n. 2
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. 3
0
        ///
        ///	 <summary> * fitsValueList - checks whether <code>range</code> is in the ValueList
        ///	 * specified for this Evaluation
        ///	 *  </summary>
        ///	 * <param name="range">
        ///	 *            range to test </param>
        ///	 * <returns> boolean - true, if <code>range</code> is in the ValueList or if
        ///	 *         ValueList is not specified </returns>
        ///
        private bool fitsValueList(JDFRectangleRange range)
        {
            if (!hasAttribute(AttributeName.VALUELIST))
            {
                return(true);
            }

            JDFRectangleRangeList rangelist = getValueList();

            if (hasAttribute(AttributeName.TOLERANCE))
            {
                return(fitsTolerance(rangelist).isPartOfRange(range));
            }
            return(rangelist.isPartOfRange(range));
        }
Esempio n. 4
0
        ///
        ///	 <summary> * fitsValueList - checks whether <code>rangelist</code> matches the
        ///	 * AllowedValueList/PresentValueList specified for this State
        ///	 *  </summary>
        ///	 * <param name="rangelist">
        ///	 *            range list to test </param>
        ///	 * <param name="valuelist">
        ///	 *            switches between AllowedValueList and PresentValueList.
        ///	 *  </param>
        ///	 * <returns> boolean - true, if <code>rangelist</code> matches the valuelist
        ///	 *         or if AllowedValueList is not specified </returns>
        ///
        private bool fitsValueList(JDFRectangleRangeList rangelist, EnumFitsValue valuelist)
        {
            JDFRectangleRangeList list;

            if (valuelist.Equals(EnumFitsValue.Allowed))
            {
                list = getAllowedValueList();
            }
            else
            {
                list = getPresentValueList();
            }
            if (list == null)
            {
                return(true);
            }

            EnumListType listType = getListType();

            if (listType.Equals(EnumListType.CompleteList))
            {
                return(fitsCompleteList(rangelist, list));
            }
            else if (listType.Equals(EnumListType.CompleteOrderedList))
            {
                return(fitsCompleteOrderedList(rangelist, list));
            }
            else if (listType.Equals(EnumListType.ContainedList))
            {
                return(fitsContainedList(rangelist, list));
            }

            int siz = rangelist.Count;

            for (int i = 0; i < siz; i++)
            {
                JDFRectangleRange range = (JDFRectangleRange)rangelist[i];

                if (!list.isPartOfRange(range))
                {
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 5
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
        }