/// /// <summary> * add string id uniquely to the vector of dirty ids /// * </summary> /// * <param name="e"> the element to be added to the dirty list </param> /// * <param name="bAttribute"> if true, only attributes are dirty, else also sub-elements </param> /// * <returns> VString - the vector of element IDs after appending id </returns> /// internal virtual VString setDirty(KElement e, bool bAttribute) { globalDirty = true; if (dirtyPolicy == EnumDirtyPolicy.XPath) { string x = e.buildXPath(null, 1); if (bAttribute) { x += "/@"; } int i; int size = m_vDirtyID.Count; for (i = 0; i < size; i++) { string s = m_vDirtyID[i]; if (s.StartsWith(x)) { if (s.Equals(x)) // e is already dirty { return(m_vDirtyID); } m_vDirtyID.RemoveAt(i); i--; } else if (x.StartsWith(s)) // we have a dirty parent, do // nothing { return(m_vDirtyID); } else if (x.CompareTo(s) > 0) // keep sorted { break; } } m_vDirtyID.Insert(i, x); } else if (dirtyPolicy == EnumDirtyPolicy.ID) { m_vDirtyID.appendUnique(e.getInheritedAttribute(AttributeName.ID, null, JDFConstants.EMPTYSTRING)); } return(m_vDirtyID); }
/// /// <summary> * checks if <code>element</code> is dirty /// * </summary> /// * <param name="element"> element to check </param> /// * <returns> true, if <code>element</code> is dirty </returns> /// public virtual bool isDirty(KElement element) { if (element == null) { return(false); } if (dirtyPolicy == EnumDirtyPolicy.Doc) { return(globalDirty); } else if (dirtyPolicy == EnumDirtyPolicy.ID) { string id = element.getInheritedAttribute("ID", null, null); return(isDirty(id)); } else if (dirtyPolicy == EnumDirtyPolicy.XPath) { string xPath = element.buildXPath(null, 1); return(isDirty(xPath)); } return(false); }