Example #1
0
        /// <summary>
        ///     Object equality
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool Equals(SpectrumIdentificationItemObj other)
        {
            if (ReferenceEquals(this, other))
            {
                return(true);
            }
            if (other == null)
            {
                return(false);
            }

            if ((Name == other.Name) && (ChargeState == other.ChargeState) &&
                ExperimentalMassToCharge.Equals(other.ExperimentalMassToCharge) &&
                CalculatedMassToCharge.Equals(other.CalculatedMassToCharge) &&
                CalculatedPI.Equals(other.CalculatedPI) && (Rank == other.Rank) &&
                (PassThreshold == other.PassThreshold) && Equals(Peptide, other.Peptide) &&
                Equals(MassTable, other.MassTable) && Equals(Sample, other.Sample) &&
                Equals(PeptideEvidences, other.PeptideEvidences) &&
                Equals(Fragmentations, other.Fragmentations) && Equals(CVParams, other.CVParams) &&
                Equals(UserParams, other.UserParams))
            {
                return(true);
            }
            return(false);
        }
Example #2
0
        /// <summary>
        ///     Object hash code
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Name != null?Name.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ ChargeState;
                hashCode = (hashCode * 397) ^ ExperimentalMassToCharge.GetHashCode();
                hashCode = (hashCode * 397) ^ CalculatedMassToCharge.GetHashCode();
                hashCode = (hashCode * 397) ^ CalculatedPI.GetHashCode();
                hashCode = (hashCode * 397) ^ Rank;
                hashCode = (hashCode * 397) ^ PassThreshold.GetHashCode();
                hashCode = (hashCode * 397) ^ (Peptide != null ? Peptide.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (MassTable != null ? MassTable.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Sample != null ? Sample.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (PeptideEvidences != null ? PeptideEvidences.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Fragmentations != null ? Fragmentations.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (CVParams != null ? CVParams.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (UserParams != null ? UserParams.GetHashCode() : 0);
                return(hashCode);
            }
        }