///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares 2 Generator objects</summary> /// <param name="theOne">the One</param> /// <param name="theOther">the Other</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsGeneratorIdentical(AtomGenerator theOne, AtomGenerator theOther) { if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { return(false); } if (String.Compare(theOne.Text, theOther.Text) != 0) { return(false); } if (String.Compare(theOne.Version, theOther.Version) != 0) { return(false); } if (AtomUri.Compare(theOne.Uri, theOther.Uri) != 0) { return(false); } return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares 2 text construct objects</summary> /// <param name="theOne">the One</param> /// <param name="theOther">the Other</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsTextConstructIdentical(AtomTextConstruct theOne, AtomTextConstruct theOther) { if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { return(false); } if (theOne.Type != theOther.Type) { return(false); } if (String.Compare(theOne.Text, theOther.Text) != 0) { return(false); } if (String.Compare(theOne.XmlName, theOther.XmlName) != 0) { return(false); } return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares 2 content objects</summary> /// <param name="theOne">the One content </param> /// <param name="theOther">the Other content</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsContentIdentical(AtomContent theOne, AtomContent theOther) { if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { return(false); } if (String.Compare(theOne.Type, theOther.Type) != 0) { return(false); } if (AtomUri.Compare(theOther.Src, theOther.Src) != 0) { return(false); } String content = theOther.Content == null ? "" : theOther.Content; String other = theOne.Content == null ? "" : theOne.Content; if (String.Compare(content, other) != 0) { return(false); } return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares a category</summary> /// <param name="theOne">the One category </param> /// <param name="theOther">the Other category</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsCategoryIdentical(AtomCategory theOne, AtomCategory theOther) { if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { return(false); } if (String.Compare(theOne.Label, theOther.Label) != 0) { return(false); } if (String.Compare(theOne.Term, theOther.Term) != 0) { return(false); } if (AtomUri.Compare(theOne.Scheme, theOther.Scheme) != 0) { return(false); } return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>public static bool IsPersonIdentical(AtomPerson theOne, AtomPerson theOther)</summary> /// <param name="theOne">the One Person </param> /// <param name="theOther">the Other Person</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsPersonIdentical(AtomPerson theOne, AtomPerson theOther) { if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { Tracing.TraceInfo("IsPersonIdentical: comparing base failed"); return(false); } Tracing.TraceInfo("IsPersonIdentical: comparing Name " + theOne.Name + " " + theOther.Name); if (String.Compare(theOne.Email, theOther.Email) != 0) { Tracing.TraceInfo("IsPersonIdentical: comparing email failed" + theOne.Email + " " + theOther.Email); return(false); } if (String.Compare(theOne.Name, theOther.Name) != 0) { Tracing.TraceInfo("IsPersonIdentical: comparing Name failed" + theOne.Name + " " + theOther.Name); return(false); } if (AtomUri.Compare(theOne.Uri, theOther.Uri) != 0) { Tracing.TraceInfo("IsPersonIdentical: comparing URI failed - " + theOne.Uri.ToString() + " " + theOther.Uri.ToString()); return(false); } return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares 2 IDs</summary> /// <param name="theOne">the One </param> /// <param name="theOther">the Other</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsBaseLinkIdentical(AtomBaseLink theOne, AtomBaseLink theOther) { if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { return(false); } if (AtomUri.Compare(theOne.Uri, theOther.Uri) != 0) { return(false); } return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares 2 link objects</summary> /// <param name="theOne">the One link</param> /// <param name="theOther">the Other link</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsLinkIdentical(AtomLink theOne, AtomLink theOther) { if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { return(false); } if (AtomUri.Compare(theOne.HRef, theOther.HRef) != 0) { return(false); } if (theOne.Length != theOther.Length) { return(false); } if (String.Compare(theOne.Rel, theOther.Rel) != 0) { return(false); } if (String.Compare(theOne.Type, theOther.Type) != 0) { return(false); } if (String.Compare(theOne.HRefLang, theOther.HRefLang) != 0) { return(false); } if (String.Compare(theOne.Title, theOther.Title) != 0) { return(false); } return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares 2 source objects</summary> /// <param name="theOne">the One source</param> /// <param name="theOther">the Other source</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsSourceIdentical(AtomSource theOne, AtomSource theOther) { Tracing.TraceInfo("Comparing source objects"); if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { return(false); } Tracing.TraceInfo("Source: comparing Authors collections"); if (!ObjectModelHelper.IsPersonCollectionIdentical(theOne.Authors, theOther.Authors)) { return(false); } Tracing.TraceInfo("Source: comparing Contributors collections"); if (!ObjectModelHelper.IsPersonCollectionIdentical(theOne.Contributors, theOther.Contributors)) { return(false); } Tracing.TraceInfo("Source: comparing categories collections"); if (!ObjectModelHelper.IsCategoryCollectionIdentical(theOne.Categories, theOther.Categories)) { return(false); } Tracing.TraceInfo("Source: comparing links collections"); if (!ObjectModelHelper.IsLinkCollectionIdentical(theOne.Links, theOther.Links)) { return(false); } if (!ObjectModelHelper.IsTextConstructIdentical(theOne.Title, theOther.Title)) { return(false); } if (!ObjectModelHelper.IsTextConstructIdentical(theOne.Rights, theOther.Rights)) { return(false); } if (!ObjectModelHelper.IsTextConstructIdentical(theOne.Subtitle, theOther.Subtitle)) { return(false); } if (!ObjectModelHelper.IsBaseLinkIdentical(theOne.Id, theOther.Id)) { return(false); } if (!ObjectModelHelper.IsGeneratorIdentical(theOne.Generator, theOther.Generator)) { return(false); } if (!ObjectModelHelper.IsBaseLinkIdentical(theOne.Icon, theOther.Icon)) { return(false); } if (!ObjectModelHelper.IsBaseLinkIdentical(theOne.Logo, theOther.Logo)) { return(false); } return(true); }