Пример #1
0
        /// <inheritdoc />
        public override int GetHashCode(HclEvent obj)
        {
            if (obj is MappingKey mk)
            {
                return(mk.Path.GetHashCode());
            }

            return(obj.GetHashCode());
        }
Пример #2
0
        /// <inheritdoc />
        public override bool Equals(HclEvent other)
        {
            if (base.Equals(other) && other is Scalar scalar)
            {
                return(this.Value == scalar.Value);
            }

            return(false);
        }
Пример #3
0
        /// <inheritdoc />
        public override int GetHashCode(HclEvent obj)
        {
            if (obj is Scalar scalar && scalar.Value != null)
            {
                return(scalar.Value.GetHashCode());
            }

            // Null valued scalars are equivalent by virtue of being the same type.
            return(obj.Type.GetHashCode());
        }
Пример #4
0
        /// <inheritdoc />
        public override bool Equals(HclEvent other)
        {
            if (other is null)
            {
                return(false);
            }

            if (object.ReferenceEquals(this, other))
            {
                return(true);
            }

            if (other is MappingKey mk)
            {
                return(this.Path == mk.Path);
            }

            return(false);
        }