Exemplo n.º 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (int)LipidClass;
         hashCode = (hashCode * 397) ^ (int)FragmentationMode;
         hashCode = (hashCode * 397) ^ (Composition != null ? Composition.GetHashCode() : 0);
         if (AcylChainList != null)
         {
             hashCode = AcylChainList.OrderBy(x => x.NumCarbons).ThenBy(x => x.NumDoubleBonds).ThenBy(x => x.AcylChainType).Aggregate(hashCode, (current, acylChain) => (current * 397) ^ acylChain.GetHashCode());
         }
         return(hashCode);
     }
 }
Exemplo n.º 2
0
        protected bool Equals(LipidTarget other)
        {
            if (LipidClass != LipidClass.Unknown && other.LipidClass != LipidClass.Unknown)
            {
                return(LipidClass == other.LipidClass && FragmentationMode == other.FragmentationMode &&
                       Equals(Composition, other.Composition) &&
                       AcylChainList.OrderBy(x => x.NumCarbons)
                       .ThenBy(x => x.NumDoubleBonds)
                       .ThenBy(x => x.AcylChainType)
                       .SequenceEqual(
                           other.AcylChainList.OrderBy(x => x.NumCarbons)
                           .ThenBy(x => x.NumDoubleBonds)
                           .ThenBy(x => x.AcylChainType)));
            }

            return(LipidClass == other.LipidClass && FragmentationMode == other.FragmentationMode &&
                   CommonName.Equals(other.CommonName));
        }