Esempio n. 1
0
        public override int GetHashCode()
        {
            switch (Kind)
            {
            case JObjectKind.Array:
                return(ArrayValue.GetHashCode());

            case JObjectKind.Boolean:
                return(BooleanValue.GetHashCode());

            case JObjectKind.Null:
                return(0);

            case JObjectKind.Object:
                return(ObjectValue.GetHashCode());

            case JObjectKind.String:
                return(StringValue.GetHashCode());

            case JObjectKind.Number:
                if (IsFractional)
                {
                    return(DoubleValue.GetHashCode());
                }
                if (IsNegative)
                {
                    return(LongValue.GetHashCode());
                }
                return(ULongValue.GetHashCode());
            }
            return(0);
        }
Esempio n. 2
0
                public override int GetHashCode()
                {
                    int hash = 1;

                    if (kindCase_ == KindOneofCase.StringValue)
                    {
                        hash ^= StringValue.GetHashCode();
                    }
                    if (kindCase_ == KindOneofCase.FloatValue)
                    {
                        hash ^= FloatValue.GetHashCode();
                    }
                    if (kindCase_ == KindOneofCase.DoubleValue)
                    {
                        hash ^= DoubleValue.GetHashCode();
                    }
                    if (kindCase_ == KindOneofCase.IntValue)
                    {
                        hash ^= IntValue.GetHashCode();
                    }
                    if (kindCase_ == KindOneofCase.UintValue)
                    {
                        hash ^= UintValue.GetHashCode();
                    }
                    if (kindCase_ == KindOneofCase.SintValue)
                    {
                        hash ^= SintValue.GetHashCode();
                    }
                    if (kindCase_ == KindOneofCase.BoolValue)
                    {
                        hash ^= BoolValue.GetHashCode();
                    }
                    hash ^= (int)kindCase_;
                    return(hash);
                }
        public void ensureDoubleValueAndDoubleHaveDifferentHashCode()
        {
            double number = 12;

            DoubleValue doubleValue = DoubleValue.valueOf(21);

            Assert.NotEqual(number.GetHashCode(), doubleValue.GetHashCode());
        }
        public void ensureDoubleValueAndDoubleHaveSameHashCode()
        {
            double number = 21;

            DoubleValue doubleValue = DoubleValue.valueOf(21);

            Assert.Equal(number.GetHashCode(), doubleValue.GetHashCode());
        }
Esempio n. 5
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = IsInteger.GetHashCode();
         hashCode = (hashCode * 397) ^ DoubleValue.GetHashCode();
         hashCode = (hashCode * 397) ^ IntValue;
         return(hashCode);
     }
 }
Esempio n. 6
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ IsInteger.GetHashCode();
         hashCode = (hashCode * 397) ^ LongValue.GetHashCode();
         hashCode = (hashCode * 397) ^ DoubleValue.GetHashCode();
         return(hashCode);
     }
 }
Esempio n. 7
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Type.GetHashCode();
         result = (result * 397) ^ DoubleValue.GetHashCode();
         result = (result * 397) ^ TimespanValue.GetHashCode();
         result = (result * 397) ^ (StringValue != null ? StringValue.GetHashCode() : 0);
         return(result);
     }
 }
Esempio n. 8
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (valueTypeCase_ == ValueTypeOneofCase.NullValue)
            {
                hash ^= NullValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.BooleanValue)
            {
                hash ^= BooleanValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.IntegerValue)
            {
                hash ^= IntegerValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.DoubleValue)
            {
                hash ^= DoubleValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.TimestampValue)
            {
                hash ^= TimestampValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.StringValue)
            {
                hash ^= StringValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.BytesValue)
            {
                hash ^= BytesValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.ReferenceValue)
            {
                hash ^= ReferenceValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.GeoPointValue)
            {
                hash ^= GeoPointValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.ArrayValue)
            {
                hash ^= ArrayValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.MapValue)
            {
                hash ^= MapValue.GetHashCode();
            }
            hash ^= (int)valueTypeCase_;
            return(hash);
        }
Esempio n. 9
0
 public override int GetHashCode()
 {
     unchecked
     {
         var result = GuidValue.GetHashCode();
         result = (result * 397) ^ (StringValue != null ? StringValue.GetHashCode() : 0);
         result = (result * 397) ^ IntValue;
         result = (result * 397) ^ LongValue.GetHashCode();
         result = (result * 397) ^ BoolValue.GetHashCode();
         result = (result * 397) ^ ByteValue.GetHashCode();
         result = (result * 397) ^ DecimalValue.GetHashCode();
         result = (result * 397) ^ DoubleValue.GetHashCode();
         result = (result * 397) ^ DateTimeValue.GetHashCode();
         result = (result * 397) ^ MaybeMoney.GetHashCode();
         return(result);
     }
 }
Esempio n. 10
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (EventId != 0UL)
            {
                hash ^= EventId.GetHashCode();
            }
            if (EventType != 0)
            {
                hash ^= EventType.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.LongValue)
            {
                hash ^= LongValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.DoubleValue)
            {
                hash ^= DoubleValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.SkeletonValue)
            {
                hash ^= SkeletonValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.ObjectValue)
            {
                hash ^= ObjectValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.StringValue)
            {
                hash ^= StringValue.GetHashCode();
            }
            if (valueTypeCase_ == ValueTypeOneofCase.CustomValue)
            {
                hash ^= CustomValue.GetHashCode();
            }
            if (appTypeCase_ == AppTypeOneofCase.AppId)
            {
                hash ^= AppId.GetHashCode();
            }
            hash ^= (int)valueTypeCase_;
            hash ^= (int)appTypeCase_;
            return(hash);
        }
                public override int GetHashCode()
                {
                    int hash = 1;

                    if (Type != 0)
                    {
                        hash ^= Type.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.Int32Value)
                    {
                        hash ^= Int32Value.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.Int64Value)
                    {
                        hash ^= Int64Value.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.FloatValue)
                    {
                        hash ^= FloatValue.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.DoubleValue)
                    {
                        hash ^= DoubleValue.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.BooleanValue)
                    {
                        hash ^= BooleanValue.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.StringValue)
                    {
                        hash ^= StringValue.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.BytesValue)
                    {
                        hash ^= BytesValue.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.MetaValue)
                    {
                        hash ^= MetaValue.GetHashCode();
                    }
                    hash ^= (int)valueCase_;
                    return(hash);
                }
Esempio n. 12
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (TypeName.Length != 0)
            {
                hash ^= TypeName.GetHashCode();
            }
            if (oneofValueCase_ == OneofValueOneofCase.BoolValue)
            {
                hash ^= BoolValue.GetHashCode();
            }
            if (oneofValueCase_ == OneofValueOneofCase.IntValue)
            {
                hash ^= IntValue.GetHashCode();
            }
            if (oneofValueCase_ == OneofValueOneofCase.DoubleValue)
            {
                hash ^= DoubleValue.GetHashCode();
            }
            if (oneofValueCase_ == OneofValueOneofCase.StringValue)
            {
                hash ^= StringValue.GetHashCode();
            }
            if (ProtoDesc.Length != 0)
            {
                hash ^= ProtoDesc.GetHashCode();
            }
            hash ^= (int)oneofValueCase_;
            return(hash);
        }
Esempio n. 13
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = CharValue.GetHashCode();
         hashCode = (hashCode * 397) ^ ByteValue.GetHashCode();
         hashCode = (hashCode * 397) ^ SByteValue.GetHashCode();
         hashCode = (hashCode * 397) ^ ShortValue.GetHashCode();
         hashCode = (hashCode * 397) ^ UShortValue.GetHashCode();
         hashCode = (hashCode * 397) ^ IntValue;
         hashCode = (hashCode * 397) ^ (int)UIntValue;
         hashCode = (hashCode * 397) ^ LongValue.GetHashCode();
         hashCode = (hashCode * 397) ^ ULongValue.GetHashCode();
         hashCode = (hashCode * 397) ^ FloatValue.GetHashCode();
         hashCode = (hashCode * 397) ^ DoubleValue.GetHashCode();
         hashCode = (hashCode * 397) ^ DecimalValue.GetHashCode();
         hashCode = (hashCode * 397) ^ DateTimeValue.GetHashCode();
         hashCode = (hashCode * 397) ^ GuidValue.GetHashCode();
         hashCode = (hashCode * 397) ^ StringValue.GetHashCode();
         return(hashCode);
     }
 }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (valueCase_ == ValueOneofCase.LongValue)
            {
                hash ^= LongValue.GetHashCode();
            }
            if (valueCase_ == ValueOneofCase.DoubleValue)
            {
                hash ^= DoubleValue.GetHashCode();
            }
            if (valueCase_ == ValueOneofCase.StringValue)
            {
                hash ^= StringValue.GetHashCode();
            }
            hash ^= (int)valueCase_;
            return(hash);
        }