Esempio n. 1
0
        public int CompareTo(ColorRange other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            return(StartIndex.CompareTo(other.StartIndex));
        }
Esempio n. 2
0
        public int CompareTo(PalindromeResult other)
        {
            if (0 == Palindrome.CompareTo(other.Palindrome))
            {
                return(StartIndex.CompareTo(other.StartIndex));
            }

            // We reverse the comaprsion for length, as longer means a better palindrome
            // so should appear first
            var comparison = other.Palindrome.Length.CompareTo(Palindrome.Length);

            return(0 == comparison?StartIndex.CompareTo(other.StartIndex) : comparison);
        }
        /// <summary>
        /// Compares this EntityDefinition to the passed in EntityDefinition
        /// The ordering follows the following precedence (stopping when one value differs)
        /// Higher score
        /// Case insensitive lexicographic ordering Type
        /// Case sensitive lexicographic Entity (value)
        /// Earlier in the string first
        /// Shorter first
        /// </summary>
        /// <param name="other">The EntityDefinition to compare against</param>
        /// <returns>The result of the comparison</returns>
        public int CompareTo(LuisEntity other)
        {
            if (object.ReferenceEquals(other, null))
            {
                return(1);
            }

            // Compare score (higher comes first)
            var comparison = other.Score.CompareTo(Score);

            // Compare Type
            if (comparison == 0)
            {
                comparison = string.Compare(Type, other.Type, StringComparison.Ordinal);
            }

            // Compare Entity
            if (comparison == 0)
            {
                comparison = string.Compare(Entity, other.Entity, StringComparison.Ordinal);
            }

            // Compare StartIndex
            if (comparison == 0)
            {
                comparison = StartIndex.CompareTo(other.StartIndex);
            }

            // Compare EndIndex
            if (comparison == 0)
            {
                comparison = EndIndex.CompareTo(other.EndIndex);
            }

            return(comparison);
        }
 public virtual int CompareTo(TwitterEntity other)
 {
     return(StartIndex.CompareTo(other.StartIndex));
 }
Esempio n. 5
0
 public int CompareTo(FuriganaPart other)
 {
     return(StartIndex.CompareTo(other.StartIndex));
 }
Esempio n. 6
0
 public int CompareTo(CacheRegion other)
 {
     return(StartIndex.CompareTo(other.StartIndex));
 }