Пример #1
0
        ///
        ///	 <summary> * test whether a given node has the corect Types and Type Attribute
        ///	 *  </summary>
        ///	 * <param name="testRoot"> the JDF or JMF to test
        ///	 *  </param>
        ///	 * <returns> VElement - the list of matching JDF nodes, null if none found
        ///	 *  </returns>
        ///
        public virtual VElement getMatchingTypeNodeVector(JDFNode testRoot)
        {
            VElement vDeviceCap = getChildElementVector(ElementName.DEVICECAP, null, null, false, -1, false);

            if (vDeviceCap == null || vDeviceCap.IsEmpty())
            {
                return(null);
            }
            VElement vRet = new VElement();

            for (int i = 0; i < vDeviceCap.Count; i++)
            {
                VElement vMatch = ((JDFDeviceCap)vDeviceCap[i]).getMatchingTypeNodeVector(testRoot);
                if (vMatch != null)
                {
                    vRet.addAll(vMatch);
                }
            }
            vRet.unify();
            return(vRet.IsEmpty() ? null : vRet);
        }
Пример #2
0
        ///
        ///	 <summary> * Gets of jdfRoot a vector of all executable nodes (jdf root or children nodes that this Device may execute)
        ///	 *  </summary>
        ///	 * <param name="jdfRoot"> the node we test </param>
        ///	 * <param name="testlists"> testlists that are specified for the State elements (FitsValue_Allowed or FitsValue_Present)<br>
        ///	 *            Will be used in fitsValue method of the State class. </param>
        ///	 * <param name="level"> validation level </param>
        ///	 * <returns> VElement - vector of executable JDFNodes </returns>
        ///
        public virtual VElement getExecutableJDF(JDFNode docRoot, EnumFitsValue testlists, EnumValidationLevel validationLevel)
        {
            VElement vDC = getChildElementVector(ElementName.DEVICECAP, null, null, true, -1, false);

            if (vDC == null || vDC.IsEmpty())
            {
                return(null);
            }

            VElement vn = new VElement();

            for (int i = 0; i < vDC.Count; i++)
            {
                JDFDeviceCap dc            = (JDFDeviceCap)vDC[i];
                VElement     executableJDF = dc.getExecutableJDF(docRoot, testlists, validationLevel);
                if (executableJDF != null)
                {
                    vn.addAll(executableJDF);
                }
            }
            vn.unify();
            return(vn.IsEmpty() ? null : vn);
        }
Пример #3
0
        ///
        ///	 <summary> * Composes a BugReport in XML form for the given JDFNode 'jdfRoot'. Gives a list of error messages for 'jdfRoot'
        ///	 * and every child rejected Node.<br>
        ///	 * Returns <code>null</code> if there are no errors.
        ///	 *  </summary>
        ///	 * <param name="jdfRoot"> the node to test </param>
        ///	 * <param name="testlists"> testlists that are specified for the State elements (FitsValue_Allowed or FitsValue_Present)<br>
        ///	 *            Will be used in fitsValue method of the State class. </param>
        ///	 * <param name="level"> validation level </param>
        ///	 * <returns> XMLDoc - XMLDoc output of the error messages. If XMLDoc is null there are no errors. </returns>
        ///
        public XMLDoc getBadJDFInfo(JDFNode jdfRoot, EnumFitsValue testlists, EnumValidationLevel level)
        {
            VElement vDC = getChildElementVector(ElementName.DEVICECAP, null, null, true, -1, false);

            if (vDC == null || vDC.IsEmpty())
            {
                return(null);
            }

            VElement vn = new VElement();

            for (int i = 0; i < vDC.Count; i++)
            {
                JDFDeviceCap dc        = (JDFDeviceCap)vDC[i];
                XMLDoc       bugReport = dc.getBadJDFInfo(jdfRoot, testlists, level);
                if (bugReport == null)
                {
                    return(null);
                }
                vn.addAll(bugReport.getRoot().getChildElementVector(null, null, null, true, -1, false));
            }

            int vnSize = vn.Count;

            if (vnSize == 0)
            {
                return(null);
            }

            XMLDoc   bugReport2 = new XMLDoc("BugReport", null);
            KElement root       = bugReport2.getRoot();
            bool     bFit       = false;

            for (int i = 0; i < vnSize; i++)
            {
                KElement e = vn[i];
                if (JDFConstants.TRUE.Equals(e.getAttribute(JDFDeviceCap.FITS_TYPE)))
                {
                    bFit = true;
                }
            }
            if (bFit)
            {
                for (int i = 0; i < vnSize; i++)
                {
                    KElement e = vn[i];
                    if (JDFConstants.FALSE.Equals(e.getAttribute(JDFDeviceCap.FITS_TYPE)))
                    {
                        vn[i] = null;
                    }
                }
            }
            for (int i = 0; i < vnSize; i++)
            {
                if (vn[i] != null)
                {
                    root.moveElement(vn.item(i), null);
                }
            }
            return(bugReport2);
        }