Exemplo n.º 1
0
 public int CompareTo(Pair <T, K> other)
 {
     if (First.CompareTo(other.First) != 0)
     {
         return(First.CompareTo(other.First));
     }
     return(Second.CompareTo(other.Second));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Ordering comparer for two Name objects by Last Name
 /// </summary>
 /// <param name="name"> the name to compare this objects name to.</param>
 /// <returns>int 0 if equal; >0 if this name is greater;<0 otherwise</returns>
 public int CompareTo(Name name)
 {
     //if last name not equal, base CompareTo on last name only;
     //  else base decision on first name
     if (!Last.Equals(name.Last))//if last are equal
     {
         return(Last.CompareTo(name.Last));
     }
     return(First.CompareTo(name.First)); //then compare first
 }
Exemplo n.º 3
0
        public int CompareTo(IKeyPress other)
        {
            if (other is KeyChord keyChord)
            {
                var first = First.CompareTo(keyChord.First);
                return((first == 0) ? Second.CompareTo(keyChord.Second) : first);
            }

            return(First.CompareTo(other as KeyPress));
        }
Exemplo n.º 4
0
        public int CompareTo(CharRange other)
        {
            var c = First.CompareTo(other.First);

            if (0 == c)
            {
                c = Last.CompareTo(other.Last);
            }
            return(c);
        }
Exemplo n.º 5
0
Arquivo: Pair.cs Projeto: znsoft/AiCup
 public int CompareTo(Tuple <TFirst, TSecond, TThird> other)
 {
     if (First.CompareTo(other.First) != 0)
     {
         return(First.CompareTo(other.First));
     }
     if (Second.CompareTo(other.Second) != 0)
     {
         return(Second.CompareTo(other.Second));
     }
     return(Third.CompareTo(other.Third));
 }
Exemplo n.º 6
0
 public int CompareTo(ComparableFakeType other)
 {
     if (ReferenceEquals(this, other))
     {
         return(0);
     }
     if (ReferenceEquals(null, other))
     {
         return(1);
     }
     return(First.CompareTo(other.First));
 }
Exemplo n.º 7
0
        /// <summary>
        /// Performs record-by-record processing functionality for the cmdlet.
        /// </summary>
        protected override void ProcessRecord()
        {
            var differences = GetDifferences();

            var comparison = First.CompareTo(Second, differences);

            if (Reduce)
            {
                comparison = comparison.Reduce();
            }

            WriteObject(comparison);
        }
Exemplo n.º 8
0
        public int CompareTo(Pair <T, U> other)
        {
            int firstCompare = First.CompareTo(other.First);

            if (firstCompare != 0)
            {
                return(-firstCompare);
            }
            else
            {
                return(-Second.CompareTo(other.Second));
            }
        }
Exemplo n.º 9
0
 public int CompareTo(Player other)
 {
     if (Position != other.Position)
     {
         return(Position.CompareTo(other.Position));
     }
     if (Last != other.Last)
     {
         return(Last.CompareTo(other.Last));
     }
     if (First != other.First)
     {
         return(First.CompareTo(other.First));
     }
     return(Nfl.CompareTo(other.Nfl));
 }
Exemplo n.º 10
0
        public int CompareTo(Pair <T1, T2> other)
        {
            if (this.Equals(other))
            {
                return(0);
            }
            var cmp = First.CompareTo(other.First);

            if (cmp != 0)
            {
                return(cmp);
            }
            else
            {
                return(Second.CompareTo(other.Second));
            }
        }
Exemplo n.º 11
0
        public int CompareTo(object obj)
        {
            ComparablePair <S, T> op = obj as ComparablePair <S, T>;

            if (op == null)
            {
                return(-1);
            }

            var k = First.CompareTo(op.First);

            if (k != 0)
            {
                return(k);
            }
            else
            {
                return(Second.CompareTo(op.Second));
            }
        }
Exemplo n.º 12
0
            public int CompareTo(object obj)
            {
                var c = (Code)obj;

                if (First.CompareTo(c.First) == 0)
                {
                    if (Second.CompareTo(c.Second) == 0)
                    {
                        return(Third.CompareTo(c.Third));
                    }
                    else
                    {
                        return(Second.CompareTo(c.Second));
                    }
                }
                else
                {
                    return(First.CompareTo(c.First));
                }
            }
Exemplo n.º 13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int CompareTo(object obj)
        {
            if (!(obj is VertexPair))
            {
                throw new ArgumentException("obj is not of type VertexPair");
            }

            VertexPair vp = (VertexPair)obj;

            // comparing first and second
            int c = First.CompareTo(vp.First);

            if (c != 0)
            {
                return(c);
            }
            else
            {
                return(Second.CompareTo(vp.Second));
            }
        }
Exemplo n.º 14
0
 public int CompareTo(ComparablePair <T, U> other)
 {
     return(First.CompareTo(other.First));
 }
Exemplo n.º 15
0
 public int CompareTo(PositionMarker other)
 {
     var firstComparison = First.CompareTo(other.First);
     if (firstComparison != 0) return firstComparison;
     return Second.CompareTo(other.Second);
 }
Exemplo n.º 16
0
 public int CompareTo(IntPair other) => First.CompareTo(other.First);