001 package cnslab.cnsnetwork; 002 003 import java.io.*; 004 import java.util.*; 005 006 /*********************************************************************** 007 * Stored array of neurons which needs to be recorded. 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 IntraRecBuffer 019 implements Serializable, Transmissible 020 //////////////////////////////////////////////////////////////////////// 021 //////////////////////////////////////////////////////////////////////// 022 { 023 024 private static final long serialVersionUID = 0L; 025 026 /** Array of intracellularly recorded neuron. */ 027 public int [ ] 028 neurons; 029 030 /** Array of IntraInfo */ 031 public List<LinkedList<IntraInfo>> 032 buff; 033 034 //////////////////////////////////////////////////////////////////////// 035 //////////////////////////////////////////////////////////////////////// 036 037 public IntraRecBuffer ( final int [ ] neurons ) 038 //////////////////////////////////////////////////////////////////////// 039 { 040 this.neurons = neurons; 041 042 buff = new ArrayList<LinkedList<IntraInfo>> ( ); 043 044 for ( int i = 0; i < this.neurons.length; i++ ) 045 { 046 buff.add ( new LinkedList<IntraInfo> ( ) ); 047 } 048 } 049 050 //////////////////////////////////////////////////////////////////////// 051 //////////////////////////////////////////////////////////////////////// 052 053 public void init ( ) 054 //////////////////////////////////////////////////////////////////////// 055 { 056 for ( int i = 0; i < this.neurons.length; i++ ) 057 { 058 buff.get ( i ).clear ( ); 059 } 060 } 061 062 @Override 063 public String toString ( ) 064 //////////////////////////////////////////////////////////////////////// 065 { 066 String out = "print intra size" + (neurons.length) + "\n"; 067 068 for ( int i = 0; i < neurons.length; i++ ) 069 { 070 out = out 071 + " neuron" + i + " intrainfo" + buff.get ( i ).size ( ) + "\n"; 072 073 for ( int j = 0; j < buff.get ( i ).size ( ); j++ ) 074 { 075 out = out + buff.get ( i ).get ( j ) + " "; 076 } 077 078 out = out + "\n"; 079 } 080 081 return out; 082 } 083 084 //////////////////////////////////////////////////////////////////////// 085 //////////////////////////////////////////////////////////////////////// 086 }