Esempio n. 1
0
 public int CompareTo(Job other)
 {
     //EndOfProcessing of processin then thread id
     return((EndOfProcessing == other.EndOfProcessing)
         ? ThreadId.CompareTo(other.ThreadId)
         : EndOfProcessing.CompareTo(other.EndOfProcessing));
 }
Esempio n. 2
0
        /// <summary>
        /// Compares this ThreadInfo object to another to determine sorting order.
        /// </summary>
        /// <remarks>ThreadInfo instances are sorted by their ThreadId property.</remarks>
        /// <param name="other">The other ThreadInfo object to compare this object to.</param>
        /// <returns>An int which is less than zero, equal to zero, or greater than zero to reflect whether
        /// this ThreadInfo should sort as being less-than, equal to, or greater-than the other
        /// ThreadInfo, respectively.</returns>
        public int CompareTo(ThreadInfo other)
        {
            if (ReferenceEquals(other, null))
            {
                return(1); // We're not null, so we're greater than anything that is null.
            }
            if (ReferenceEquals(this, other))
            {
                return(0); // Refers to the same instance, so obviously we're equal.
            }
            // But in general, we compare first based on ThreadId.
            int compare = ThreadId.CompareTo(other.ThreadId);

            // Unfortunately, ThreadId isn't as unique as we thought, so do some follow-up compares.
            if (compare == 0)
            {
                compare = m_Packet.ThreadIndex.CompareTo(other.ThreadIndex);
            }

            if (compare == 0)
            {
                compare = m_Packet.Timestamp.CompareTo(other.Packet.Timestamp);
            }

            if (compare == 0)
            {
                compare = m_Packet.Sequence.CompareTo(other.Packet.Sequence);
            }

            if (compare == 0)
            {
                compare = Id.CompareTo(other.Id); // Finally, compare by Guid if we have to.
            }
            return(compare);
        }
Esempio n. 3
0
 int IComparable <DebugThread> .CompareTo(DebugThread other)
 {
     return(ThreadId.CompareTo(other.ThreadId));
 }