private static BoostThreshold[] ListsToThresholds(List<List<uint>> lists) { var thresholds = new BoostThreshold[lists.Count]; for (int i = 0; i < lists.Count; i++) { thresholds[i] = new BoostThreshold(lists[i]); } return thresholds; }
/// <summary> /// Gives the next threshold or null if not found /// </summary> /// <param name="actualpoints"></param> /// <param name="thresholds"></param> /// <returns></returns> public BoostThreshold GetNextThreshold(int actualpoints, BoostThreshold[] thresholds) { var index = GetThresholdIndex(actualpoints, thresholds); return thresholds.Length > index + 1 ? thresholds[index + 1] : null; }
private static int GetThresholdIndex(int actualpoints, BoostThreshold[] thresholds) { for (int i = 0; i < thresholds.Length - 1; i++) { if (thresholds[i].PointsThreshold <= actualpoints && thresholds[i + 1].PointsThreshold > actualpoints) return i; } return thresholds.Length - 1; }
public BoostThreshold GetThreshold(int actualpoints, BoostThreshold[] thresholds) { return thresholds[GetThresholdIndex(actualpoints, thresholds)]; }