public override int GetHashCode()
 {
     unchecked
     {
         return(((ContainerId != null ? ContainerId.GetHashCode() : 0) * 397) ^ Port);
     }
 }
 public override int GetHashCode()
 {
     unchecked
     {
         return((ContainerId.GetHashCode() * 397) ^ Offset);
     }
 }
Ejemplo n.º 3
0
        public virtual void TestContainerId()
        {
            ContainerId c1 = NewContainerId(1, 1, 10l, 1);
            ContainerId c2 = NewContainerId(1, 1, 10l, 2);
            ContainerId c3 = NewContainerId(1, 1, 10l, 1);
            ContainerId c4 = NewContainerId(1, 3, 10l, 1);
            ContainerId c5 = NewContainerId(1, 3, 8l, 1);

            NUnit.Framework.Assert.IsTrue(c1.Equals(c3));
            NUnit.Framework.Assert.IsFalse(c1.Equals(c2));
            NUnit.Framework.Assert.IsFalse(c1.Equals(c4));
            NUnit.Framework.Assert.IsFalse(c1.Equals(c5));
            NUnit.Framework.Assert.IsTrue(c1.CompareTo(c3) == 0);
            NUnit.Framework.Assert.IsTrue(c1.CompareTo(c2) < 0);
            NUnit.Framework.Assert.IsTrue(c1.CompareTo(c4) < 0);
            NUnit.Framework.Assert.IsTrue(c1.CompareTo(c5) > 0);
            NUnit.Framework.Assert.IsTrue(c1.GetHashCode() == c3.GetHashCode());
            NUnit.Framework.Assert.IsFalse(c1.GetHashCode() == c2.GetHashCode());
            NUnit.Framework.Assert.IsFalse(c1.GetHashCode() == c4.GetHashCode());
            NUnit.Framework.Assert.IsFalse(c1.GetHashCode() == c5.GetHashCode());
            long        ts = Runtime.CurrentTimeMillis();
            ContainerId c6 = NewContainerId(36473, 4365472, ts, 25645811);

            NUnit.Framework.Assert.AreEqual("container_10_0001_01_000001", c1.ToString());
            NUnit.Framework.Assert.AreEqual(25645811, unchecked ((long)(0xffffffffffL)) & c6.GetContainerId
                                                ());
            NUnit.Framework.Assert.AreEqual(0, c6.GetContainerId() >> 40);
            NUnit.Framework.Assert.AreEqual("container_" + ts + "_36473_4365472_25645811", c6
                                            .ToString());
            ContainerId c7 = NewContainerId(36473, 4365472, ts, 4298334883325L);

            NUnit.Framework.Assert.AreEqual(999799999997L, unchecked ((long)(0xffffffffffL)) &
                                            c7.GetContainerId());
            NUnit.Framework.Assert.AreEqual(3, c7.GetContainerId() >> 40);
            NUnit.Framework.Assert.AreEqual("container_e03_" + ts + "_36473_4365472_999799999997"
                                            , c7.ToString());
            ContainerId c8 = NewContainerId(36473, 4365472, ts, 844424930131965L);

            NUnit.Framework.Assert.AreEqual(1099511627773L, unchecked ((long)(0xffffffffffL))
                                            & c8.GetContainerId());
            NUnit.Framework.Assert.AreEqual(767, c8.GetContainerId() >> 40);
            NUnit.Framework.Assert.AreEqual("container_e767_" + ts + "_36473_4365472_1099511627773"
                                            , c8.ToString());
        }
Ejemplo n.º 4
0
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (LicensePlate?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (ContainerId?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (ShipId?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (TrainId?.GetHashCode() ?? 0);
            return(hashCode);
        }
Ejemplo n.º 5
0
        public override int GetHashCode()
        {
            int prime  = 31;
            int result = 1;

            result = prime * result + ((containerID == null) ? 0 : containerID.GetHashCode());
            result = prime * result + ((containerMgrAddress == null) ? 0 : containerMgrAddress
                                       .GetHashCode());
            result = prime * result + ((containerToken == null) ? 0 : containerToken.GetHashCode
                                           ());
            result = prime * result + ((taskAttemptID == null) ? 0 : taskAttemptID.GetHashCode
                                           ());
            return(result);
        }
Ejemplo n.º 6
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (containerId_ != null)
            {
                hash ^= ContainerId.GetHashCode();
            }
            if (objectId_ != null)
            {
                hash ^= ObjectId.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }