コード例 #1
0
        ///
        ///	 <summary> * add a link to one of the resources
        ///	 *  </summary>
        ///	 * <param name="bNew"> true - new link, false - original link </param>
        ///	 * <param name="r"> the resource that was valid before modification </param>
        ///	 * <param name="usage"> usage of the resource </param>
        ///	 * <returns> the ResourceLink object in the ResourceAudit that points to r </returns>
        ///

        public virtual JDFResourceLink addNewOldLink(bool bNew, JDFResource r, EnumUsage usage)
        {
            VElement v    = getChildElementVector(null, null, null, true, 0, false);
            int      iNew = bNew ? 0 : 1;

            for (int i = v.Count - 1; i >= 0; i--)
            {
                if (!(v[i] is JDFResourceLink))
                {
                    v.RemoveAt(i);
                }
            }

            if (v.Count != iNew)
            {
                throw new JDFException("JDFResourceLink::AddNewOldLink invalid  ResourceAudit");
            }
            JDFResourceLink l = (JDFResourceLink)appendElement(r.getLinkString(), JDFConstants.EMPTYSTRING);

            l.setTarget(r);
            l.setUsage(usage);
            return(l);
        }