001 package com.croftsoft.core.ai.neuro.imp;
002
003 import com.croftsoft.core.ai.neuro.ChannelMut;
004 import com.croftsoft.core.ai.neuro.Neuron;
005 import com.croftsoft.core.lang.NullException;
006 import com.croftsoft.core.sim.Sim;
007
008 /***********************************************************************
009 * A synapse that reliably opens the channel when the neuron spikes.
010 *
011 * @version
012 * $Id: ReliableSynapse.java,v 1.2 2008/07/25 23:32:22 croft Exp $
013 * @since
014 * 2008-07-19
015 * @author
016 * <a href="https://www.croftsoft.com/">David Wallace Croft</a>
017 ***********************************************************************/
018
019 public class ReliableSynapse
020 implements Sim
021 ////////////////////////////////////////////////////////////////////////
022 ////////////////////////////////////////////////////////////////////////
023 {
024
025 private final Neuron presynapticNeuron;
026
027 private final ChannelMut channelMut;
028
029 //
030
031 private boolean presynapticNeuronSpiking;
032
033 ////////////////////////////////////////////////////////////////////////
034 ////////////////////////////////////////////////////////////////////////
035
036 public ReliableSynapse (
037 final Neuron presynapticNeuron,
038 final ChannelMut channelMut )
039 ////////////////////////////////////////////////////////////////////////
040 {
041 NullException.check (
042 this.presynapticNeuron = presynapticNeuron,
043 this.channelMut = channelMut );
044 }
045
046 ////////////////////////////////////////////////////////////////////////
047 ////////////////////////////////////////////////////////////////////////
048
049 public void access ( )
050 ////////////////////////////////////////////////////////////////////////
051 {
052 presynapticNeuronSpiking = presynapticNeuron.isSpiking ( );
053 }
054
055 public void mutate ( )
056 ////////////////////////////////////////////////////////////////////////
057 {
058 if ( presynapticNeuronSpiking )
059 {
060 channelMut.setOpen ( true );
061 }
062 }
063
064 ////////////////////////////////////////////////////////////////////////
065 ////////////////////////////////////////////////////////////////////////
066 }