示例#1
0
        //private helper methods
        private List <Dendrite> AddDendrites(int numToAdd, int[] typesList)
        {
            List <Dendrite> added = new List <Dendrite>(numToAdd);

            if (typesList.Length != numToAdd)
            {
                throw new ArgumentException("Number of dendrites to be created doesn't match number of elements in type list.");
            }

            for (int i = 0; i < numToAdd; i++)
            {
                Dendrite newest = new Dendrite(nextDendriteId++,
                                               typesList[i],
                                               d_DecayFrequency,
                                               d_ProductionFrequency,
                                               d_RestoreIncrement,
                                               d_NumSynapsesToAddInGrowthEvent,
                                               d_SecondaryMessengerWindow,
                                               d_SecondaryMessengerFrequencyTrigger,
                                               d_NumStartingSynapsesPerDendrite,
                                               d_SignificantVoltageChange);

                dendrites.AddOrUpdate(newest.Id, newest, (key, oldValue) => oldValue);
                added.Add(newest);
            }
            return(added);
        }
示例#2
0
 public Task_InputAxon(int id, TimeSpan runLength, InputAxon axon, int magnitude, DateTime start) //tested
 {
     Console.WriteLine("Task_InputAxon " + id + " is created.");
     this.id        = id;
     this.runLength = runLength;
     this.dendrite  = null;
     this.axon      = axon;
     this.neurotransmitterMagnitude = magnitude;
     this.start = start;
 }
示例#3
0
        //constructors
        public Task_Dendrite(int id, TimeSpan runLength, Dendrite dendrite, CellBody body, DateTime start) //tested
        {
            Console.WriteLine("Task_Dendrite " + id + " is created.");

            this.id        = id;
            this.dendrite  = dendrite;
            this.runLength = runLength;
            this.body      = body;
            this.start     = start;
        }
示例#4
0
        //public methods
        public void ConnectAndProduce(Neuron neuron) //tested
        {
            //find an open synapse
            Dendrite result = neuron.SearchForOpenSynapse(axon);

            if (result != null)
            {
                Console.WriteLine("InputAxon " + id + " found dendrite " + result);
                this.dendrite = result;
                Produce();
            }
        }
示例#5
0
        //constructors
        public Task_InputAxon(int id, TimeSpan runLength, InputAxon axon, int magnitude, DateTime start, Dendrite dendrite) //tested
        {
            Console.WriteLine("Task_AxonInput " + id + " is created.");
            this.id        = id;
            this.runLength = runLength;
            bool success = dendrite.TryConnect(axon);

            this.axon = axon;
            this.neurotransmitterMagnitude = magnitude;
            this.start = start;

            if (success)
            {
                this.dendrite = dendrite;
            }
        }
示例#6
0
        public Dendrite SearchForOpenSynapse(InputAxon axon) //tested
        {
            Dendrite dendrite = null;

            foreach (Dendrite current in dendrites.Values)
            {
                bool success = current.TryConnect(axon);
                if (success)
                {
                    Console.WriteLine("Neuron found open synapse on dendrite.");
                    dendrite = current;
                    break; //stop searching
                }
            }

            return(dendrite);
        }
示例#7
0
        //public methods
        public Dendrite GetDendrite(int id) //tested
        {
            Dendrite result = dendrites.GetOrAdd(id, (key) => null);

            return(result);
        }