Пример #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (metric_ != null)
            {
                hash ^= Metric.GetHashCode();
            }
            if (resource_ != null)
            {
                hash ^= Resource.GetHashCode();
            }
            if (metadata_ != null)
            {
                hash ^= Metadata.GetHashCode();
            }
            if (MetricKind != global::Google.Api.MetricDescriptor.Types.MetricKind.Unspecified)
            {
                hash ^= MetricKind.GetHashCode();
            }
            if (ValueType != global::Google.Api.MetricDescriptor.Types.ValueType.Unspecified)
            {
                hash ^= ValueType.GetHashCode();
            }
            hash ^= points_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Description.Length != 0)
            {
                hash ^= Description.GetHashCode();
            }
            if (ValueType != global::Google.Cloud.AIPlatform.V1.Feature.Types.ValueType.Unspecified)
            {
                hash ^= ValueType.GetHashCode();
            }
            if (createTime_ != null)
            {
                hash ^= CreateTime.GetHashCode();
            }
            if (updateTime_ != null)
            {
                hash ^= UpdateTime.GetHashCode();
            }
            hash ^= Labels.GetHashCode();
            if (Etag.Length != 0)
            {
                hash ^= Etag.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hash = 17;
         hash = hash * 23 + Type.GetHashCode();
         if (null != Value)
         {
             hash = hash * 23 + Value.GetHashCode();
         }
         if (null != ValueType)
         {
             hash = hash * 23 + ValueType.GetHashCode();
         }
         if (null != Issuer)
         {
             hash = hash * 23 + Issuer.GetHashCode();
         }
         if (null != OriginalIssuer)
         {
             hash = hash * 23 + OriginalIssuer.GetHashCode();
         }
         return(hash);
     }
 }
Пример #4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (metric_ != null)
            {
                hash ^= Metric.GetHashCode();
            }
            if (resource_ != null)
            {
                hash ^= Resource.GetHashCode();
            }
            if (metadata_ != null)
            {
                hash ^= Metadata.GetHashCode();
            }
            if (MetricKind != 0)
            {
                hash ^= MetricKind.GetHashCode();
            }
            if (ValueType != 0)
            {
                hash ^= ValueType.GetHashCode();
            }
            hash ^= points_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Type.Length != 0)
            {
                hash ^= Type.GetHashCode();
            }
            hash ^= labels_.GetHashCode();
            if (MetricKind != 0)
            {
                hash ^= MetricKind.GetHashCode();
            }
            if (ValueType != 0)
            {
                hash ^= ValueType.GetHashCode();
            }
            if (Unit.Length != 0)
            {
                hash ^= Unit.GetHashCode();
            }
            if (Description.Length != 0)
            {
                hash ^= Description.GetHashCode();
            }
            if (DisplayName.Length != 0)
            {
                hash ^= DisplayName.GetHashCode();
            }
            return(hash);
        }
Пример #6
0
    public override int GetHashCode()
    {
        int hashCode = -2110463197;

        hashCode = hashCode * -1521134295 + dominant.GetHashCode();
        hashCode = hashCode * -1521134295 + value.GetHashCode();
        return(hashCode);
    }
Пример #7
0
    public override int GetHashCode()
    {
        int hashCode = 1574892647;

        hashCode = hashCode * -1521134295 + Value.GetHashCode();
        hashCode = hashCode * -1521134295 + Type.GetHashCode();
        return(hashCode);
    }
Пример #8
0
        public void Self_equality_is_sane()
        {
            var x = new ValueType("asdf", 42, true, new CustomRefType("qwer"), new ValueType2("xyz"));

#pragma warning disable 1718
            // ReSharper disable EqualExpressionComparison
            Assert.True(x.Equals(x));
            Assert.True(x == x);
            Assert.False(x != x);
            Assert.False(x.Equals(null));
            Assert.False(Equals(null, x));

            // ReSharper disable once HeuristicUnreachableCode
            Assert.Equal(x.GetHashCode(), x.GetHashCode());
            // ReSharper restore EqualExpressionComparison
#pragma warning restore 1718
        }
        public override int GetHashCode()
        {
            const int constant = 197;

            return(AttributeName.GetHashCode() * constant
                   + ValueType.GetHashCode()
                   + SerializedEnumValues.GetHashCode()
                   + EnumValues.GetHashCode());
        }
Пример #10
0
 /// <summary>Serves as the default hash function.</summary>
 /// <returns>A hash code for the current object.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (KeyType != null ? KeyType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ValueType != null ? ValueType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsKeyEnum.GetHashCode();
         return(hashCode);
     }
 }
Пример #11
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ ValueType.GetHashCode();
         hashCode = (hashCode * 397) ^ Dimension.GetHashCode();
         return(hashCode);
     }
 }
Пример #12
0
        /// <summary>
        /// Returns the hash code for this instance.
        /// </summary>
        /// <returns>A 32-bit signed integer hash code.</returns>
        public override int GetHashCode()
        {
            var hashCode = ValueType.GetHashCode();

            if (KeyType != null)
            {
                hashCode &= KeyType.GetHashCode();
            }
            return(hashCode);
        }
            int ComputeHashCode()
            {
                int hashCode = Name.GetHashCode();

                hashCode ^= FriendlyName.GetHashCode();
                hashCode ^= NameFormat.GetHashCode();
                hashCode ^= ValueType.GetHashCode();
                hashCode ^= OriginalIssuer.GetHashCode();
                return(hashCode);
            }
Пример #14
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = ValueType.GetHashCode();
         hashCode = (hashCode * 397) ^ ComponentsPerSet;
         hashCode = (hashCode * 397) ^ NumberOfSets;
         hashCode = (hashCode * 397) ^ BaseType.GetHashCode();
         return(hashCode);
     }
 }
Пример #15
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ IndexType.GetHashCode();
         hashCode = (hashCode * 397) ^ ValueType.GetHashCode();
         hashCode = (hashCode * 397) ^ ReadOnly.GetHashCode();
         return(hashCode);
     }
 }
Пример #16
0
        static void Main(string[] args)
        {
            MyStruct instance;

            instance.Method();

            ValueType valueType = instance as ValueType;

            Console.WriteLine("inst = {0}", instance.GetHashCode());
            Console.WriteLine("valT = {0}", valueType.GetHashCode());
        }
Пример #17
0
 /// <summary>
 /// Returns the object hash code
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 21;
         hash = hash * 17 + ValueType.GetHashCode();
         hash = hash * 17 + Value.GetHashCode();
         hash = hash * 17 + Table.GetHashCode();
         return(hash);
     }
 }
Пример #18
0
        /// <summary>
        /// Returns the hash code for this <see cref="Literal"/> instance.
        /// </summary>
        /// <returns>A 32-bit signed integer that is the hash code for this instance.</returns>
        public override int GetHashCode()
        {
            switch (Type)
            {
            case ValueType.Int32:
                return(Type.GetHashCode() ^ I32.GetHashCode());

            case ValueType.Int64:
                return(Type.GetHashCode() ^ I64.GetHashCode());

            case ValueType.Float32:
                return(Type.GetHashCode() ^ F32.GetHashCode());

            case ValueType.Float64:
                return(Type.GetHashCode() ^ F64.GetHashCode());

            default:
                throw new InvalidOperationException($"Unexpected literal type {Type}.");
            }
        }
Пример #19
0
        public void Null_values_do_not_throw_exceptions_in_equals_and_getHashCode()
        {
            var x = new ValueType("asdf", 42, true, null, new ValueType2("xyz"));
            var y = new ValueType("asdf", 42, true, null, new ValueType2("xyz"));

            Assert.True(x.Equals(y));
            Assert.True(y.Equals(x));
            Assert.True(x == y);
            Assert.False(x != y);

            Assert.Equal(x.GetHashCode(), y.GetHashCode());
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Amount.GetHashCode();
         hashCode = (hashCode * 397) ^ Value.GetHashCode();
         hashCode = (hashCode * 397) ^ (ValueType != null ? ValueType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Applicable.GetHashCode();
         hashCode = (hashCode * 397) ^ (NonApplicableReason != null ? NonApplicableReason.GetHashCode() : 0);
         return(hashCode);
     }
 }
Пример #21
0
        public void Value_objects_with_equal_members_are_equal()
        {
            var x = new ValueType("asdf", 42);
            var y = new ValueType("asdf", 42);

            Assert.True(x.Equals(y));
            Assert.True(y.Equals(x));
            Assert.True(x == y);
            Assert.False(x != y);

            Assert.Equal(x.GetHashCode(), y.GetHashCode());
        }
Пример #22
0
        static void Main()
        {
            MyStruct instance = new MyStruct();

            ValueType valueType = instance as ValueType;

            Console.WriteLine("instance  = {0}", instance.GetHashCode());
            Console.WriteLine("valueType = {0}", valueType.GetHashCode());

            // Delay.
            Console.ReadKey();
        }
Пример #23
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ValueType != null ? ValueType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)FieldType;
         hashCode = (hashCode * 397) ^ (int)SortOrder;
         hashCode = (hashCode * 397) ^ (SortBy != null ? SortBy.GetHashCode() : 0);
         return(hashCode);
     }
 }
Пример #24
0
        public void Value_objects_with_one_differing_member_are_unequal()
        {
            var x = new ValueType("asdf", 100);
            var y = new ValueType("asdf", 42);

            Assert.False(x.Equals(y));
            Assert.False(y.Equals(x));
            Assert.False(x == y);
            Assert.True(x != y);

            Assert.NotEqual(x.GetHashCode(), y.GetHashCode());
        }
Пример #25
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = KeyType?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (ValueType?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ HashKey.GetHashCode();
         hashCode = (hashCode * 397) ^ KeyTypeState.GetHashCode();
         hashCode = (hashCode * 397) ^ ValueTypeState.GetHashCode();
         return(hashCode);
     }
 }
Пример #26
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = OwnerId.GetHashCode();
         hashCode = (hashCode * 397) ^ (OwnerResource != null ? OwnerResource.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Value != null ? Value.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ValueType != null ? ValueType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         return(hashCode);
     }
 }
Пример #27
0
        public void Value_objects_with_equal_members_are_equal()
        {
            var customRefType = new CustomRefType("qwer");
            var x             = new ValueType("asdf", 42, true, customRefType, new ValueType2("xyz"));
            var y             = new ValueType("asdf", 42, false, customRefType, new ValueType2("xyz"));

            Assert.True(x.Equals(y));
            Assert.True(y.Equals(x));
            Assert.True(x == y);
            Assert.False(x != y);

            Assert.Equal(x.GetHashCode(), y.GetHashCode());
        }
Пример #28
0
        public void Contained_reference_types_are_compared_by_reference()
        {
            // The second CustomRefType is different from the first
            var x = new ValueType("asdf", 42, true, new CustomRefType("qwer"), new ValueType2("xyz"));
            var y = new ValueType("asdf", 42, true, new CustomRefType("qwer"), new ValueType2("xyz"));

            Assert.False(x.Equals(y));
            Assert.False(y.Equals(x));
            Assert.False(x == y);
            Assert.True(x != y);

            Assert.NotEqual(x.GetHashCode(), y.GetHashCode());
        }
Пример #29
0
        static void Main(string[] args)
        {
            MyStruct  instance  = new MyStruct();
            ValueType valueType = instance as ValueType;

            Console.WriteLine($"instance = {instance.GetHashCode()}");
            Console.WriteLine($"valueType = {valueType.GetHashCode()}");
            //хэш коды одинаковы, это говорит о том, что произошло ПРАВИЛЬНОЕ ПРИВЕДЕНИЕ!
            //если что, то в файле с именем 013_RealPolymorphism есть пример с разными hash кодами.

            //Delay
            Console.ReadKey();
        }
Пример #30
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (DisplayName.Length != 0)
            {
                hash ^= DisplayName.GetHashCode();
            }
            if (Description.Length != 0)
            {
                hash ^= Description.GetHashCode();
            }
            if (ValueType != global::Google.Cloud.AIPlatform.V1.TensorboardTimeSeries.Types.ValueType.Unspecified)
            {
                hash ^= ValueType.GetHashCode();
            }
            if (createTime_ != null)
            {
                hash ^= CreateTime.GetHashCode();
            }
            if (updateTime_ != null)
            {
                hash ^= UpdateTime.GetHashCode();
            }
            if (Etag.Length != 0)
            {
                hash ^= Etag.GetHashCode();
            }
            if (PluginName.Length != 0)
            {
                hash ^= PluginName.GetHashCode();
            }
            if (PluginData.Length != 0)
            {
                hash ^= PluginData.GetHashCode();
            }
            if (metadata_ != null)
            {
                hash ^= Metadata.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }