Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
            ///
            ///		 <summary> * sets the attribute occurence in the appropriate PartAmount when called for a resourceLink and creates the
            ///		 * AmountPool and/or PartAmount(s) if they are not yet there
            ///		 *  </summary>
            ///		 * <param name="attrib"> the attribute name </param>
            ///		 * <param name="value"> value to set in string form. </param>
            ///		 * <param name="nameSpaceURI"> the XML-namespace </param>
            ///		 * <param name="vPart"> defines which part of this ResourceLink the Amount belongs to, if empty set the ResourceLink
            ///		 *            root attribute. </param>
            ///		 * <exception cref="JDFException"> when called directly on a PartAmount
            ///		 * @since 060630 </exception>
            ///
            public static void setAmountPoolAttribute(IAmountPoolContainer poolParent, string attrib, string @value, string nameSpaceURI, VJDFAttributeMap vPart)
            {
                // ideally the method would be hidden in PartAmount
                if ((vPart == null) || (vPart.IsEmpty()) || vPart.Count == 1 && vPart[0].Count == 0)
                {
                    poolParent.setAttribute(attrib, @value, nameSpaceURI);
                    return;
                }
                poolParent.removeAttribute(attrib, nameSpaceURI); // either in the
                // pool or the
                // link, not both
                JDFAmountPool ap  = poolParent.getCreateAmountPool();
                JDFPartAmount pa0 = ap.getCreatePartAmount(vPart);

                pa0.setAttribute(attrib, @value, nameSpaceURI);
            }