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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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      }
Note: See TracChangeset for help on using the changeset viewer.