Exemplo n.º 1
0
        public void CompareTo_ObjectTestStruct_0()
        {
            object other = TestStruct;

            var exp = 0;
            var act = TestStruct.CompareTo(other);

            Assert.AreEqual(exp, act);
        }
Exemplo n.º 2
0
        public void GetLastTimestamp()
        {
            Timestamp timestamp1 = Timestamp.CreateNew();
            int       res        = timestamp1.CompareTo(Timestamp.GetLastTimestamp());

            Assert.AreEqual(0, res);

            Timestamp timestamp2 = Timestamp.CreateNew();

            res = timestamp2.CompareTo(Timestamp.GetLastTimestamp());
            Assert.AreEqual(0, res);

            res = timestamp1.CompareTo(Timestamp.GetLastTimestamp());
            Assert.AreNotEqual(0, res);
        }
Exemplo n.º 3
0
        public int CompareTo(Nep5TransferKey other)
        {
            if (other is null)
            {
                return(1);
            }
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            int result = UserScriptHash.CompareTo(other.UserScriptHash);

            if (result != 0)
            {
                return(result);
            }
            int result2 = Timestamp.CompareTo(other.Timestamp);

            if (result2 != 0)
            {
                return(result2);
            }
            int result3 = AssetScriptHash.CompareTo(other.AssetScriptHash);

            if (result3 != 0)
            {
                return(result3);
            }
            return(BlockXferNotificationIndex.CompareTo(other.BlockXferNotificationIndex));
        }
Exemplo n.º 4
0
 public int CompareTo(object obj)
 {
     if (obj == null || !(obj is OutputRow))
     {
         return(1);
     }
     return(Timestamp.CompareTo(((OutputRow)obj).Timestamp));
 }
Exemplo n.º 5
0
 public int CompareTo(PersonAvailabilityEvent other)
 {
     if (other == null)
     {
         return(-1);
     }
     return(Timestamp.CompareTo(other.Timestamp));
 }
Exemplo n.º 6
0
        public void BinaryCompare1()
        {
            Timestamp timestamp1 = Timestamp.CreateNew();
            Timestamp timestamp2 = timestamp1;

            int res = timestamp1.CompareTo(timestamp2);

            Assert.AreEqual(0, res);
        }
Exemplo n.º 7
0
        public void BinaryCompare3()
        {
            Timestamp timestamp1 = Timestamp.CreateNew();
            Timestamp timestamp2 = Timestamp.CreateNew();

            int res = timestamp2.CompareTo(timestamp1);

            Assert.IsTrue(res > 0);
        }
        public int CompareTo(GitHubEventPayloadName other)
        {
            if (other is null)
            {
                return(1);
            }

            return(Timestamp.CompareTo(other.Timestamp));
        }
Exemplo n.º 9
0
        public int CompareTo(Transaction other)
        {
            var r = Timestamp.CompareTo(other.Timestamp);

            if (r == 0)
            {
                r = Message.CompareTo(other.Message);
            }
            return(r);
        }
Exemplo n.º 10
0
        public int CompareTo(TaskBeganEventArgs other)
        {
            if (other == null)
            {
                return(-1);
            }
            int tsCompare = Timestamp.CompareTo(other.Timestamp);

            return(tsCompare == 0 ? TaskId.CompareTo(other.TaskId) : tsCompare);
        }
Exemplo n.º 11
0
            public int CompareTo(Key other)
            {
                var cmp = Timestamp.CompareTo(other.Timestamp);

                if (cmp != 0)
                {
                    return(cmp);
                }
                return(Id.CompareTo(other.Id));
            }
Exemplo n.º 12
0
        public int CompareTo(MigrationVersion other)
        {
            int ts = Timestamp.CompareTo(other.Timestamp);

            if (ts == 0)
            {
                ts = Name.CompareTo(other.Name);
            }
            return(ts);
        }
Exemplo n.º 13
0
 public int CompareTo(Measurement other)
 {
     if (ReferenceEquals(this, other))
     {
         return(0);
     }
     if (ReferenceEquals(null, other))
     {
         return(1);
     }
     return(Timestamp.CompareTo(other.Timestamp));
 }
Exemplo n.º 14
0
 public int CompareTo(UserAction other)
 {
     if (ReferenceEquals(this, other))
     {
         return(0);
     }
     if (ReferenceEquals(null, other))
     {
         return(1);
     }
     return(Timestamp.CompareTo(other.Timestamp));
 }
 public int CompareTo(PriceChanged other)
 {
     if (ReferenceEquals(this, other))
     {
         return(0);
     }
     if (ReferenceEquals(null, other))
     {
         return(1);
     }
     return(Timestamp.CompareTo(other.Timestamp));
 }
Exemplo n.º 16
0
        /// <summary>
        /// Compares the current object with another object of the same type.
        /// </summary>
        /// <returns>
        /// A 32-bit signed integer 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 int CompareTo(Loupe.Extensibility.Data.ILogMessage other)
        {
            int compare = Timestamp.CompareTo(other.Timestamp); // Compare by timestamp first, which works across sessions.

            if (compare == 0)
            {
                compare = Sequence.CompareTo(other.Sequence); // Break ties by sequence number.
            }
            if (compare == 0)
            {
                compare = Id.CompareTo(other.Id); // Final tie-break by Guid.
            }
            return(compare);
        }
Exemplo n.º 17
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));
        }
Exemplo n.º 18
0
        /// <summary>
        /// Compares two instances of this object.
        /// </summary>
        /// <param name="Timestamped">An object to compare with.</param>
        public Int32 CompareTo(Timestamped <T> Timestamped)
        {
            if ((Object)Timestamped == null)
            {
                throw new ArgumentNullException(nameof(Timestamped), "The given timestamped value must not be null!");
            }

            // Compare the timestamps
            var _Result = Timestamp.CompareTo(Timestamped.Timestamp);

            // If equal: Compare the values
            if (_Result == 0)
            {
                _Result = Value.ToString().CompareTo(Timestamped.Value.ToString());
            }

            return(_Result);
        }
Exemplo n.º 19
0
        public int CompareTo(object obj)
        {
            var ballot = (Ballot)obj;

            var res = Timestamp.CompareTo(ballot.Timestamp);

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

            res = MessageNumber.CompareTo(ballot.MessageNumber);
            if (res != 0)
            {
                return(res);
            }

            return(StructuralComparisons.StructuralComparer.Compare(Identity, ballot.Identity));
        }
        public int CompareTo(Update other)
        {
            if (Timestamp != other.Timestamp)
            {
                return(Timestamp.CompareTo(other.Timestamp));
            }

            if (State != null && other.State != null)
            {
                return(((EntryState)other.State).CompareTo((EntryState)State));
            }

            if (IsVisible != null && other.IsVisible != null)
            {
                return(Name != null && other.Name != null
                    ? other.UserId.CompareTo(UserId)
                    : ((bool)other.IsVisible).CompareTo((bool)IsVisible));
            }

            return(1);
        }
Exemplo n.º 21
0
        public void test_compare()
        {
            Decimal[] nums = { 42, 0, -100, 10.7m, -1.23m };
            Timestamp nada = null;

            for (int i = 0; i < nums.Length; i++)
            {
                Timestamp t1 = new Timestamp(nums[i]);

                Assert.IsFalse(t1 > nada);
                Assert.IsFalse(t1 >= nada);
                Assert.IsFalse(t1 == nada);
                Assert.IsTrue(t1 != nada);
                Assert.IsFalse(t1 <= nada);
                Assert.IsFalse(t1 < nada);

#pragma warning disable CS1718 // Comparison made to same variable
                Assert.IsFalse(t1 > t1);
                Assert.IsTrue(t1 >= t1);
                Assert.IsTrue(t1 == t1);
                Assert.IsFalse(t1 != t1);
                Assert.IsTrue(t1 <= t1);
                Assert.IsFalse(t1 < t1);
#pragma warning restore CS1718 // Comparison made to same variable

                for (int j = 0; j < nums.Length; j++)
                {
                    Timestamp t2 = new Timestamp(nums[j]);

                    Assert.AreEqual(t1 > t2, nums[i] > nums[j]);
                    Assert.AreEqual(t1 >= t2, nums[i] >= nums[j]);
                    Assert.AreEqual(t1 == t2, nums[i] == nums[j]);
                    Assert.AreEqual(t1 != t2, nums[i] != nums[j]);
                    Assert.AreEqual(t1 <= t2, nums[i] <= nums[j]);
                    Assert.AreEqual(t1 < t2, nums[i] < nums[j]);
                    Assert.AreEqual(t1.CompareTo(t2), nums[i].CompareTo(nums[j]));
                }
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// Compares two instances of ObjectId
        /// </summary>
        public int CompareTo(ObjectId other)
        {
            var r = Timestamp.CompareTo(other.Timestamp);

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

            r = Machine.CompareTo(other.Machine);
            if (r != 0)
            {
                return(r);
            }

            r = Pid.CompareTo(other.Pid);
            if (r != 0)
            {
                return(r < 0 ? -1 : 1);
            }

            return(Increment.CompareTo(other.Increment));
        }
Exemplo n.º 23
0
        public int CompareTo(UserSystemAssetTransferKey other)
        {
            if (other is null)
            {
                return(1);
            }
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            var r1 = Comparer <UInt160> .Default.Compare(UserScriptHash, other.UserScriptHash);

            if (r1 != 0)
            {
                return(r1);
            }
            var r2 = Comparer <UInt256> .Default.Compare(AssetId, other.AssetId);

            if (r2 != 0)
            {
                return(r2);
            }
            var r3 = Timestamp.CompareTo(other.Timestamp);

            if (r3 != 0)
            {
                return(r3);
            }
            var r4 = TxId.CompareTo(other.TxId);

            if (r4 != 0)
            {
                return(r4);
            }
            return(Index.CompareTo(other.Index));
        }
Exemplo n.º 24
0
 public int CompareTo(CounterSample other)
 {
     return(Timestamp.CompareTo(other.Timestamp));
 }
Exemplo n.º 25
0
 public int CompareTo(Frame other)
 {
     return(Timestamp.CompareTo(other?.Timestamp));
 }
Exemplo n.º 26
0
 /// <summary>
 /// Compare this to another Scheduled item
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public int CompareTo(IScheduleItem <T> other)
 {
     return(Timestamp.CompareTo(other.Timestamp));
 }
Exemplo n.º 27
0
        public int CompareTo(Tag other)
        {
            if (other == null)
            {
                return(1);
            }

            int result = 0;

            result = m_Checked.CompareTo(other.m_Checked);
            if (result != 0)
            {
                return(result);
            }

            result = m_Enabled.CompareTo(other.m_Enabled);
            if (result != 0)
            {
                return(result);
            }

            result = m_Visible.CompareTo(other.m_Visible);
            if (result != 0)
            {
                return(result);
            }

            result = m_ValueSelect1.CompareTo(other.m_ValueSelect1);
            if (result != 0)
            {
                return(result);
            }

            result = m_ValueSelect2.CompareTo(other.m_ValueSelect2);
            if (result != 0)
            {
                return(result);
            }

            result = ChannelId.CompareTo(other.ChannelId);
            if (result != 0)
            {
                return(result);
            }

            result = DataBlockId.CompareTo(other.DataBlockId);
            if (result != 0)
            {
                return(result);
            }

            result = DeviceId.CompareTo(other.DeviceId);
            if (result != 0)
            {
                return(result);
            }

            result = DataType.CompareTo(other.DataType);
            if (result != 0)
            {
                return(result);
            }

            result = Address.CompareTo(other.Address);
            if (result != 0)
            {
                return(result);
            }

            result = TagName.CompareTo(other.TagName);
            if (result != 0)
            {
                return(result);
            }

            result = TagId.CompareTo(other.TagId);
            if (result != 0)
            {
                return(result);
            }

            result = Timestamp.CompareTo(other.Timestamp);
            if (result != 0)
            {
                return(result);
            }

            result = Description.CompareTo(other.Description);
            if (result != 0)
            {
                return(result);
            }

            return(result);
        }
Exemplo n.º 28
0
 public int CompareTo(DurableEvent <T> other) => Timestamp.CompareTo(other.Timestamp);
Exemplo n.º 29
0
 public int CompareTo(UpdateEvent other)
 {
     return(Timestamp.CompareTo(other));
 }
Exemplo n.º 30
0
 /// <summary>
 /// Compares the current instance with another object of the same type.
 /// </summary>
 public int CompareTo(TrendPoint other)
 {
     return(Timestamp.CompareTo(other.Timestamp));
 }