Download ChemotaxisSimulation.zip, last updated 02/11/2020 (529.88 KB)

Download
  • md5: d0f0a74f8f3c043fabf60aeb07356f69
  • sha1: 645a77d0f7184873fe70c2bb375833e564b348be
  • sha256: da9ab3cfc5e17e120b6660a137012b6eca68a7a3218cb213b3e0e3eb9445b104
using System.Collections.ObjectModel;

// Simulating Bacterial Chemotaxis
// https://www.cyotek.com/blog/simulating-bacterial-chemotaxis

// Copyright © 2020 Cyotek Ltd. All Rights Reserved.

// This work is licensed under the MIT License.
// See LICENSE.TXT for the full text

// Found this example useful?
// https://www.paypal.me/cyotek

namespace Cyotek.ChemotaxisSimulation
{
  public class ChemoeffectorCollection : Collection<Chemoeffector>
  {
    #region Private Fields

    private Simulation _owner;

    #endregion Private Fields

    #region Internal Properties

    internal Simulation Owner
    {
      get { return _owner; }
      set
      {
        _owner = value;

        if (value != null)
        {
          for (int i = 0; i < this.Count; i++)
          {
            this[i].Owner = value;
          }
        }
      }
    }

    #endregion Internal Properties

    #region Protected Methods

    protected override void InsertItem(int index, Chemoeffector item)
    {
      item.Owner = _owner;

      base.InsertItem(index, item);
    }

    #endregion Protected Methods
  }
}

Donate

Donate