001    package cnslab.cnsnetwork;
002
003    import java.io.Serializable;
004    import java.util.LinkedList;
005
006    /***********************************************************************
007    * Class stored the information for intracellular recorder. 
008    * 
009    * @version
010    *   $Date: 2012-08-04 13:43:22 -0500 (Sat, 04 Aug 2012) $
011    *   $Rev: 104 $
012    *   $Author: croft $
013    * @author
014    *   Yi Dong
015    * @author
016    *   David Wallace Croft
017    ***********************************************************************/
018    public final class  IntraInfo
019      implements Serializable, Transmissible
020    ////////////////////////////////////////////////////////////////////////
021    ////////////////////////////////////////////////////////////////////////
022    {
023    
024    private static final long  serialVersionUID = 0L;
025    
026    //
027
028    /** neuron membrane voltage */
029    public double  memV;
030
031    /** currents for each of the receptors */
032    public LinkedList<Double>  curr;
033
034    ////////////////////////////////////////////////////////////////////////
035    ////////////////////////////////////////////////////////////////////////
036    
037    public  IntraInfo (
038      final double              memV,
039      final LinkedList<Double>  curr )
040    ////////////////////////////////////////////////////////////////////////
041    {
042      this.memV = memV;
043      
044      this.curr = curr;
045    }
046
047    ////////////////////////////////////////////////////////////////////////
048    ////////////////////////////////////////////////////////////////////////
049    
050    /***********************************************************************
051    * Sum the membrane voltage and currents of other IntraInfo to current
052    * one
053    * 
054    * @param other
055    *   IntraInfo
056    ***********************************************************************/
057    public void  plus ( final IntraInfo  other )
058    ////////////////////////////////////////////////////////////////////////
059    {
060      this.memV = this.memV + other.memV;
061      
062      for ( int  i = 0; i < curr.size ( ); i++ )
063      {
064        this.curr.set ( i, curr.get ( i ) + other.curr.get ( i ) );
065      }
066    }
067
068    /***********************************************************************
069    * divide the membrane and currents by j
070    * 
071    * @param j
072    *   number of parts
073    ***********************************************************************/
074    public void divide ( int  j )
075    ////////////////////////////////////////////////////////////////////////
076    {
077      this.memV = this.memV / ( ( double ) j );
078      
079      for ( int  i = 0; i < curr.size ( ); i++ )
080      {
081        this.curr.set ( i, curr.get ( i ) /  ( ( double ) j ) );
082      }
083    }
084    
085    @Override    
086    public String  toString ( )
087    ////////////////////////////////////////////////////////////////////////
088    {
089      return new String ( "memV:" + memV + " curr:" + curr );
090    }
091
092    ////////////////////////////////////////////////////////////////////////
093    ////////////////////////////////////////////////////////////////////////
094    }