public virtual void testMatchesType() { JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); n.setType("bar", false); Assert.IsFalse(devicecap.matchesType(n, true)); Assert.IsFalse(devicecap.matchesType(n, false)); Assert.IsFalse(device.matchesType(n, true)); Assert.IsFalse(device.matchesType(n, false)); n.setType("fnarf", false); Assert.IsTrue(devicecap.matchesType(n, true)); Assert.IsTrue(devicecap.matchesType(n, false)); Assert.IsTrue(device.matchesType(n, true)); Assert.IsTrue(device.matchesType(n, false)); n.setType("blub", false); Assert.IsTrue(devicecap.matchesType(n, true)); Assert.IsTrue(devicecap.matchesType(n, false)); Assert.IsTrue(device.matchesType(n, true)); Assert.IsTrue(device.matchesType(n, false)); n.setType("Combined", false); n.setTypes(new VString("blub fnarf", " ")); Assert.IsFalse(devicecap.matchesType(n, true)); Assert.IsFalse(devicecap.matchesType(n, false)); Assert.IsTrue(devicecapProduct.matchesType(n, true)); Assert.IsTrue(devicecapProduct.matchesType(n, false)); Assert.IsTrue(device.matchesType(n, false)); devicecap.setCombinedMethod(EnumCombinedMethod.ProcessGroup); n.setType("ProcessGroup", true); JDFNode n2 = n.addJDFNode("fnarf"); Assert.IsFalse(devicecap.matchesType(n, true)); Assert.IsTrue(devicecap.matchesType(n, false)); Assert.IsTrue(device.matchesType(n, true)); Assert.IsTrue(device.matchesType(n, false)); Assert.IsFalse(devicecap.matchesType(n2, true), "method pg for local individual process"); Assert.IsFalse(devicecap.matchesType(n2, false)); Assert.IsTrue(devicecapProduct.matchesType(n2, false)); Assert.IsTrue(device.matchesType(n2, false)); }
/// /// <summary> * return all deviceCap elements that correspond to testRoot /// * </summary> /// * <param name="testRoot"> the JDF or JMF to test /// * </param> /// * <returns> VElement - the list of matching devicecap nodes, null if none found /// * </returns> /// public virtual VElement getMatchingDeviceCapVector(JDFNode testRoot, bool bLocal) { 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++) { JDFDeviceCap dc = (JDFDeviceCap)vDeviceCap[i]; if (dc.matchesType(testRoot, bLocal)) { vRet.Add(dc); } } return(vRet.IsEmpty() ? null : vRet); }