Example #1
0
 public override int GetHashCode()
 {
     if (hashcode == 0 && isReadOnly && length > 0)
     {
         int         hashIndex = 0;
         ComponentId cid       = components[0];
         hashcode = HashTable[hashIndex] * cid.GetHashCode();
         for (int i = 1; i < length; i++)
         {
             cid       = components[i];
             hashIndex = i % HashTableSize;
             hashcode  = hashcode ^ HashTable[hashIndex] * cid.GetHashCode();
         }
     }
     return(hashcode);
 }
Example #2
0
 public virtual int CompareTo(ComponentId that)
 {
     if (this.ValueType.Equals(that.ValueType) || this.ValueType.IsEquivalentTo(that.ValueType))
     {
         if (this.IdValue.Equals(that.IdValue))
         {
             return(0);
         }
         else
         {
             return(this.GetHashCode() - that.GetHashCode());
         }
     }
     else if (this.IdValue is IComparable)
     {
         return((this.IdValue as IComparable).CompareTo(that.IdValue));
     }
     else if (that.IdValue is IComparable)
     {
         return(-1 * (that.IdValue as IComparable).CompareTo(this.IdValue));
     }
     else
     {
         return(this.ValueType.GetHashCode() - that.ValueType.GetHashCode());
     }
 }
        public override int GetHashCode()
        {
            int hash = 17;

            hash = hash * 31 + EntityId.GetHashCode();
            hash = hash * 31 + ComponentId.GetHashCode();
            return(hash);
        }
        public void GetHashCodeTest()
        {
            ComponentId target   = new ComponentId(); // TODO: 初始化为适当的值
            int         expected = 0;                 // TODO: 初始化为适当的值
            int         actual;

            actual = target.GetHashCode();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }
Example #5
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + (BomLevel == default(short) ? 0 : BomLevel.GetHashCode());
         hash = hash * 23 + (ComponentId == default(int) ? 0 : ComponentId.GetHashCode());
         hash = hash * 23 + (EndDate == null ? 0 : EndDate.GetHashCode());
         hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
         hash = hash * 23 + (PerAssemblyQty == default(decimal) ? 0 : PerAssemblyQty.GetHashCode());
         hash = hash * 23 + (ProductAssemblyId == null ? 0 : ProductAssemblyId.GetHashCode());
         hash = hash * 23 + (StartDate == default(DateTime) ? 0 : StartDate.GetHashCode());
         hash = hash * 23 + (UnitMeasureCode == null ? 0 : UnitMeasureCode.GetHashCode());
         return(hash);
     }
 }
Example #6
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (EntityId != 0)
            {
                hash ^= EntityId.GetHashCode();
            }
            if (ComponentId != 0)
            {
                hash ^= ComponentId.GetHashCode();
            }
            if (Info.Length != 0)
            {
                hash ^= Info.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Example #7
0
 public override int GetHashCode() => ComponentId.GetHashCode();
 public override int GetHashCode()
 {
     return(ComponentId.GetHashCode());
 }
 public void GetHashCodeTest()
 {
     ComponentId target = new ComponentId(); // TODO: 初始化为适当的值
     int expected = 0; // TODO: 初始化为适当的值
     int actual;
     actual = target.GetHashCode();
     Assert.AreEqual( expected, actual );
     Assert.Inconclusive( "验证此测试方法的正确性。" );
 }