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/HeuristicLab.Problems.ProgramSynthesis/Push/Data/List/SkipList.cs

    r14875 r14908  
    5050
    5151    public SkipListNode(T value) {
    52       this.Value = value;
     52      Value = value;
    5353    }
    5454
     
    6262
    6363    public virtual bool IsHeader() {
    64       return this.GetType() == typeof(SkipListNodeHeader<T>);
     64      return GetType() == typeof(SkipListNodeHeader<T>);
    6565    }
    6666
    6767    public virtual bool IsFooter() {
    68       return this.GetType() == typeof(SkipListNodeFooter<T>);
     68      return GetType() == typeof(SkipListNodeFooter<T>);
    6969    }
    7070  }
     
    162162    /// </summary>
    163163    protected void clearEmptyLevels() {
    164       if (this.levels > 1) //more than one level, don't want to remove bottom level
     164      if (levels > 1) //more than one level, don't want to remove bottom level
    165165      {
    166         SkipListNode<T> currentNode = this.topLeft;
    167 
    168         while (currentNode != this.bottomLeft) //do not remove the bottom level
     166        SkipListNode<T> currentNode = topLeft;
     167
     168        while (currentNode != bottomLeft) //do not remove the bottom level
    169169        {
    170170          if (currentNode.IsHeader() && currentNode.Next.IsFooter()) {
     
    181181
    182182            //Update counters
    183             this.levels--;
     183            levels--;
    184184
    185185            currentNode = belowNode; //scan down
     
    197197
    198198      //Add levels to entire list if necessary
    199       int newLevelCount = valueLevels - this.levels; //number of levels missing
     199      int newLevelCount = valueLevels - levels; //number of levels missing
    200200      while (newLevelCount > 0) {
    201201        //Create new level
     
    203203
    204204        //Link down
    205         newLevel.Below = this.topLeft;
    206         this.topLeft.Above = newLevel;
    207         this.topLeft = newLevel; //update reference to most top-left node
     205        newLevel.Below = topLeft;
     206        topLeft.Above = newLevel;
     207        topLeft = newLevel; //update reference to most top-left node
    208208
    209209        //Update counters
    210210        newLevelCount--;
    211         this.levels++;
     211        levels++;
    212212      }
    213213
    214214      //Insert the value in the proper position, creating as many levels as was randomly determined
    215       SkipListNode<T> currentNode = this.topLeft;
     215      SkipListNode<T> currentNode = topLeft;
    216216      SkipListNode<T> lastNodeAbove = null; //keeps track of the upper-level nodes in a tower
    217       int currentLevel = this.levels - 1;
     217      int currentLevel = levels - 1;
    218218
    219219      while (currentLevel >= 0 && currentNode != null) {
     
    256256      }
    257257
    258       this.size++; //update count
     258      size++; //update count
    259259    }
    260260
     
    263263    /// </summary>
    264264    public virtual SkipListNode<T> Find(T value) {
    265       SkipListNode<T> foundNode = this.topLeft;
     265      SkipListNode<T> foundNode = topLeft;
    266266
    267267      //Look for the highest-level node with an element value matching the parameter value
     
    286286    /// </summary>
    287287    public virtual SkipListNode<T> FindLowest(T value) {
    288       SkipListNode<T> valueNode = this.Find(value);
    289       return this.FindLowest(valueNode);
     288      SkipListNode<T> valueNode = Find(value);
     289      return FindLowest(valueNode);
    290290    }
    291291
     
    309309    /// </summary>
    310310    public virtual SkipListNode<T> FindHighest(T value) {
    311       SkipListNode<T> valueNode = this.Find(value);
    312       return this.FindHighest(valueNode);
     311      SkipListNode<T> valueNode = Find(value);
     312      return FindHighest(valueNode);
    313313    }
    314314
     
    332332    /// </summary>
    333333    public virtual bool Contains(T value) {
    334       return (this.Find(value) != null);
     334      return (Find(value) != null);
    335335    }
    336336
     
    339339    /// </summary>
    340340    public virtual bool Remove(T value) {
    341       SkipListNode<T> valueNode = this.FindHighest(value);
    342       return this.Remove(valueNode);
     341      SkipListNode<T> valueNode = FindHighest(value);
     342      return Remove(valueNode);
    343343    }
    344344
     
    352352        //Make sure node is top-level node in it's tower
    353353        if (valueNode.Above != null)
    354           valueNode = this.FindHighest(valueNode);
     354          valueNode = FindHighest(valueNode);
    355355
    356356        //---Delete nodes going down the tower
     
    372372
    373373        //update counter
    374         this.size--;
     374        size--;
    375375
    376376        //Clean up the Skip List by removing levels that are now empty
    377         this.clearEmptyLevels();
     377        clearEmptyLevels();
    378378
    379379        return true;
     
    385385    /// </summary>
    386386    public virtual void Clear() {
    387       SkipListNode<T> currentNode = this.Head;
     387      SkipListNode<T> currentNode = Head;
    388388
    389389      while (currentNode != null) {
     
    391391
    392392        if (!currentNode.IsHeader() && !currentNode.IsFooter()) {
    393           this.Remove(currentNode);
     393          Remove(currentNode);
    394394        }
    395395
     
    409409    /// </summary>
    410410    public virtual void CopyTo(T[] array, int startIndex) {
    411       IEnumerator<T> enumerator = this.GetEnumerator();
     411      IEnumerator<T> enumerator = GetEnumerator();
    412412
    413413      for (int i = startIndex; i < array.Length; i++) {
     
    423423    /// </summary>
    424424    public virtual int GetHeight(T value) {
    425       SkipListNode<T> valueNode = this.FindLowest(value);
    426       return this.GetHeight(valueNode);
     425      SkipListNode<T> valueNode = FindLowest(value);
     426      return GetHeight(valueNode);
    427427    }
    428428
     
    459459    /// </summary>
    460460    IEnumerator IEnumerable.GetEnumerator() {
    461       return this.GetEnumerator();
     461      return GetEnumerator();
    462462    }
    463463
     
    480480      object IEnumerator.Current
    481481      {
    482         get { return this.Current; }
     482        get { return Current; }
    483483      }
    484484
     
    493493      public bool MoveNext() {
    494494        if (current == null)
    495           current = this.skipList.Head.Next; //Head is header node, start after
     495          current = skipList.Head.Next; //Head is header node, start after
    496496        else
    497497          current = current.Next;
Note: See TracChangeset for help on using the changeset viewer.