Пример #1
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (ValueFormat != null)
                {
                    hashCode = hashCode * 59 + ValueFormat.GetHashCode();
                }

                if (Font != null)
                {
                    hashCode = hashCode * 59 + Font.GetHashCode();
                }

                if (Prefix != null)
                {
                    hashCode = hashCode * 59 + Prefix.GetHashCode();
                }

                if (Suffix != null)
                {
                    hashCode = hashCode * 59 + Suffix.GetHashCode();
                }

                return(hashCode);
            }
        }
Пример #2
0
        public void EqualsAndHashCodeFailure()
        {
            var format = new ValueFormat(typeof(int), "000000", new Regex(@"WKN: ([\d]+)"));
            var other  = new ValueFormat(typeof(int), "000000");

            Assert.IsFalse(format.Equals(other));
            Assert.IsFalse(format.Equals((object)other));
            Assert.AreNotEqual(format.GetHashCode(), other.GetHashCode());
        }
Пример #3
0
        public void EqualsAndHashCode()
        {
            var format = new ValueFormat(typeof(int), "000000", new Regex(@"WKN: ([\d]+)"));
            var same   = new ValueFormat(typeof(int), "000000", new Regex(@"WKN: ([\d]+)"));

            Assert.IsTrue(format.Equals(same));
            Assert.IsTrue(format.Equals((object)same));
            Assert.AreEqual(format.GetHashCode(), same.GetHashCode());
        }
Пример #4
0
        public override int GetHashCode()
        {
            var hashCode = 1143507782;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

            hashCode = hashCode * -1521134295 + Position.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <EntityLength> .Default.GetHashCode(Length);

            hashCode = hashCode * -1521134295 + ValueFormat.GetHashCode();
            return(hashCode);
        }
Пример #5
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = PrePadding?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (ValueFormat?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Padding?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (SymbolFormat?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (PostPadding?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ErrorText?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Unit.GetHashCode();
         return(hashCode);
     }
 }
Пример #6
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (Reference != null)
                {
                    hashCode = hashCode * 59 + Reference.GetHashCode();
                }

                if (Position != null)
                {
                    hashCode = hashCode * 59 + Position.GetHashCode();
                }

                if (Relative != null)
                {
                    hashCode = hashCode * 59 + Relative.GetHashCode();
                }

                if (ValueFormat != null)
                {
                    hashCode = hashCode * 59 + ValueFormat.GetHashCode();
                }

                if (Increasing != null)
                {
                    hashCode = hashCode * 59 + Increasing.GetHashCode();
                }

                if (Decreasing != null)
                {
                    hashCode = hashCode * 59 + Decreasing.GetHashCode();
                }

                if (Font != null)
                {
                    hashCode = hashCode * 59 + Font.GetHashCode();
                }

                return(hashCode);
            }
        }
Пример #7
0
        /// <summary>
        /// Serves as a hash function for the objects of <see cref="DumpAttribute"/> and its derived types.
        /// </summary>
        /// <returns>A hash code for the current <see cref="DumpAttribute"/> instance.</returns>
        public override int GetHashCode()
        {
            var hashCode = Constants.HashInitializer;

            unchecked
            {
                hashCode = Constants.HashMultiplier * hashCode + Order.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + DumpNullValues.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + Skip.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + RecurseDump.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + (DefaultProperty?.GetHashCode() ?? 0);
                hashCode = Constants.HashMultiplier * hashCode + Mask.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + MaskValue.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + MaxLength.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + MaxDepth.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + LabelFormat.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + ValueFormat.GetHashCode();
            }

            return(hashCode);
        }
Пример #8
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Visible != null)
         {
             hashCode = hashCode * 59 + Visible.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (UId != null)
         {
             hashCode = hashCode * 59 + UId.GetHashCode();
         }
         if (Ids != null)
         {
             hashCode = hashCode * 59 + Ids.GetHashCode();
         }
         if (CustomData != null)
         {
             hashCode = hashCode * 59 + CustomData.GetHashCode();
         }
         if (Meta != null)
         {
             hashCode = hashCode * 59 + Meta.GetHashCode();
         }
         if (MetaArray != null)
         {
             hashCode = hashCode * 59 + MetaArray.GetHashCode();
         }
         if (SelectedPoints != null)
         {
             hashCode = hashCode * 59 + SelectedPoints.GetHashCode();
         }
         if (Stream != null)
         {
             hashCode = hashCode * 59 + Stream.GetHashCode();
         }
         if (UiRevision != null)
         {
             hashCode = hashCode * 59 + UiRevision.GetHashCode();
         }
         if (HoverInfo != null)
         {
             hashCode = hashCode * 59 + HoverInfo.GetHashCode();
         }
         if (HoverLabel != null)
         {
             hashCode = hashCode * 59 + HoverLabel.GetHashCode();
         }
         if (Domain != null)
         {
             hashCode = hashCode * 59 + Domain.GetHashCode();
         }
         if (Orientation != null)
         {
             hashCode = hashCode * 59 + Orientation.GetHashCode();
         }
         if (ValueFormat != null)
         {
             hashCode = hashCode * 59 + ValueFormat.GetHashCode();
         }
         if (ValueSuffix != null)
         {
             hashCode = hashCode * 59 + ValueSuffix.GetHashCode();
         }
         if (Arrangement != null)
         {
             hashCode = hashCode * 59 + Arrangement.GetHashCode();
         }
         if (TextFont != null)
         {
             hashCode = hashCode * 59 + TextFont.GetHashCode();
         }
         if (Node != null)
         {
             hashCode = hashCode * 59 + Node.GetHashCode();
         }
         if (Link != null)
         {
             hashCode = hashCode * 59 + Link.GetHashCode();
         }
         if (IdsSrc != null)
         {
             hashCode = hashCode * 59 + IdsSrc.GetHashCode();
         }
         if (CustomDataSrc != null)
         {
             hashCode = hashCode * 59 + CustomDataSrc.GetHashCode();
         }
         if (MetaSrc != null)
         {
             hashCode = hashCode * 59 + MetaSrc.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #9
0
        public void EqualsAndHashCodeFailure()
        {
            var format = new ValueFormat( typeof( int ), "000000", new Regex( @"WKN: ([\d]+)" ) );
            var other = new ValueFormat( typeof( int ), "000000" );

            Assert.IsFalse( format.Equals( other ) );
            Assert.IsFalse( format.Equals( (object)other ) );
            Assert.AreNotEqual( format.GetHashCode(), other.GetHashCode() );
        }
Пример #10
0
        public void EqualsAndHashCode()
        {
            var format = new ValueFormat( typeof( int ), "000000", new Regex( @"WKN: ([\d]+)" ) );
            var same = new ValueFormat( typeof( int ), "000000", new Regex( @"WKN: ([\d]+)" ) );

            Assert.IsTrue( format.Equals( same ) );
            Assert.IsTrue( format.Equals( (object)same ) );
            Assert.AreEqual( format.GetHashCode(), same.GetHashCode() );
        }