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> * (20) get JDFRectangleRangeList attribute ValueList </summary>
        ///          * <returns> JDFRectangleRangeList the value of the attribute, null if a the
        ///          *         attribute value is not a valid to create a JDFRectangleRangeList </returns>
        ///
        public virtual JDFRectangleRangeList getValueList()
        {
            string strAttrName = "";
            JDFRectangleRangeList nPlaceHolder = null;

            strAttrName = getAttribute(AttributeName.VALUELIST, null, JDFConstants.EMPTYSTRING);
            try
            {
                nPlaceHolder = new JDFRectangleRangeList(strAttrName);
            }
            catch (FormatException)
            {
                return(null);
            }
            return(nPlaceHolder);
        }
Esempio n. 5
0
        ///
        ///	 <summary> * fitsContainedList - tests whether <code>value</code> matches the given
        ///	 * ValueList (ListType=ContainedList)
        ///	 *  </summary>
        ///	 * <param name="value">
        ///	 *            value to test </param>
        ///	 * <param name="list">
        ///	 *            ValueList </param>
        ///	 * <returns> boolean - true, if <code>value</code> matches the ValueList </returns>
        ///
        private bool fitsContainedList(JDFRectangleRangeList @value, JDFRectangleRangeList list)
        {
            int v_size = @value.Count;
            int l_size = list.Count;

            for (int i = 0; i < v_size; i++)
            {
                for (int j = 0; j < l_size; j++)
                {
                    if (@value[i].Equals(list[j]))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Esempio n. 6
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. 7
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
        }
Esempio n. 8
0
        ///
        ///	 <summary> * fitsCompleteList - tests whether <code>value</code> matches the given
        ///	 * testlist (ListType=fitsCompleteList)
        ///	 *  </summary>
        ///	 * <param name="value">
        ///	 *            value to test </param>
        ///	 * <param name="list">
        ///	 *            testlist, either AllowedValueList or PresentValueList.
        ///	 *  </param>
        ///	 * <returns> boolean - true, if <code>value</code> matches the testlist </returns>
        ///
        private bool fitsCompleteList(JDFRectangleRangeList @value, JDFRectangleRangeList list)
        {
            int v_size = @value.Count;
            int l_size = list.Count;

            if (v_size != l_size)
            {
                return(false);
            }

            if ([email protected]())
            {
                return(false);
            }

            JDFRectangleRangeList valueList = new JDFRectangleRangeList(@value);

            bool bFound;

            for (int i = l_size - 1; i >= 0; i--)
            {
                bFound = false;
                for (int j = valueList.Count - 1; j >= 0; j--)
                {
                    if (list[i].Equals(valueList[j]))
                    {
                        valueList.erase(j);
                        bFound = true;
                        break;
                    }
                }
                if (!bFound)
                {
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 9
0
        //
        //	 * // Element getter / setter
        //

        //
        //	 * (non-Javadoc)
        //	 *
        //	 * @see
        //	 * org.cip4.jdflib.resource.devicecapability.JDFAbstractState#addValue(java
        //	 * .lang.String, org.cip4.jdflib.datatypes.JDFBaseDataTypes.EnumFitsValue)
        //
        public override void addValue(string @value, EnumFitsValue testlists)
        {
            if (fitsValue(@value, testlists))
            {
                return;
            }

            JDFRectangle rect;

            try
            {
                rect = new JDFRectangle(@value);
            }
            catch (FormatException)
            {
                return; // nop for bad values
            }
            if (testlists == null || EnumFitsValue.Allowed.Equals(testlists))
            {
                JDFRectangleRangeList list = getAllowedValueList();
                if (list == null)
                {
                    list = new JDFRectangleRangeList();
                }
                list.Append(rect);
                setAllowedValueList(list);
            }
            if (testlists == null || EnumFitsValue.Present.Equals(testlists))
            {
                JDFRectangleRangeList list = getPresentValueList();
                if (list == null || !hasAttribute(AttributeName.PRESENTVALUELIST))
                {
                    list = new JDFRectangleRangeList();
                }
                list.Append(rect);
                setPresentValueList(list);
            }
        }
Esempio n. 10
0
        ///
        ///	 <summary> * fitsCompleteOrderedList - tests whether <code>value</code> matches the
        ///	 * given testlist (ListType=CompleteOrderedList)
        ///	 *  </summary>
        ///	 * <param name="value">
        ///	 *            value to test </param>
        ///	 * <param name="list">
        ///	 *            testlist, either AllowedValueList or PresentValueList.
        ///	 *  </param>
        ///	 * <returns> boolean - true, if <code>value</code> matches the testlist </returns>
        ///
        private bool fitsCompleteOrderedList(JDFRectangleRangeList @value, JDFRectangleRangeList list)
        {
            int v_size = @value.Count;
            int l_size = list.Count;

            if (v_size != l_size)
            {
                return(false);
            }

            if ([email protected]())
            {
                return(false);
            }

            for (int i = 0; i < l_size; i++)
            {
                if (!list[i].Equals(@value[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 11
0
 public virtual void setPresentValueList(JDFRectangleRangeList @value)
 {
     setAttribute(AttributeName.PRESENTVALUELIST, @value.ToString());
 }
Esempio n. 12
0
 public virtual void setAllowedValueList(JDFRectangleRangeList @value)
 {
     setAttribute(AttributeName.ALLOWEDVALUELIST, @value.ToString());
 }
Esempio n. 13
0
 //         ---------------------------------------------------------------------
 //        Methods for Attribute ValueList
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute ValueList </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setValueList(JDFRectangleRangeList @value)
 {
     setAttribute(AttributeName.VALUELIST, @value, null);
 }
Esempio n. 14
0
        ///
        ///	 <summary> * fitsListType - checks whether <code>value</code> matches the value of the
        ///	 * ListType attribute specified for this Evaluation
        ///	 *  </summary>
        ///	 * <param name="value">
        ///	 *            value to test </param>
        ///	 * <returns> boolean - true, if <code>value</code> matches the specified value
        ///	 *         of ListType </returns>
        ///
        private bool fitsListType(string @value)
        {
            EnumListType listType = getListType();

            JDFRectangleRangeList rangelist;

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

            if (listType.Equals(EnumListType.SingleValue) || listType.Equals(EnumListType.getEnum(0)))
            { // default ListType = SingleValue
                try
                {
                    new JDFRectangle(@value);
                }
                catch (JDFException)
                {
                    return(false);
                }
                catch (FormatException)
                {
                    return(false);
                }
                return(true);
            }
            else if (listType.Equals(EnumListType.RangeList))
            {
                return(true);
            }
            else if (listType.Equals(EnumListType.List))
            {
                return(rangelist.isList());
            }
            else if (listType.Equals(EnumListType.OrderedList))
            {
                return(rangelist.isList() && rangelist.isOrdered());
            }
            else if (listType.Equals(EnumListType.UniqueList))
            {
                return(rangelist.isList() && rangelist.isUnique());
            }
            else if (listType.Equals(EnumListType.UniqueOrderedList))
            {
                return(rangelist.isList() && rangelist.isUniqueOrdered());
            }
            else if (listType.Equals(EnumListType.OrderedRangeList))
            {
                return(rangelist.isOrdered());
            }
            else if (listType.Equals(EnumListType.UniqueRangeList))
            {
                return(rangelist.isUnique());
            }
            else if (listType.Equals(EnumListType.UniqueOrderedRangeList))
            {
                return(rangelist.isUniqueOrdered());
            }
            else
            {
                throw new JDFException("JDFRectangleEvaluation.fitsListType illegal ListType attribute");
            }
        }