Ejemplo n.º 1
0
        private int CompareEntries(MovieSeriesEntry left, MovieSeriesEntry right)
        {
            if (left.ParentSeries.IsStrictDescendantOf(right.ParentSeries))
            {
                return(left.ParentSeries.GetAllAncestors()
                       .Where(a => a.Entry != null)
                       .First(a => a.Entry !.ParentSeriesId == right.ParentSeriesId)
                       .Entry !
                       .SequenceNumber
                       .CompareTo(right.SequenceNumber));
            }

            if (right.ParentSeries.IsStrictDescendantOf(left.ParentSeries))
            {
                return(left.SequenceNumber.CompareTo(
                           right.ParentSeries.GetAllAncestors()
                           .Where(a => a.Entry != null)
                           .First(a => a.Entry !.ParentSeriesId == left.ParentSeriesId)
                           .Entry !
                           .SequenceNumber));
            }

            return(this.Compare(
                       new MovieSeriesListItem(left.ParentSeries),
                       new MovieSeriesListItem(right.ParentSeries)));
        }
Ejemplo n.º 2
0
        private int CompareEntries(FranchiseEntry left, FranchiseEntry right)
        {
            if (left.ParentFranchise.IsStrictDescendantOf(right.ParentFranchise))
            {
                return(left.ParentFranchise.GetAllAncestors()
                       .Where(a => a.Entry != null)
                       .First(a => a.Entry !.ParentFranchise.Id == right.ParentFranchise.Id)
                       .Entry !
                       .SequenceNumber
                       .CompareTo(right.SequenceNumber));
            }

            if (right.ParentFranchise.IsStrictDescendantOf(left.ParentFranchise))
            {
                return(left.SequenceNumber.CompareTo(
                           right.ParentFranchise.GetAllAncestors()
                           .Where(a => a.Entry != null)
                           .First(a => a.Entry !.ParentFranchise.Id == left.ParentFranchise.Id)
                           .Entry !
                           .SequenceNumber));
            }

            return(this.Compare(
                       new FranchiseListItem(left.ParentFranchise),
                       new FranchiseListItem(right.ParentFranchise)));
        }
 public int CompareTo(BufferedResponse other)
 {
     if (other == null)
     {
         return(1);
     }
     return(SequenceNumber.CompareTo(other.SequenceNumber));
 }
Ejemplo n.º 4
0
            public int CompareTo(MigrationId other)
            {
                var majorCompare = SequenceNumber.CompareTo(other.SequenceNumber);

                return(majorCompare != 0
                    ? majorCompare
                    : string.Compare(BranchSpecification, other.BranchSpecification, StringComparison.OrdinalIgnoreCase));
            }
Ejemplo n.º 5
0
        public int CompareTo(SrtEntry other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }

            if (ReferenceEquals(null, other))
            {
                return(1);
            }

            return(SequenceNumber.CompareTo(other.SequenceNumber));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Compares the current object with another object of the same type.
        /// </summary>
        /// <returns>
        /// A value that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the <paramref name="other"/> parameter.Zero This object is equal to <paramref name="other"/>. Greater than zero This object is greater than <paramref name="other"/>.
        /// </returns>
        /// <param name="other">An object to compare with this object.</param>
        public override int CompareTo(StreamSequenceToken other)
        {
            if (other == null)
            {
                return(1);
            }

            var token = other as EventSequenceTokenV2;

            if (token == null)
            {
                throw new ArgumentOutOfRangeException(nameof(other));
            }

            int difference = SequenceNumber.CompareTo(token.SequenceNumber);

            return(difference != 0 ? difference : EventIndex.CompareTo(token.EventIndex));
        }
Ejemplo n.º 7
0
        // Default comparator
        public int CompareTo(Message other)
        {
            //If two sequence numbers are the same
            if (SequenceNumber == other.SequenceNumber)
            {
                // Undeliverble message is smaller
                if (Deliverable && !other.Deliverable)
                {
                    return(1);
                }

                // Smaller process id
                return(ProcessID.CompareTo(other.ProcessID));
            }

            // Msg with smaller sequence number is smaller
            return(SequenceNumber.CompareTo(other.SequenceNumber));
        }
Ejemplo n.º 8
0
        private int CompareEntries(FranchiseListItem left, ListItem right, FranchiseEntry?entry)
        {
            if (entry == null)
            {
                return(this.CompareTitle(new FranchiseListItem(left.Franchise.GetRootSeries()), right));
            }

            if (left.Franchise.Id == entry.ParentFranchise.Id)
            {
                return(-1);
            }

            if (left.Franchise.IsStrictDescendantOf(entry.ParentFranchise))
            {
                return(left.Franchise.GetAllAncestors()
                       .Where(f => f.Entry != null)
                       .First(f => f.Entry !.ParentFranchise.Id == entry.ParentFranchise.Id)
                       .Entry !
                       .SequenceNumber
                       .CompareTo(entry.SequenceNumber));
            }

            return(this.Compare(left, new FranchiseListItem(entry.ParentFranchise)));
        }
Ejemplo n.º 9
0
#pragma warning restore 8509

        private int CompareEntries(MovieSeriesListItem left, ListItem right, MovieSeriesEntry?entry)
        {
            if (entry == null)
            {
                return(this.CompareTitleOrYears(new MovieSeriesListItem(left.MovieSeries.GetRootSeries()), right));
            }

            if (left.MovieSeries.Id == entry.ParentSeriesId)
            {
                return(-1);
            }

            if (left.MovieSeries.IsStrictDescendantOf(entry.ParentSeries))
            {
                return(left.MovieSeries.GetAllAncestors()
                       .Where(a => a.Entry != null)
                       .First(ms => ms.Entry !.ParentSeriesId == entry.ParentSeriesId)
                       .Entry !
                       .SequenceNumber
                       .CompareTo(entry.SequenceNumber));
            }

            return(this.Compare(left, new MovieSeriesListItem(entry.ParentSeries)));
        }
Ejemplo n.º 10
0
 public int CompareTo(object obj)
 {
     return(SequenceNumber.CompareTo(((Film)obj).SequenceNumber));
 }