/// /// <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(); } } }
public virtual void testGetCreatePartAmount() { JDFAttributeMap map = new JDFAttributeMap("Separation", "Black"); JDFAttributeMap map2 = new JDFAttributeMap("Separation", "Cyan"); VJDFAttributeMap vMap = new VJDFAttributeMap(); vMap.Add(map); vMap.Add(map2); JDFPartAmount pa1 = ap.getCreatePartAmount(map); Assert.AreEqual(map, pa1.getPartMap()); JDFPartAmount pa3 = ap.getCreatePartAmount(vMap); Assert.AreEqual(vMap, pa3.getPartMapVector()); JDFPartAmount pa4 = ap.getCreatePartAmount(vMap); Assert.AreEqual(pa3, pa4); JDFPartAmount pa2 = ap.getCreatePartAmount(map2); Assert.AreEqual(map2, pa2.getPartMap()); }