/// <summary> /// Changes the rank so that items are ranked by specEValue, ascending /// Also re-writes the ids /// </summary> public void ReRankBySpecEValue() { var siiIdBase = Id.ToUpper().Replace("SIR", "SII") + "_"; SpectrumIdentificationItems.Sort((a, b) => a.GetSpecEValue().CompareTo(b.GetSpecEValue())); for (var i = 0; i < SpectrumIdentificationItems.Count; i++) { var rank = i + 1; SpectrumIdentificationItems[i].Rank = rank; SpectrumIdentificationItems[i].Id = siiIdBase + rank; } Sort(); }
/// <summary> /// Sort the SpectrumIdentificationItems by rank, ascending /// </summary> public void Sort() { SpectrumIdentificationItems.Sort((a, b) => a.Rank.CompareTo(b.Rank)); }