int getNumberOfConnectedSynapses(Neuron neuron) { int numberOfConnectedSynapses = 0; for (DistalSegment distalSegment : neuron.getDistalSegments()) { numberOfConnectedSynapses += distalSegment.getConnectedSynapses().size(); } return numberOfConnectedSynapses; }
int getNumberOfConnectedSynapsesToCurrentActiveNeuron( Neuron possiblyActiveInNextTimeStep, Neuron activeNeuron) { // NOTE: This is incredibly inefficient. Fix this by making activeNeuron // know which synapses from which neurons are connected to it. int numberOfConnectedSynapsesToCurrentActiveNeuron = 0; for (DistalSegment distalSegment : possiblyActiveInNextTimeStep.getDistalSegments()) { for (Synapse synapse : distalSegment.getConnectedSynapses()) { if (synapse.getCell().equals(activeNeuron)) { numberOfConnectedSynapsesToCurrentActiveNeuron++; } } } return numberOfConnectedSynapsesToCurrentActiveNeuron; }