public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj is PeptideModificationCounts) { PeptideModificationCounts other = (PeptideModificationCounts)obj; if (other.ModificationTypes.Length != ModificationTypes.Length) { return(false); } for (int i = 0; i < ModificationTypes.Length; i++) { if (ModificationTypes[i] != other.ModificationTypes[i]) { return(false); } } for (int i = 0; i < ModificationTypes.Length; i++) { if (ModificationCounts[i] != other.ModificationCounts[i]) { return(false); } } return(true); } return(false); }
public PeptideModificationCounts Add(PeptideModificationCounts other) { ushort[] allTypes = ArrayUtils.UniqueValues(ArrayUtils.Concat(ModificationTypes, other.ModificationTypes)); ushort[] allCounts = new ushort[allTypes.Length]; for (int i = 0; i < ModificationTypes.Length; i++) { int ind = Array.BinarySearch(allTypes, ModificationTypes[i]); allCounts[ind] += ModificationCounts[i]; } for (int i = 0; i < other.ModificationTypes.Length; i++) { int ind = Array.BinarySearch(allTypes, other.ModificationTypes[i]); allCounts[ind] += other.ModificationCounts[i]; } return new PeptideModificationCounts(allTypes, allCounts); }
public PeptideModificationCounts Add(PeptideModificationCounts other) { ushort[] allTypes = ArrayUtils.UniqueValues(ArrayUtils.Concat(ModificationTypes, other.ModificationTypes)); ushort[] allCounts = new ushort[allTypes.Length]; for (int i = 0; i < ModificationTypes.Length; i++) { int ind = Array.BinarySearch(allTypes, ModificationTypes[i]); allCounts[ind] += ModificationCounts[i]; } for (int i = 0; i < other.ModificationTypes.Length; i++) { int ind = Array.BinarySearch(allTypes, other.ModificationTypes[i]); allCounts[ind] += other.ModificationCounts[i]; } return(new PeptideModificationCounts(allTypes, allCounts)); }