Beispiel #1
0
        ///
        ///	 <summary> * replace
        ///	 *  </summary>
        ///	 * <param name="newLink"> node to insert </param>
        ///	 * <returns> the updated element </returns>
        ///
        public virtual JDFResourceLink updateLink(JDFResourceLink newLink)
        {
            VElement v = getResourceLinkVector();

            if (v.Count > 2)
            {
                throw new JDFException("JDFResourceLink.UpdateLink invalid  ResourceAudit");
            }

            // update of an update, delete the first element and assume the second
            // is the real original
            if (v.Count > 1)
            {
                (v[0]).deleteNode();
                v.Remove(v[0]);
            }

            // the updated link is the first
            JDFResourceLink resLink = (JDFResourceLink)copyElement(newLink, null);

            if (v.Count > 0)
            {
                resLink = (JDFResourceLink)InsertBefore(resLink, v[0]);
            }
            return(resLink);
        }
Beispiel #2
0
        ///
        ///	 <summary> * Get the vector of ResourceLinks
        ///	 *  </summary>
        ///	 * <returns> VElement: the resource links in this </returns>
        ///
        public virtual VElement getResourceLinkVector()
        {
            VElement v = getChildElementVector(null, null, null, true, 0, false);

            for (int i = v.Count - 1; i >= 0; i--)
            {
                JDFElement e = (JDFElement)v[i];

                if (!(e is JDFResourceLink))
                {
                    v.Remove(v[i]);
                }
            }
            return(v);
        }