示例#1
0
        /// <summary>
        /// Compares this event to another record.
        /// </summary>
        /// <param name="other">A recorded event.</param>
        /// <returns>
        /// &lt;0 if the first event precedes the second in the sort order;
        /// &gt;0 if the second event precedes the first;
        /// 0 if the events are equal
        /// </returns>
        public int CompareTo(GedcomRecordedEvent other)
        {
            if (other == null)
            {
                return(1);
            }

            var compare = CompareEvents(Types, other.Types);

            if (compare != 0)
            {
                return(compare);
            }

            compare = GedcomGenericComparer.SafeCompareOrder(Date, other.Date);
            if (compare != 0)
            {
                return(compare);
            }

            compare = GedcomGenericComparer.SafeCompareOrder(Place, other.Place);
            if (compare != 0)
            {
                return(compare);
            }

            return(compare);
        }
示例#2
0
        /// <summary>
        /// Compares another source citation to the current instance.
        /// </summary>
        /// <param name="citation">A citation.</param>
        /// <returns>
        /// &lt;0 if this citation precedes the other in the sort order;
        /// &gt;0 if the other citation precedes this one;
        /// 0 if the citations are equal
        /// </returns>
        public int CompareTo(GedcomSourceCitation citation)
        {
            if (citation == null)
            {
                return(1);
            }

            var compare = Certainty.CompareTo(citation.Certainty);

            if (compare != 0)
            {
                return(compare);
            }

            compare = GedcomGenericComparer.SafeCompareOrder(Date, citation.Date);
            if (compare != 0)
            {
                return(compare);
            }

            compare = GedcomGenericComparer.SafeCompareOrder(EventType, citation.EventType);
            if (compare != 0)
            {
                return(compare);
            }

            compare = GedcomGenericComparer.SafeCompareOrder(Page, citation.Page);
            if (compare != 0)
            {
                return(compare);
            }

            compare = GedcomGenericComparer.SafeCompareOrder(Role, citation.Role);
            if (compare != 0)
            {
                return(compare);
            }

            compare = GedcomGenericComparer.SafeCompareOrder(Text, citation.Text);
            if (compare != 0)
            {
                return(compare);
            }

            return(compare);
        }