Пример #1
0
        ///
        ///	 <summary> * Get a vector of PartAmounts which are supersets of the filter defined by mPart<br>
        ///	 * i.e. mPart is a submap of all returned elements
        ///	 *  </summary>
        ///	 * <param name="mPart"> filter vector for the part to set the status
        ///	 *  </param>
        ///	 * <returns> VElement - the vector of PartAmount elements that fit, null if nothing matches </returns>
        ///
        public virtual VElement getMatchingPartAmountVector(JDFAttributeMap mPart)
        {
            VElement vPartAmount = getChildElementVector(ElementName.PARTAMOUNT, null, null, true, 0, false);
            int      size        = vPartAmount.Count;

            if (size == 0)
            {
                return(null);
            }
            VElement vPA = new VElement();

            for (int i = 0; i < size; i++)
            {
                JDFPartAmount    ps = (JDFPartAmount)vPartAmount[i];
                VJDFAttributeMap mm = ps.getPartMapVector();
                for (int j = 0; j < mm.Count; j++)
                {
                    JDFAttributeMap m = mm[j];
                    if (m.subMap(mPart))
                    {
                        vPA.Add(ps);
                        break;
                    }
                }
            }
            return(vPA.Count == 0 ? null : vPA);
        }
Пример #2
0
        ///
        ///	 <summary> * remove all partAmounts that are not specified in keepList
        ///	 *  </summary>
        ///	 * <param name="keepList"> partAmounts to keep </param>
        ///
        public virtual void reducePartAmounts(VJDFAttributeMap keepList)
        {
            if (keepList == null)
            {
                return;
            }

            VElement v = getChildElementVector(ElementName.PARTAMOUNT, null, null, true, -1, true);

            for (int i = 0; i < v.Count; i++)
            {
                JDFPartAmount   pa   = (JDFPartAmount)v[i];
                JDFAttributeMap map  = pa.getPartMap();
                bool            ciao = true;
                for (int j = 0; j < keepList.Count; j++)
                {
                    if (map.subMap(keepList[j]))
                    {
                        ciao = false;
                        break;
                    }
                }
                if (ciao)
                {
                    pa.deleteNode();
                }
            }
        }
Пример #3
0
        ///
        ///	 <summary> * get matching part status vector
        ///	 *  </summary>
        ///	 * <param name="JDFAttributeMap"> mPart </param>
        ///	 * <returns> VElement - vector of JDFPartStatus </returns>
        ///
        public virtual VElement getMatchingPartStatusVector(JDFAttributeMap mPart)
        {
            VElement vPartStatus = getChildElementVector(ElementName.PARTSTATUS, null, null, true, 0, false);
            VElement vPS         = new VElement();

            for (int i = 0; i < vPartStatus.Count; i++)
            {
                JDFPartStatus   ps      = (JDFPartStatus)vPartStatus[i];
                JDFAttributeMap mapPart = ps.getPartMap();

                if (mapPart.subMap(mPart))
                {
                    vPS.Add(ps); // mPart is a subset of of mapPart
                }
            }
            return(vPS);
        }
Пример #4
0
        ///
        ///	 * <param name="groupMap">
        ///	 * @return </param>
        ///
        public virtual JDFPRGroup getPRGroup(JDFAttributeMap groupMap)
        {
            VElement v = getChildElementVector(ElementName.PRGROUP, null, null, true, -1, false);

            for (int i = 0; i < v.Count; i++)
            {
                JDFPRGroup           pg  = (JDFPRGroup)v[i];
                JDFPRGroupOccurrence pgo = pg.getPRGroupOccurrence();
                if (pgo == null)
                {
                    continue;
                }
                JDFAttributeMap map = pgo.getAttributeMap();
                if (map.subMap(groupMap))
                {
                    return(pg);
                }
            }
            return(null);
        }
Пример #5
0
        ///
        ///	 <summary> * getPartStatus - get a PartStatus that fits to the filter defined by mPart
        ///	 *  </summary>
        ///	 * <param name="mPart"> the filter for the part to set the status
        ///	 *  </param>
        ///	 * <returns> JDFPartStatus - the PartStatus that fits </returns>
        ///
        public virtual JDFPartStatus getPartStatus(JDFAttributeMap mPart)
        {
            VElement      vPartStatus   = getChildElementVector(ElementName.PARTSTATUS, null, null, true, 0, false);
            int           nSep          = 0;
            JDFPartStatus retPartStatus = null;

            for (int i = vPartStatus.Count - 1; i >= 0; i--)
            {
                JDFPartStatus   ps      = (JDFPartStatus)vPartStatus[i];
                JDFAttributeMap mapPart = ps.getPartMap();

                if (mPart != null && mPart.subMap(mapPart))
                {
                    if (mapPart.Count > nSep)
                    {
                        nSep          = mapPart.Count;
                        retPartStatus = ps; // mPart is a subset of of mapPart
                    }
                }
            }

            return(retPartStatus);
        }