예제 #1
0
        ///
        ///	 <summary> * fitsXYZTolerance - checks whether this Evaluation has a specified
        ///	 * Tolerance that it is not equal "0 0", and expands the original rangelist
        ///	 * to the rangelist that fits the Tolerance.
        ///	 *  </summary>
        ///	 * <param name="rangeList">
        ///	 *            original rangelist </param>
        ///	 * <returns> JDFNumberRangeList - expanded rangelist, returns original range
        ///	 *         if Tolerance=="0 0" </returns>
        ///
        public virtual JDFNumberRangeList fitsXYZTolerance(JDFNumberRangeList 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

            JDFNumberRangeList rangeList = new JDFNumberRangeList(origRangeList);

            JDFNumberRangeList tolRangeList = new JDFNumberRangeList();

            int size = rangeList.Count;

            for (int i = 0; i < size; i++)
            {
                JDFNumberRange range = (JDFNumberRange)rangeList[i];
                JDFNumberRange r     = new JDFNumberRange();
                r.Left  = range.Left - nt;
                r.Right = range.Right + pt;

                tolRangeList.Append(r);
            }
            return(tolRangeList);
        }
예제 #2
0
        ///
        ///	 <summary> * fitsXYZ - checks wheterh <code>range</code> matches the test lists X, Y,
        ///	 * Z, specified for this Evaluation
        ///	 *  </summary>
        ///	 * <param name="range">
        ///	 *            range to test </param>
        ///	 * <returns> boolean - true, if <code>range</code> matches test lists X, Y, Z
        ///	 *         or if X, Y, Z are not specified </returns>
        ///
        private bool fitsXYZ(JDFShapeRange range)
        {
            JDFNumberRangeList x, y, z;

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

            double         leftX  = left.Y;
            double         rightX = right.Y;
            JDFNumberRange rangeX = new JDFNumberRange(leftX, rightX);

            double         leftY  = left.X;
            double         rightY = right.X;
            JDFNumberRange rangeY = new JDFNumberRange(leftY, rightY);

            double         leftZ  = left.Z;
            double         rightZ = right.Z;
            JDFNumberRange rangeZ = new JDFNumberRange(leftZ, rightZ);

            x = getX();
            y = getY();
            z = getZ();

            if (hasAttribute(AttributeName.TOLERANCE))
            {
                x = fitsXYZTolerance(x);
                y = fitsXYZTolerance(y);
                z = fitsXYZTolerance(z);
            }

            bool bFit = true;

            if (x.Count != 0)
            {
                bFit = x.isPartOfRange(rangeX);
            }
            if (!bFit)
            {
                return(false);
            }

            if (y.Count != 0)
            {
                bFit = y.isPartOfRange(rangeY);
            }
            if (!bFit)
            {
                return(false);
            }

            if (z.Count != 0)
            {
                bFit = z.isPartOfRange(rangeZ);
            }
            return(bFit);
        }
예제 #3
0
        ///
        ///          <summary> * (20) get JDFNumberRange attribute SourceFrequency </summary>
        ///          * <returns> JDFNumberRange the value of the attribute, null if a the
        ///          *         attribute value is not a valid to create a JDFNumberRange </returns>
        ///
        public virtual JDFNumberRange getSourceFrequency()
        {
            string         strAttrName  = "";
            JDFNumberRange nPlaceHolder = null;

            strAttrName = getAttribute(AttributeName.SOURCEFREQUENCY, null, JDFConstants.EMPTYSTRING);
            try
            {
                nPlaceHolder = new JDFNumberRange(strAttrName);
            }
            catch (FormatException)
            {
                return(null);
            }
            return(nPlaceHolder);
        }
예제 #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(JDFNumberRangeList rangelist, EnumFitsValue valuelist)
        {
            JDFNumberRangeList 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++)
            {
                JDFNumberRange range = (JDFNumberRange)rangelist[i];

                if (!list.isPartOfRange(range))
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #5
0
        ///
        ///	 <summary> * fitsValueMod - checks whether <code>range</code> matches the
        ///	 * <code>ValueMod</code> specified for this State.
        ///	 *  </summary>
        ///	 * <param name="rangelist">
        ///	 *            range list to test </param>
        ///	 * <param name="valuemod">
        ///	 *            switches between AllowedValueMod and PresentValueMod.
        ///	 *  </param>
        ///	 * <returns> boolean - true, if <code>rangelist</code> matches the valuemod or
        ///	 *         if AllowedValueMod is not specified </returns>
        ///
        private bool fitsValueMod(JDFNumberRangeList rangelist, EnumFitsValue valuemod)
        {
            if (valuemod.Equals(EnumFitsValue.Allowed))
            {
                if (!hasAttribute(AttributeName.ALLOWEDVALUEMOD))
                {
                    return(true);
                }
            }
            else
            {
                if (!hasAttribute(AttributeName.ALLOWEDVALUEMOD) && !hasAttribute(AttributeName.PRESENTVALUEMOD))
                {
                    return(true);
                }
            }

            JDFXYPair mod;

            if (valuemod.Equals(EnumFitsValue.Allowed))
            {
                mod = getAllowedValueMod();
            }
            else
            {
                mod = getPresentValueMod();
            }

            int size = rangelist.Count;

            for (int i = 0; i < size;)
            {
                JDFNumberRange range = (JDFNumberRange)rangelist[i];

                double left  = range.Left;
                double right = range.Right;
                if (left != right) // if we have a range return false, check only
                // single value
                {
                    return(false);
                }

                double elem  = left;  // single value
                double divi  = mod.X; // X - the Modulo
                double shift = mod.Y; // Y - offset of the allowed/present
                // value

                if (divi == 0)
                {
                    return(false);
                }

                // if ValueMod is not "0 x"
                double n = ((elem - divi * (int)(elem / divi)) - shift); // n =
                // elem
                // %
                // divi
                // -
                // shift
                if (Math.Abs(n) < JDFBaseDataTypes_Fields.EPSILON * Math.Abs(divi))
                {
                    return(true);
                }

                double m = (n - divi * (int)(n / divi)); // m = ( elem % divi -
                // shift ) % divi
                if (Math.Abs(m) < JDFBaseDataTypes_Fields.EPSILON * Math.Abs(divi))
                {
                    return(true);
                }
                return(false);
            }
            return(true);
        }
예제 #6
0
        ///
        ///	 <summary> * fitsXYZ - checks whether <code>rangelist</code> matches the (AllowedX,
        ///	 * AllowedY, AllowedZ) or (PresentX, PresentY, PresentZ) values specified
        ///	 * for this State
        ///	 *  </summary>
        ///	 * <param name="rangelist">
        ///	 *            range list to test </param>
        ///	 * <param name="xyzlist">
        ///	 *            switches between (AllowedX, AllowedY, AllowedZ) and (PresentX,
        ///	 *            PresentY, PresentZ). </param>
        ///	 * <returns> boolean - true, if the 'rangelist' matches xyzlist or if
        ///	 *         AllowedX, AllowedY, AllowedZ are not specified </returns>
        ///
        private bool fitsXYZ(JDFShapeRangeList rangelist, EnumFitsValue xyzlist)
        {
            int siz = rangelist.Count;

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

                JDFNumberRangeList x, y, z;

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

                double         leftX  = left.Y;
                double         rightX = right.Y;
                JDFNumberRange rangeX = new JDFNumberRange(leftX, rightX);

                double         leftY  = left.X;
                double         rightY = right.X;
                JDFNumberRange rangeY = new JDFNumberRange(leftY, rightY);

                double         leftZ  = left.Z;
                double         rightZ = right.Z;
                JDFNumberRange rangeZ = new JDFNumberRange(leftZ, rightZ);

                if (xyzlist.Equals(EnumFitsValue.Allowed))
                {
                    x = getAllowedX();
                    y = getAllowedY();
                    z = getAllowedZ();
                }
                else
                {
                    x = getPresentX();
                    y = getPresentY();
                    z = getPresentZ();
                }

                bool bFit = true;
                if (x.Count != 0)
                {
                    bFit = x.isPartOfRange(rangeX);
                }
                if (!bFit)
                {
                    return(false);
                }

                if (y.Count != 0)
                {
                    bFit = y.isPartOfRange(rangeY);
                }
                if (!bFit)
                {
                    return(false);
                }

                if (z.Count != 0)
                {
                    bFit = z.isPartOfRange(rangeZ);
                }
                if (!bFit)
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #7
0
 //         ---------------------------------------------------------------------
 //        Methods for Attribute SourceFrequency
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute SourceFrequency </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setSourceFrequency(JDFNumberRange @value)
 {
     setAttribute(AttributeName.SOURCEFREQUENCY, @value, null);
 }