Example #1
0
        /// <summary>
        /// Generates a hash code.
        /// </summary>
        /// <returns>Hash code based on stored data.</returns>
        public override int GetHashCode()
        {
            var hashCode =
                PrecursorMz.GetHashCode() ^
                PrecursorChargeState.GetHashCode() ^
                Scan.GetHashCode() ^
                Id.GetHashCode() ^
                GroupId.GetHashCode() ^
                TotalIonCurrent.GetHashCode() ^
                RetentionTime.GetHashCode();

            return(hashCode);
        }
Example #2
0
        /// <summary>
        /// Compares two objects' values.
        /// </summary>
        /// <param name="obj">Other to compare with.</param>
        /// <returns>True if values are the same, false if not.</returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            var other = obj as MSSpectra;

            if (other == null)
            {
                return(false);
            }

            if (!GroupId.Equals(other.GroupId))
            {
                return(false);
            }
            if (!MsLevel.Equals(other.MsLevel))
            {
                return(false);
            }
            if (!PrecursorChargeState.Equals(other.PrecursorChargeState))
            {
                return(false);
            }
            if (!PrecursorMz.Equals(other.PrecursorMz))
            {
                return(false);
            }
            if (!Net.Equals(other.Net))
            {
                return(false);
            }
            if (!Scan.Equals(other.Scan))
            {
                return(false);
            }
            if (!TotalIonCurrent.Equals(other.TotalIonCurrent))
            {
                return(false);
            }
            if (!CollisionType.Equals(other.CollisionType))
            {
                return(false);
            }
            return(true);
        }