Esempio n. 1
0
        ///
        ///	 <summary> * delete this refElement and it's target
        ///	 *  </summary>
        ///	 * <param name="bCheckRefCount"> if true, check that no other element refers to the target before deleting<br>
        ///	 *            if bCheckRefCount=false, the target is force deleted </param>
        ///	 * <returns> JDFElement the deleted targeelement
        ///	 * @since 290502 </returns>
        ///
        public virtual JDFElement deleteRef(bool bCheckRefCount)
        {
            JDFResource e = getTarget();

            if (e != null)
            {
                if (bCheckRefCount)
                {
                    e.deleteUnLinked();
                }
                else
                {
                    e.deleteNode();
                }
            }
            // now zapp myself
            return((JDFElement)deleteNode());
        }
Esempio n. 2
0
        ///
        ///	 <summary> * inline this refElement by replacing it with a copy of its target
        ///	 *  </summary>
        ///	 * <returns> JDFElement - the newly created element </returns>
        ///
        public virtual JDFElement inlineRef()
        {
            int         i;
            JDFResource targetRes = getTarget();

            if (targetRes == null)
            {
                throw new JDFException("inlineRef: inlining null refElement rRef=" + getrRef());
            }
            JDFResource newInline = (JDFResource)appendElement(targetRes.Name, null);

            // copy elements and attributes
            newInline.setAttributes(targetRes);
            VElement v = targetRes.getChildElementVector(null, null, null, true, 0, false);

            for (i = 0; i < v.Count; i++)
            {
                newInline.copyElement(v.item(i), null);
            }

            newInline.cleanResourceAttributes();
            VString partNames = targetRes.getPartIDKeys();

            for (i = 0; i < partNames.Count; i++)
            {
                newInline.removeAttribute(partNames[i], null);
            }

            // replace this (the refElement) with newInline.
            // This effectively repositions newInline from the back to the original
            // position of this
            replaceElement(newInline);

            targetRes.deleteUnLinked();
            return(newInline);
        }