Example #1
0
 public static UlResAssignOutput FreqUserExpandRB(IUlScheduleUser user, IUlSchuduleCarrier carrier, ScheduleResource res, byte beginRbIndex, int userMaxRbNum, int tti)
 {
     List<byte> rbs = new List<byte>();
     List<byte> centerRbs = new List<byte>();
     List<byte> edgeRbs = new List<byte>();
     res.RbLists[0].ForEach(delegate (RBData rb) {
         centerRbs.Add(rb.Index);
     });
     res.RbLists[1].ForEach(delegate (RBData rb) {
         edgeRbs.Add(rb.Index);
     });
     rbs.AddRange(centerRbs);
     rbs.AddRange(edgeRbs);
     rbs.Sort();
     List<byte> list2 = new List<byte>();
     list2.Add(beginRbIndex);
     res.RemoveRbRes(beginRbIndex);
     int idxLeft = rbs.FindIndex(delegate (byte rbIndex) {
         return rbIndex == beginRbIndex;
     });
     int idxRight = idxLeft;
     bool flag = list2.Count < userMaxRbNum;
     bool canLeftExpand = true;
     bool canRightExpand = true;
     while (flag)
     {
         float maxValue = float.MaxValue;
         float inRight = float.MaxValue;
         canLeftExpand = (canLeftExpand && (idxLeft >= 1)) && (Math.Abs((int) (rbs[idxLeft - 1] - rbs[idxLeft])) == 1);
         if (canLeftExpand)
         {
             maxValue = carrier.UlRbInterferenceNoiseList[rbs[idxLeft - 1]];
         }
         canRightExpand = (canRightExpand && (idxRight <= (rbs.Count - 2))) && (Math.Abs((int) (rbs[idxRight + 1] - rbs[idxRight])) == 1);
         if (canRightExpand)
         {
             inRight = carrier.UlRbInterferenceNoiseList[rbs[idxRight + 1]];
         }
         byte num5 = GetExpandRbIndex(canLeftExpand, canRightExpand, ref idxLeft, ref idxRight, maxValue, inRight, rbs);
         if (num5 == 0xff)
         {
             break;
         }
         res.RemoveRbRes(num5);
         list2.Add(num5);
         flag = list2.Count < userMaxRbNum;
     }
     UlResAssignOutput output = new UlResAssignOutput();
     output.RbIndexs = list2;
     return output;
 }
Example #2
0
 public static List<byte> AssignRBLocation(IUlScheduleUser user, ScheduleResource res, byte beginIndex, int userMaxRbNumM)
 {
     int num2;
     int num3;
     List<RBData> list = new List<RBData>(res.RbLists[1]);
     list.Reverse();
     list.InsertRange(0, res.RbLists[0]);
     List<byte> list2 = new List<byte>();
     int num = 1;
     list2.Add(beginIndex);
     if (list[0].Index == beginIndex)
     {
         num2 = 0;
         num3 = 1;
     }
     else
     {
         num2 = list.Count - 1;
         num3 = -1;
     }
     res.RemoveRbRes(beginIndex);
     for (num = 2; num <= userMaxRbNumM; num++)
     {
         if ((((num2 + num3) >= 0) && ((num2 + num3) < list.Count)) && (((list[num2].Index + 1) == list[num2 + num3].Index) || ((list[num2].Index - 1) == list[num2 + num3].Index)))
         {
             num2 += num3;
             byte index = list[num2].Index;
             list2.Add(index);
             res.RemoveRbRes(index);
         }
         else
         {
             return list2;
         }
     }
     return list2;
 }