//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); }
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; }
//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; }
//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(); } }
//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; } }
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); }
//public methods public Dendrite GetDendrite(int id) //tested { Dendrite result = dendrites.GetOrAdd(id, (key) => null); return(result); }
//public methods public Dendrite GetDendrite(int id) //tested { Dendrite result = dendrites.GetOrAdd(id, (key) => null); //if id doesn't exist, add it as a key with the value NULL return(result); }