Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/02/17 22:03:01 (7 years ago)
Author:
pkimmesw
Message:

#2665 Removed "this" qualifier

Location:
branches/PushGP/HeuristicLab.PushGP/FeatureTests/DirtyList
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/FeatureTests/DirtyList/PushList.cs

    r14777 r14908  
    1313      if (!IsEnabled) return;
    1414
    15       this.items[items.Count - 1].Add(item);
     15      items[items.Count - 1].Add(item);
    1616    }
    1717
     
    3636
    3737    public void Clear() {
    38       this.items.Clear();
     38      items.Clear();
    3939    }
    4040  }
  • branches/PushGP/HeuristicLab.PushGP/FeatureTests/DirtyList/PushStack.cs

    r14777 r14908  
    2222
    2323    public PushStack(int capacity = 0) {
    24       this.data = new List<T>(capacity);
    25       this.IsEnabled = true;
     24      data = new List<T>(capacity);
     25      IsEnabled = true;
    2626    }
    2727
     
    3232      get
    3333      {
    34         return this.data.Capacity;
     34        return data.Capacity;
    3535      }
    3636    }
     
    4040      get
    4141      {
    42         return this.data[this.Count - 1];
     42        return data[Count - 1];
    4343      }
    4444    }
     
    4848      get
    4949      {
    50         return this.Count > 0 ? this.data[this.Count - 1] : default(T);
     50        return Count > 0 ? data[Count - 1] : default(T);
    5151      }
    5252    }
     
    5656      get
    5757      {
    58         return this.data[0];
     58        return data[0];
    5959      }
    6060    }
     
    6464      get
    6565      {
    66         return this.Count > 0 ? this.data[0] : default(T);
     66        return Count > 0 ? data[0] : default(T);
    6767      }
    6868    }
     
    7272      get
    7373      {
    74         return this.data.Count;
     74        return data.Count;
    7575      }
    7676    }
     
    8080      get
    8181      {
    82         return this.Count == 0;
     82        return Count == 0;
    8383      }
    8484    }
     
    9393
    9494    public void Add(T item) {
    95       this.Push(item);
     95      Push(item);
    9696    }
    9797
    9898    public void Clear() {
    99       this.data.Clear();
     99      data.Clear();
    100100    }
    101101
    102102    public bool Contains(T item) {
    103       return this.data.Contains(item);
     103      return data.Contains(item);
    104104    }
    105105
    106106    public void CopyTo(T[] array, int arrayIndex) {
    107       this.data.CopyTo(array, arrayIndex);
     107      data.CopyTo(array, arrayIndex);
    108108    }
    109109
    110110    public IEnumerator<T> GetEnumerator() {
    111       return this.data.GetEnumerator();
     111      return data.GetEnumerator();
    112112    }
    113113
    114114    public T ElementAt(int index) {
    115       return this.data[index];
     115      return data[index];
    116116    }
    117117
    118118    public T ReverseElementAt(int offset) {
    119       return this.data[this.data.Count - 1 - offset];
     119      return data[data.Count - 1 - offset];
    120120    }
    121121
    122122    public void SetTop(T value) {
    123       this.data[this.Count - 1] = value;
     123      data[Count - 1] = value;
    124124    }
    125125
     
    128128      get
    129129      {
    130         return this.data[key];
     130        return data[key];
    131131      }
    132132      set
    133133      {
    134         this.data[key] = value;
     134        data[key] = value;
    135135      }
    136136    }
    137137
    138138    public void Swap(int count) {
    139       var top = this.Top;
    140       var bottomIndex = this.Count - count;
    141 
    142       for (var i = this.Count - 1; i > bottomIndex; i--) this.data[i] = this.data[i - 1];
    143 
    144       this.data[bottomIndex] = top;
     139      var top = Top;
     140      var bottomIndex = Count - count;
     141
     142      for (var i = Count - 1; i > bottomIndex; i--) data[i] = data[i - 1];
     143
     144      data[bottomIndex] = top;
    145145    }
    146146
    147147    public void Yank(int index) {
    148       if (index == this.Count - 1) return;
    149 
    150       var item = this.ElementAt(index);
    151       this.data.RemoveAt(index);
    152       this.data.Add(item);
     148      if (index == Count - 1) return;
     149
     150      var item = ElementAt(index);
     151      data.RemoveAt(index);
     152      data.Add(item);
    153153    }
    154154
    155155    public T Pop() {
    156       var value = this.data[this.Count - 1];
    157       this.data.RemoveAt(this.Count - 1);
     156      var value = data[Count - 1];
     157      data.RemoveAt(Count - 1);
    158158
    159159      return value;
     
    161161
    162162    public T[] Pop(int count) {
    163       var items = this.Peek(count);
    164       this.Remove(count);
     163      var items = Peek(count);
     164      Remove(count);
    165165
    166166      return items;
     
    168168
    169169    public T Peek() {
    170       return this.Top;
     170      return Top;
    171171    }
    172172
    173173    public T[] Peek(int count) {
    174       var startIndex = this.Count - count;
     174      var startIndex = Count - count;
    175175
    176176      var items = new T[count];
    177       this.data.CopyTo(startIndex, items, 0, count);
     177      data.CopyTo(startIndex, items, 0, count);
    178178
    179179      return items;
     
    181181
    182182    public void Push(T item) {
    183       if (!this.IsEnabled) return;
    184 
    185       this.data.Add(item);
     183      if (!IsEnabled) return;
     184
     185      data.Add(item);
    186186    }
    187187
    188188    public void Push(T item1, T item2) {
    189       if (!this.IsEnabled) return;
    190 
    191       this.data.Add(item1);
    192       this.data.Add(item2);
     189      if (!IsEnabled) return;
     190
     191      data.Add(item1);
     192      data.Add(item2);
    193193    }
    194194
    195195    public void Push(T item1, T item2, T item3) {
    196       if (!this.IsEnabled) return;
    197 
    198       this.data.Add(item1);
    199       this.data.Add(item2);
    200       this.data.Add(item3);
     196      if (!IsEnabled) return;
     197
     198      data.Add(item1);
     199      data.Add(item2);
     200      data.Add(item3);
    201201    }
    202202
    203203    public void Push(T item1, T item2, T item3, T item4) {
    204       if (!this.IsEnabled) return;
    205 
    206       this.data.Add(item1);
    207       this.data.Add(item2);
    208       this.data.Add(item3);
    209       this.data.Add(item4);
     204      if (!IsEnabled) return;
     205
     206      data.Add(item1);
     207      data.Add(item2);
     208      data.Add(item3);
     209      data.Add(item4);
    210210    }
    211211
    212212    public void PushResult(int count, Func<T[], T> templateFunc) {
    213       if (!this.IsEnabled) return;
    214 
    215       var startIndex = this.Count - count;
     213      if (!IsEnabled) return;
     214
     215      var startIndex = Count - count;
    216216      var items = new T[count];
    217217
    218       this.data.CopyTo(startIndex, items, 0, count);
    219       this.Remove(count - 1);
    220 
    221       this.data[this.Count - 1] = templateFunc(items);
     218      data.CopyTo(startIndex, items, 0, count);
     219      Remove(count - 1);
     220
     221      data[Count - 1] = templateFunc(items);
    222222    }
    223223
    224224    public void Push(IReadOnlyList<T> items) {
    225       if (!this.IsEnabled) return;
    226 
    227       for (var i = 0; i < items.Count; i++) this.data.Add(items[i]);
     225      if (!IsEnabled) return;
     226
     227      for (var i = 0; i < items.Count; i++) data.Add(items[i]);
    228228    }
    229229
    230230    public void Insert(int index, T item) {
    231       if (!this.IsEnabled) return;
    232 
    233       this.data.Insert(index, item);
     231      if (!IsEnabled) return;
     232
     233      data.Insert(index, item);
    234234    }
    235235
    236236    public void Insert(int index, params T[] items) {
    237       if (!this.IsEnabled) return;
    238 
    239       this.data.InsertRange(index, items);
     237      if (!IsEnabled) return;
     238
     239      data.InsertRange(index, items);
    240240    }
    241241
    242242    public void Insert(int index, IEnumerable<T> items) {
    243       if (!this.IsEnabled) return;
    244 
    245       this.data.InsertRange(index, items);
     243      if (!IsEnabled) return;
     244
     245      data.InsertRange(index, items);
    246246    }
    247247
    248248    public bool Remove(T item) {
    249       var index = this.Count - 1;
    250       if ((this.Count > 0) && this.data[index].Equals(item)) {
    251         this.data.RemoveAt(index);
     249      var index = Count - 1;
     250      if ((Count > 0) && data[index].Equals(item)) {
     251        data.RemoveAt(index);
    252252        return true;
    253253      }
     
    256256
    257257    public void RemoveTop() {
    258       this.data.RemoveAt(this.Count - 1);
     258      data.RemoveAt(Count - 1);
    259259    }
    260260
    261261    public void Remove(int count) {
    262       for (var i = 0; i < count; i++) this.data.RemoveAt(this.Count - 1);
     262      for (var i = 0; i < count; i++) data.RemoveAt(Count - 1);
    263263    }
    264264
    265265    public void RemoveAt(int index) {
    266       this.data.RemoveAt(index);
     266      data.RemoveAt(index);
    267267    }
    268268
    269269    public void RemoveAt(int index, int count) {
    270       this.data.RemoveRange(index, count);
     270      data.RemoveRange(index, count);
    271271    }
    272272
    273273    public bool TryPop(out T item) {
    274       if (this.Count > 0) {
    275         item = this.Pop();
     274      if (Count > 0) {
     275        item = Pop();
    276276        return true;
    277277      }
  • branches/PushGP/HeuristicLab.PushGP/FeatureTests/DirtyList/PushStack3.cs

    r14777 r14908  
    2222
    2323    public PushStack3() {
    24       this.data = new LinkedList<T>();
    25       this.IsEnabled = true;
     24      data = new LinkedList<T>();
     25      IsEnabled = true;
    2626    }
    2727
     
    3232      get
    3333      {
    34         return this.data.Last.Value;
     34        return data.Last.Value;
    3535      }
    3636    }
     
    4040      get
    4141      {
    42         return this.Count > 0 ? Top : default(T);
     42        return Count > 0 ? Top : default(T);
    4343      }
    4444    }
     
    4848      get
    4949      {
    50         return this.data.First.Value;
     50        return data.First.Value;
    5151      }
    5252    }
     
    5656      get
    5757      {
    58         return this.Count > 0 ? Bottom : default(T);
     58        return Count > 0 ? Bottom : default(T);
    5959      }
    6060    }
     
    6464      get
    6565      {
    66         return this.data.Count;
     66        return data.Count;
    6767      }
    6868    }
     
    7272      get
    7373      {
    74         return this.Count == 0;
     74        return Count == 0;
    7575      }
    7676    }
     
    8585
    8686    public void Add(T item) {
    87       this.Push(item);
     87      Push(item);
    8888    }
    8989
    9090    public void Clear() {
    91       this.data.Clear();
     91      data.Clear();
    9292    }
    9393
    9494    public bool Contains(T item) {
    95       return this.data.Contains(item);
     95      return data.Contains(item);
    9696    }
    9797
    9898    public void CopyTo(T[] array, int arrayIndex) {
    99       this.data.CopyTo(array, arrayIndex);
     99      data.CopyTo(array, arrayIndex);
    100100    }
    101101
    102102    public IEnumerator<T> GetEnumerator() {
    103       return this.data.GetEnumerator();
     103      return data.GetEnumerator();
    104104    }
    105105
    106106    public T ElementAt(int index) {
    107       return this.data.ElementAt(index);
     107      return data.ElementAt(index);
    108108    }
    109109
     
    113113
    114114    public void SetTop(T value) {
    115       this.data.Last.Value = value;
     115      data.Last.Value = value;
    116116    }
    117117
     
    138138
    139139    public void Swap(int count) {
    140       var topValue = this.Top;
    141       var current = this.data.Last;
    142       var bottomIndex = this.Count - count;
    143 
    144 
    145       for (var i = this.Count - 1; i > bottomIndex; i--) {
     140      var topValue = Top;
     141      var current = data.Last;
     142      var bottomIndex = Count - count;
     143
     144
     145      for (var i = Count - 1; i > bottomIndex; i--) {
    146146        current.Value = current.Previous.Value;
    147147        current = current.Previous;
    148148      }
    149149
    150       this.data.Last.Value = topValue;
     150      data.Last.Value = topValue;
    151151    }
    152152
    153153    public void Yank(int index) {
    154       if (index == this.Count - 1) return;
    155 
    156       var item = this.GetByIndex(index);
    157       this.data.Remove(item);
    158       this.data.AddLast(item);
     154      if (index == Count - 1) return;
     155
     156      var item = GetByIndex(index);
     157      data.Remove(item);
     158      data.AddLast(item);
    159159    }
    160160
    161161    public T Pop() {
    162162      var value = Top;
    163       this.data.RemoveLast();
     163      data.RemoveLast();
    164164
    165165      return value;
     
    178178
    179179    public T Peek() {
    180       return this.Top;
     180      return Top;
    181181    }
    182182
    183183    public T[] Peek(int count) {
    184184      var items = new T[count];
    185       var current = this.data.Last;
     185      var current = data.Last;
    186186
    187187      for (var i = 0; i < count; i++) {
     
    194194
    195195    public void Push(T item) {
    196       if (!this.IsEnabled) return;
    197 
    198       this.data.AddLast(item);
     196      if (!IsEnabled) return;
     197
     198      data.AddLast(item);
    199199    }
    200200
    201201    public void Push(T item1, T item2) {
    202       if (!this.IsEnabled) return;
    203 
    204       this.data.AddLast(item1);
    205       this.data.AddLast(item2);
     202      if (!IsEnabled) return;
     203
     204      data.AddLast(item1);
     205      data.AddLast(item2);
    206206    }
    207207
    208208    public void Push(T item1, T item2, T item3) {
    209       if (!this.IsEnabled) return;
    210 
    211       this.data.AddLast(item1);
    212       this.data.AddLast(item2);
    213       this.data.AddLast(item3);
     209      if (!IsEnabled) return;
     210
     211      data.AddLast(item1);
     212      data.AddLast(item2);
     213      data.AddLast(item3);
    214214    }
    215215
    216216    public void Push(T item1, T item2, T item3, T item4) {
    217       if (!this.IsEnabled) return;
    218 
    219       this.data.AddLast(item1);
    220       this.data.AddLast(item2);
    221       this.data.AddLast(item3);
    222       this.data.AddLast(item4);
     217      if (!IsEnabled) return;
     218
     219      data.AddLast(item1);
     220      data.AddLast(item2);
     221      data.AddLast(item3);
     222      data.AddLast(item4);
    223223    }
    224224
    225225    public void PushResult(int count, Func<T[], T> templateFunc) {
    226       if (!this.IsEnabled) return;
     226      if (!IsEnabled) return;
    227227
    228228      Push(templateFunc(Pop(count)));
     
    230230
    231231    public void PushRange(IReadOnlyList<T> items) {
    232       if (!this.IsEnabled) return;
    233 
    234       for (var i = 0; i < items.Count; i++) this.data.AddLast(items[i]);
     232      if (!IsEnabled) return;
     233
     234      for (var i = 0; i < items.Count; i++) data.AddLast(items[i]);
    235235    }
    236236
    237237    public void Insert(int index, T value) {
    238       if (!this.IsEnabled) return;
     238      if (!IsEnabled) return;
    239239
    240240      var node = GetByIndex(index);
    241       this.data.AddBefore(node, value);
     241      data.AddBefore(node, value);
    242242    }
    243243
    244244    public bool Remove(T item) {
    245       return this.data.Remove(item);
     245      return data.Remove(item);
    246246    }
    247247
    248248    public void RemoveTop() {
    249       this.data.RemoveLast();
     249      data.RemoveLast();
    250250    }
    251251
    252252    public void Remove(int count) {
    253       for (var i = 0; i < count; i++) this.data.RemoveLast();
     253      for (var i = 0; i < count; i++) data.RemoveLast();
    254254    }
    255255
     
    257257      var node = GetByIndex(index);
    258258
    259       this.data.Remove(node);
     259      data.Remove(node);
    260260    }
    261261
     
    271271
    272272    public bool TryPop(out T item) {
    273       if (this.Count > 0) {
    274         item = this.Pop();
     273      if (Count > 0) {
     274        item = Pop();
    275275        return true;
    276276      }
Note: See TracChangeset for help on using the changeset viewer.