001        package com.croftsoft.core.ai.neuro.imp;
002    
003        import com.croftsoft.core.ai.neuro.ChannelSim;
004    
005        /***********************************************************************
006        * Mutable Channel implementation that snaps shut when updated.
007        * 
008        * @version
009        *   $Id: SnapChannel.java,v 1.5 2008/07/25 23:32:22 croft Exp $
010        * @since
011        *   2008-07-19
012        * @author
013        *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
014        ***********************************************************************/
015    
016        public class  SnapChannel
017          implements ChannelSim
018        ////////////////////////////////////////////////////////////////////////
019        ////////////////////////////////////////////////////////////////////////
020        {
021          
022        private double
023          conductance,
024          reversalPotential;
025        
026        private boolean  open;
027          
028        ////////////////////////////////////////////////////////////////////////
029        ////////////////////////////////////////////////////////////////////////
030        
031        public  SnapChannel (
032          final double   conductance,
033          final double   reversalPotential,
034          final boolean  open )
035        ////////////////////////////////////////////////////////////////////////
036        {
037          this.conductance        = conductance;
038          
039          this.reversalPotential  = reversalPotential;
040          
041          this.open               = open;
042        }
043    
044        public  SnapChannel (
045          final double   conductance,
046          final double   reversalPotential )
047        ////////////////////////////////////////////////////////////////////////
048        {
049          this ( conductance, reversalPotential, false );
050        }
051    
052        ////////////////////////////////////////////////////////////////////////
053        ////////////////////////////////////////////////////////////////////////
054        
055        public double  getConductance ( )
056        ////////////////////////////////////////////////////////////////////////
057        {
058          return conductance;
059        }
060        
061        public double  getReversalPotential ( )
062        ////////////////////////////////////////////////////////////////////////
063        {
064          return reversalPotential;
065        }
066          
067        public boolean  isOpen ( )
068        ////////////////////////////////////////////////////////////////////////
069        {
070          return open;
071        }
072    
073        ////////////////////////////////////////////////////////////////////////
074        ////////////////////////////////////////////////////////////////////////
075        
076        public void  setConductance ( final double  conductance )
077        ////////////////////////////////////////////////////////////////////////
078        {
079          this.conductance = conductance;
080        }
081    
082        public void  setOpen ( final boolean  open )
083        ////////////////////////////////////////////////////////////////////////
084        {
085          this.open = open;
086        }
087        
088        public void  setReversalPotential ( final double  reversalPotential )
089        ////////////////////////////////////////////////////////////////////////
090        {
091          this.reversalPotential = reversalPotential;
092        }
093    
094        ////////////////////////////////////////////////////////////////////////
095        ////////////////////////////////////////////////////////////////////////
096    
097        public void  access ( )
098        ////////////////////////////////////////////////////////////////////////
099        {
100          // empty
101        }
102        
103        public void  mutate ( )
104        ////////////////////////////////////////////////////////////////////////
105        {
106          if ( open )
107          {
108            open = false;
109          }
110        }
111        
112        ////////////////////////////////////////////////////////////////////////
113        ////////////////////////////////////////////////////////////////////////
114        }