/// /// <summary> * gets the ListType from a corresponding State/BasicPreflightTest element /// * </summary> /// * <returns> JDFBasicPreflightTest::EnumListType - the value of ListType /// * attribute </returns> /// public virtual JDFBasicPreflightTest.EnumListType getListType() { JDFAbstractState state = getState(); if (state != null) { return(state.getListType()); } JDFBasicPreflightTest basicPreflightTest = getBasicPreflightTest(); return(basicPreflightTest == null ? null : basicPreflightTest.getListType()); }
/// /// <summary> * gets the XPath to the attributes of a given JDF node /// * </summary> /// * <param name="jdf"> /// * JDF node to test </param> /// * <returns> String - the XPath to the attributes </returns> /// protected internal virtual string getEvalXPath(KElement jdf) { ICapabilityElement stateDC = getRefTarget(); if (stateDC == null) { return(null); } VString vPath = null; bool bElement = false; string attName = null; if (stateDC is JDFDevCap) { if (!(this is JDFIsPresentEvaluation)) // only ispresent may // reference a // devcap, all // others must // reference a state { return(null); } bElement = true; JDFDevCap dc = (JDFDevCap)stateDC; vPath = dc.getNamePathVector(true); // fix up for the fact that ispresent for a resource is actually a // link if (vPath != null) { for (int i = 0; i < vPath.Count; i++) { string path = vPath.stringAt(i); VString tokens = new VString(StringUtil.tokenize(path, "/", false)); if (tokens.Count == 3 && tokens.stringAt(1).Equals(ElementName.RESOURCEPOOL)) { tokens[1] = ElementName.RESOURCELINKPOOL; tokens[2] = tokens.stringAt(2) + "Link"; vPath[i] = StringUtil.setvString(tokens, "/", null, null); } } } } else if (stateDC is JDFDevCaps) { if (!(this is JDFIsPresentEvaluation)) // only ispresent may // reference a // devcap, all // others must // reference a state { return(null); } bElement = true; JDFDevCaps dc = (JDFDevCaps)stateDC; vPath = dc.getNamePathVector(); // fix up for the fact that ispresent for a resource is actually a // link if (vPath != null) { for (int i = 0; i < vPath.Count; i++) { string path = vPath.stringAt(i); VString tokens = new VString(StringUtil.tokenize(path, "/", false)); if (tokens.Count == 3 && tokens.stringAt(1).Equals(ElementName.RESOURCEPOOL)) { tokens[1] = ElementName.RESOURCELINKPOOL; string link = tokens.stringAt(2) + "Link"; EnumUsage lu = dc.getLinkUsage(); if (lu != null) { link += "[@Usage=\"" + lu.getName() + "\"]"; } tokens[2] = link; vPath[i] = StringUtil.setvString(tokens, "/", null, null); } } } } else { // we have found our state -> take its xPath and look for // corresponding elem in JDFNode, we test JDFAbstractState state = (JDFAbstractState)stateDC; if (state.getListType().Equals(EnumListType.Span)) { vPath = state.getNamePathVector(true); bElement = true; } else { KElement kdc = state.getParentNode_KElement(); if (kdc is IDeviceCapable) { vPath = ((IDeviceCapable)kdc).getNamePathVector(); } else if (kdc is ICapabilityElement) { vPath = ((ICapabilityElement)kdc).getNamePathVector(); } attName = state.getName(); } } if (vPath != null) { for (int i = 0; i < vPath.Count; i++) { string xPath = vPath.stringAt(i); int slash = xPath.Length; string finalS = null; do { string xPath2 = xPath.Substring(0, slash); if (jdf.matchesPath(xPath2, true)) { finalS = "." + xPath.Substring(slash); } slash = xPath2.LastIndexOf("/"); } while (slash >= 0 && finalS == null); if (finalS != null && !bElement) { finalS += "/@" + attName; } if (finalS != null) { return(finalS); } } } return(null); }