Esempio n. 1
0
    /// <summary>
    /// Result list can be returned to the list pool
    /// </summary>
    /// <param name="sortedProgressions"></param>
    /// <param name="rangeLowExclusive"></param>
    /// <param name="rangeHighInclusive"></param>
    List <ProgressionInfo> RequiringValueInRange(OpenSortedList <long, List <ProgressionInfo> > sortedProgressions, long rangeLowExclusive, long rangeHighInclusive)
    {
        List <ProgressionInfo> list = ListPool <ProgressionInfo> .Get();

        List <ProgressionInfo>[] progressionsList = sortedProgressions.values;
        if (progressionsList.Length == 0)
        {
            return(list);
        }
        int start = sortedProgressions.IndexOfKeyGreaterThanOrEqualTo(rangeLowExclusive);
        int end   = sortedProgressions.IndexOfKeyLessThanOrEqualTo(rangeHighInclusive);

        if (start == progressionsList.Length)
        {
            if (end == start - 1)
            {
                return(list);
            }
            else
            {
                --start;
            }
        }

        for (int i = start; i <= end; ++i)
        {
            list.AddList(progressionsList[i]);
        }

        return(list);
    }
Esempio n. 2
0
    /// <summary>
    /// Result list can be returned to the list pool
    /// </summary>
    /// <param name="sortedProgressions"></param>
    /// <param name="rangeLowExclusive"></param>
    /// <param name="rangeHighInclusive"></param>
    List <ProgressionInfo> RequiringValueGreaterThan(OpenSortedList <long, List <ProgressionInfo> > sortedProgressions, long valueInclusive)
    {
        List <ProgressionInfo> list = ListPool <ProgressionInfo> .Get();

        List <ProgressionInfo>[] progressionsList = sortedProgressions.values;
        if (progressionsList.Length == 0)
        {
            return(list);
        }
        int start = sortedProgressions.IndexOfKeyGreaterThanOrEqualTo(valueInclusive);

        for (int i = start, len = progressionsList.Length; i < len; ++i)
        {
            list.AddList(progressionsList[i]);
        }

        return(list);
    }