Esempio n. 1
0
        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;
        }
Esempio n. 2
0
 /// <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;
 }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
 public BoostThreshold GetThreshold(int actualpoints, BoostThreshold[] thresholds)
 {
     return thresholds[GetThresholdIndex(actualpoints, thresholds)];
 }