/// <summary> /// Compare the user entered data against the passed instance for similarity. /// </summary> /// <param name="obj">The object to compare this instance against.</param> /// <returns> /// True if instance matches user data, otherwise false. /// </returns> public override bool IsEquivalentTo(object obj) { var repository = obj as GedcomRepositoryCitation; if (repository == null) { return(false); } if (!GedcomGenericListComparer.CompareLists(CallNumbers, repository.CallNumbers)) { return(false); } if (!GedcomGenericListComparer.CompareLists(MediaTypes, repository.MediaTypes)) { return(false); } if (!GedcomGenericListComparer.CompareLists(OtherMediaTypes, repository.OtherMediaTypes)) { return(false); } if (!Equals(Repository, repository.Repository)) { return(false); } return(true); }
/// <summary> /// Compare the user entered data against the passed instance for similarity. /// </summary> /// <param name="obj">The object to compare this instance against.</param> /// <returns> /// True if instance matches user data, otherwise false. /// </returns> public override bool IsEquivalentTo(object obj) { var media = obj as GedcomMultimediaRecord; if (media == null) { return(false); } if (!Equals(ChangeDate, media.ChangeDate)) { return(false); } if (!GedcomGenericListComparer.CompareLists(Files, media.Files)) { return(false); } if (!Equals(Title, media.Title)) { return(false); } return(true); }
/// <summary> /// Compare the user entered data against the passed instance for similarity. /// </summary> /// <param name="obj">The object to compare this instance against.</param> /// <returns> /// True if instance matches user data, otherwise false. /// </returns> public override bool IsEquivalentTo(object obj) { var submitter = obj as GedcomSubmitterRecord; if (submitter == null) { return(false); } if (!Equals(Address, submitter.Address)) { return(false); } if (!GedcomGenericListComparer.CompareLists(LanguagePreferences, submitter.LanguagePreferences)) { return(false); } if (!Equals(Name, submitter.Name)) { return(false); } if (!Equals(RegisteredRFN, submitter.RegisteredRFN)) { return(false); } return(true); }
/// <summary> /// Compares the inheriting instance user entered data against the passed GedcomRecord. /// If that matches, will then compare the common elements of the passed GedcomRecord /// against this instance (Source etc. which are common to all inheritors). /// </summary> /// <param name="obj">The GedcomRecord to compare against.</param> /// <returns>True if the core base properties match, otherwise False.</returns> public bool Equals(GedcomRecord obj) { if (obj == null || GetType() != obj.GetType()) { return(false); } // Ask the inheriting object if its user entered data is the same. if (!IsEquivalentTo(obj)) { return(false); } var record = obj as GedcomRecord; if (!Equals(ChangeDate, record.ChangeDate)) { return(false); } if (!Equals(Level, record.Level)) { return(false); } if (!Equals(RestrictionNotice, record.RestrictionNotice)) { return(false); } if (!GedcomGenericListComparer.CompareGedcomRecordLists(Sources, record.Sources)) { return(false); } if (!GedcomGenericListComparer.CompareLists(Multimedia, record.Multimedia)) { return(false); } /* TODO: Notes are hard work, we need to do lookups by xref instead of just having a list of GedcomNote records attached. Need to fix this as a pain to test and use as well. * //if (!GedcomGenericListComparer.CompareLists(Notes, record.Notes)) * //{ * // return false; * //} */ return(true); }
/// <summary> /// Compares this place record to another record. /// </summary> /// <param name="place">A place record.</param> /// <returns> /// <0 if the this record precedes the other in the sort order; /// >0 if the other record precedes this one; /// 0 if the records are equal /// </returns> public int CompareTo(GedcomPlace place) { if (place == null) { return(1); } var compare = string.Compare(Form, place.Form); if (compare != 0) { return(compare); } compare = string.Compare(Latitude, place.Latitude); if (compare != 0) { return(compare); } compare = string.Compare(Longitude, place.Longitude); if (compare != 0) { return(compare); } compare = string.Compare(Name, place.Name); if (compare != 0) { return(compare); } compare = GedcomGenericListComparer.CompareListOrder(PhoneticVariations, place.PhoneticVariations); if (compare != 0) { return(compare); } compare = GedcomGenericListComparer.CompareListOrder(RomanizedVariations, place.RomanizedVariations); if (compare != 0) { return(compare); } return(compare); }
/// <summary> /// Compare the user entered data against the passed instance for similarity. /// </summary> /// <param name="obj">The object to compare this instance against.</param> /// <returns> /// True if instance matches user data, otherwise false. /// </returns> public override bool IsEquivalentTo(object obj) { var place = obj as GedcomPlace; if (place == null) { return(false); } if (!Equals(ChangeDate, place.ChangeDate)) { return(false); } if (!Equals(Form, place.Form)) { return(false); } if (!Equals(Latitude, place.Latitude)) { return(false); } if (!Equals(Longitude, place.Longitude)) { return(false); } if (!Equals(Name, place.Name)) { return(false); } if (!GedcomGenericListComparer.CompareLists(PhoneticVariations, place.PhoneticVariations)) { return(false); } if (!GedcomGenericListComparer.CompareLists(RomanizedVariations, place.RomanizedVariations)) { return(false); } return(true); }
/// <summary> /// Determines whether the specified <see cref="object" />, is equal (in contents, not structure) to this instance. /// </summary> /// <param name="gedcomDb">The <see cref="object" /> to compare with this instance.</param> /// <returns> /// <c>true</c> if the specified <see cref="object" /> is equal to this instance; otherwise, <c>false</c>. /// </returns> public bool Equals(GedcomDatabase gedcomDb) { if (gedcomDb == null) { return(false); } if (!Equals(Header, gedcomDb.Header)) { return(false); } if (!GedcomGenericListComparer.CompareGedcomRecordLists(Individuals, gedcomDb.Individuals)) { return(false); } return(true); }
/// <summary> /// Compares two GedcomName instances by using the full name. /// </summary> /// <param name="other">The name to compare against this instance.</param> /// <returns>An integer specifying the relative sort order.</returns> public int CompareTo(GedcomName other) { if (other == null) { return(1); } var compare = string.Compare(Type, other.Type); if (compare != 0) { return(compare); } compare = GedcomGenericListComparer.CompareListOrder(PhoneticVariations, other.PhoneticVariations); if (compare != 0) { return(compare); } compare = GedcomGenericListComparer.CompareListOrder(RomanizedVariations, other.RomanizedVariations); if (compare != 0) { return(compare); } compare = string.Compare(Surname, other.Surname); if (compare != 0) { return(compare); } compare = string.Compare(Prefix, other.Prefix); if (compare != 0) { return(compare); } compare = string.Compare(Given, other.Given); if (compare != 0) { return(compare); } compare = string.Compare(SurnamePrefix, other.SurnamePrefix); if (compare != 0) { return(compare); } compare = string.Compare(Suffix, other.Suffix); if (compare != 0) { return(compare); } compare = string.Compare(Nick, other.Nick); if (compare != 0) { return(compare); } compare = PreferredName.CompareTo(other.PreferredName); if (compare != 0) { return(compare); } return(compare); }
/// <summary> /// Compare the user entered data against the passed instance for similarity. /// </summary> /// <param name="obj">The object to compare this instance against.</param> /// <returns> /// True if instance matches user data, otherwise false. /// </returns> public override bool IsEquivalentTo(object obj) { var source = obj as GedcomSourceRecord; if (source == null) { return(false); } if (!Equals(Agency, source.Agency)) { return(false); } if (!GedcomGenericListComparer.CompareGedcomRecordLists(Citations, source.Citations)) { return(false); } if (!GedcomGenericListComparer.CompareLists(DataNotes, source.DataNotes)) { return(false); } if (!GedcomGenericListComparer.CompareLists(EventsRecorded, source.EventsRecorded)) { return(false); } if (!Equals(FiledBy, source.FiledBy)) { return(false); } if (!Equals(Originator, source.Originator)) { return(false); } if (!Equals(Convert.ToString(OriginatorText), Convert.ToString(source.OriginatorText))) { return(false); } if (!Equals(PublicationFacts, source.PublicationFacts)) { return(false); } if (!Equals(Convert.ToString(PublicationText), Convert.ToString(source.PublicationText))) { return(false); } if (!GedcomGenericListComparer.CompareGedcomRecordLists(RepositoryCitations, source.RepositoryCitations)) { return(false); } if (!Equals(Text, source.Text)) { return(false); } if (!Equals(Convert.ToString(TextText), Convert.ToString(source.TextText))) { return(false); } if (!Equals(Title, source.Title)) { return(false); } if (!Equals(Convert.ToString(TitleText), Convert.ToString(source.TitleText))) { return(false); } return(true); }