Exemplo n.º 1
0
        private bool Equals(CustomIon other)
        {
            var equal = string.Equals(Formula, other.Formula) &&
                        string.Equals(Name, other.Name) &&
                        MonoisotopicMass.Equals(other.MonoisotopicMass) &&
                        AverageMass.Equals(other.AverageMass);

            return(equal); // For debugging convenience
        }
Exemplo n.º 2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = ExplicitMod.GetHashCode();
         hashCode = (hashCode * 397) ^ MonoisotopicMass.GetHashCode();
         hashCode = (hashCode * 397) ^ AverageMass.GetHashCode();
         return(hashCode);
     }
 }
Exemplo n.º 3
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = (Formula != null ? Formula.GetHashCode() : 0);
         result = (result * 397) ^ MonoisotopicMass.GetHashCode();
         result = (result * 397) ^ AverageMass.GetHashCode();
         result = (result * 397) ^ Inclusion.GetHashCode();
         return(result);
     }
 }
Exemplo n.º 4
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (Formula != null ? Formula.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ MonoisotopicMass.GetHashCode();
         hashCode = (hashCode * 397) ^ AverageMass.GetHashCode();
         return(hashCode);
     }
 }
Exemplo n.º 5
0
 public bool Equals(ChemicalFormula other)
 {
     if (other == null)
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     if (!MonoisotopicMass.MassEquals(other.MonoisotopicMass))
     {
         return(false);
     }
     if (!AverageMass.MassEquals(other.AverageMass))
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 6
0
 public void WriteXml(XmlWriter writer, Adduct adduct)
 {
     if (adduct.IsEmpty)
     {
         writer.WriteAttributeIfString(ATTR.neutral_formula, Formula);
     }
     else
     {
         writer.WriteAttributeIfString(ATTR.ion_formula,
                                       (Formula ?? string.Empty) +
                                       (adduct.IsProteomic ? string.Empty : adduct.ToString()));
     }
     Assume.IsFalse(AverageMass.IsMassH()); // We're going to read these as neutral masses
     Assume.IsFalse(MonoisotopicMass.IsMassH());
     writer.WriteAttributeNullable(ATTR.neutral_mass_average, AverageMass);
     writer.WriteAttributeNullable(ATTR.neutral_mass_monoisotopic, MonoisotopicMass);
     if (!string.IsNullOrEmpty(Name))
     {
         writer.WriteAttribute(ATTR.custom_ion_name, Name);
     }
     writer.WriteAttributeIfString(ATTR.id, AccessionNumbers.ToSerializableString());
 }
Exemplo n.º 7
0
 protected bool Equals(Modification other)
 {
     return(ExplicitMod.Equals(other.ExplicitMod) && MonoisotopicMass.Equals(other.MonoisotopicMass) &&
            AverageMass.Equals(other.AverageMass));
 }