Ejemplo n.º 1
0
        /// <summary>
        ///     Compare the position to another position.
        /// </summary>
        /// <param name="other">
        ///     The other position.
        /// </param>
        /// <returns>
        ///     0 if the positions are equal, greater than 0 if the other position is less than the current position, less than 0 if the other position is greater than the current position.
        /// </returns>
        public int CompareTo(Position other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            if (IsOneBased)
            {
                other = other.ToOneBased();
            }
            else if (IsZeroBased)
            {
                other = other.ToZeroBased();
            }

            int lineComparison = LineNumber.CompareTo(other.LineNumber);

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

            return(ColumnNumber.CompareTo(other.ColumnNumber));
        }
Ejemplo n.º 2
0
 public int CompareTo(GrepLine other)
 {
     if (other == null)
     {
         return(1);
     }
     else
     {
         return(LineNumber.CompareTo(other.LineNumber));
     }
 }
Ejemplo n.º 3
0
 public int CompareTo(object obj)
 {
     if (obj == null)
     {
         return(1);
     }
     if (obj is GrepLine)
     {
         return(LineNumber.CompareTo(((GrepLine)obj).LineNumber));
     }
     else
     {
         return(1);
     }
 }
Ejemplo n.º 4
0
    public int CompareTo(ClangLocation other)
    {
        // ReSharper disable once JoinDeclarationAndInitializer
        int result;

        result = string.Compare(FileName, other.FileName, StringComparison.Ordinal);
        // ReSharper disable once ConvertIfStatementToReturnStatement
        if (result != 0)
        {
            return(result);
        }

        result = LineNumber.CompareTo(other.LineNumber);

        return(result);
    }
Ejemplo n.º 5
0
        /// <summary>
        ///     Compare the position to another position.
        /// </summary>
        /// <param name="other">
        ///     The other position.
        /// </param>
        /// <returns>
        ///     0 if the positions are equal, greater than 0 if the other position is less than the current position, less than 0 if the other position is greater than the current position.
        /// </returns>
        public int CompareTo(Position other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            int lineComparison = LineNumber.CompareTo(other.LineNumber);

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

            return(ColumnNumber.CompareTo(other.ColumnNumber));
        }
Ejemplo n.º 6
0
        public int CompareTo(Event other)
        {
            var comparison = Timestamp.CompareTo(other.Timestamp);

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

            comparison = LineNumber.CompareTo(other.LineNumber);
            if (comparison != 0)
            {
                return(comparison);
            }

            return(Comparer <EventType> .Default.Compare(Type, other.Type));
        }
Ejemplo n.º 7
0
        /// <summary>
        ///     Compare the position to another position.
        /// </summary>
        /// <param name="other">
        ///     The other position.
        /// </param>
        /// <returns>
        ///     0 if the positions are equal, greater than 0 if the other position is less than the current position, less than 0 if the other position is greater than the current position.
        /// </returns>
        public int CompareTo(Position other)
        {
            if (IsOneBased)
            {
                other = other.ToOneBased();
            }
            else if (IsZeroBased)
            {
                other = other.ToZeroBased();
            }

            int lineComparison = LineNumber.CompareTo(other.LineNumber);

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

            return(ColumnNumber.CompareTo(other.ColumnNumber));
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Compares this Tbasic.Line to another Tbasic.Line by comparing their LineNumber
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public int CompareTo(Line other)
 {
     return(LineNumber.CompareTo(other.LineNumber));
 }
Ejemplo n.º 9
0
 public int CompareTo(
     ValueEnum <TValue> obj)
 {
     return(LineNumber.CompareTo(obj.LineNumber));
 }