コード例 #1
0
    protected List <Quota_Allocation> run_length_encode_allocations(List <Quota_Allocation> allocations)
    {
        List <Quota_Allocation> rled_allocs = new List <Quota_Allocation>();
        /* RLE the allocations */

        Quota_Allocation to_add = null;

        foreach (Quota_Allocation item in allocations)
        {
            if (to_add == null)
            {
                to_add = new Quota_Allocation(item);
            }
            else
            {
                if (to_add.scan_idx == item.scan_idx)
                {
                    to_add.quota += item.quota;
                }
                else
                {
                    rled_allocs.Add(to_add);
                    to_add = new Quota_Allocation(item);
                }
            }
        }
        rled_allocs.Add(to_add);

        return(rled_allocs);
    }
コード例 #2
0
 public string FormatQuota(Quota_Allocation quota_a)
 {
     return
         (string.Format(
              "{0}@{1}", quota_a.quota, scans_arr[quota_a.scan_idx].id
              ));
 }
コード例 #3
0
 public string FormatQuota(Quota_Allocation quota_a)
 {
     return
         string.Format(
             "{0}@{1}", quota_a.quota, scans_arr[quota_a.scan_idx].id
         );
 }
コード例 #4
0
 public Quota_Allocation(Quota_Allocation other)
 {
     scan_idx = other.scan_idx;
     quota    = other.quota;
 }
コード例 #5
0
 public Quota_Allocation(Quota_Allocation other)
 {
     scan_idx = other.scan_idx;
     quota = other.quota;
 }
コード例 #6
0
    protected List<Quota_Allocation> run_length_encode_allocations(List<Quota_Allocation> allocations)
    {
        List<Quota_Allocation> rled_allocs = new List<Quota_Allocation>();
            /* RLE the allocations */

        Quota_Allocation to_add = null;
        foreach (Quota_Allocation item in allocations)
        {
            if (to_add == null)
            {
                to_add = new Quota_Allocation(item);
            }
            else
            {
                if (to_add.scan_idx == item.scan_idx)
                {
                    to_add.quota += item.quota;
                }
                else
                {
                    rled_allocs.Add(to_add);
                    to_add = new Quota_Allocation(item);
                }
            }
        }
        rled_allocs.Add(to_add);

        return rled_allocs;
    }