package hep.lcio.implementation.sio;

import hep.lcd.io.sio.SIOInputStream;
import hep.lcd.io.sio.SIOOutputStream;
import hep.lcd.io.sio.SIORef;


import hep.lcio.event.LCIO;

import hep.lcio.data.TPCHitData;
import hep.lcio.event.TPCHit;
import hep.lcio.implementation.event.ITPCHit;

import java.io.IOException;

import org.apache.xml.utils.RawCharacterHandler;


/**
 *
 * @author Tony Johnson
 * @version $Id: SIOTPCHit.java,v 1.2 2003-09-15 21:44:33 tonyj Exp $
 */
class SIOTPCHit extends ITPCHit
{
   SIOTPCHit(SIOInputStream in, int flags, SIOEvent owner) throws IOException
   {
      setParent(owner);
      cellID = in.readInt();
      time = in.readFloat();
      charge = in.readFloat();
      quality = in.readInt();

      if ((flags & (1 << LCIO.TPCBIT_RAW)) != 0)
      {
	     int size = in.readInt() ;
         rawDataArray = new int[ size ] ;
	     for (int i = 0; i < size; i++) {
	        rawDataArray[i] = in.readInt() ;		
		}
      }
   }

   static void write(TPCHitData hit, SIOOutputStream out, int flags) throws IOException
   {
      if (hit instanceof SIOTPCHit)
         ((SIOTPCHit) hit).write(out, flags);
      else
      {
         out.writeInt(hit.getCellID());
         out.writeFloat(hit.getTime());
         out.writeFloat(hit.getCharge());
         out.writeInt(hit.getQuality());

         if ((flags & (1 << LCIO.TPCBIT_RAW)) != 0)
         {
           out.writeInt( hit.getNRawDataWords() );
           for (int i = 0; i < hit.getNRawDataWords() ; i++) {
			 out.writeInt( hit.getRawDataWord(i) ) ;
		   }            
         }
      }
   }

   private void write(SIOOutputStream out, int flags) throws IOException
   {
      out.writeInt(cellID);
      out.writeFloat(time);
      out.writeFloat(charge);
      out.writeInt(quality);

      if ((flags & (1 << LCIO.TPCBIT_RAW)) != 0)
      {
         out.writeInt(rawDataArray.length);
	     for (int i = 0; i < rawDataArray.length; i++) {
           out.writeInt( rawDataArray[i]);
	     }
      }
   }
}

@@ -139,17 +139,16 @@
 IORef;%0A%0A
-%0A
 import h
@@ -311,58 +311,8 @@
 n;%0A%0A
-import org.apache.xml.utils.RawCharacterHandler;%0A%0A
 %0A/**
@@ -379,29 +379,29 @@
 v 1.
-2
+3
  200
-3-09-15
+4-01-08
  21:4
-4:33
+6:54
  ton
@@ -673,16 +673,22 @@
 dInt();%0A
+      
 %0A      i
@@ -737,17 +737,20 @@
       %7B%0A
-%09
+    
      int
@@ -814,17 +814,20 @@
 ize %5D ;%0A
-%09
+    
      for
@@ -857,20 +857,29 @@
 i++)
+%0A        
  %7B%0A
-%09
+ 
         
 rawD
@@ -866,32 +866,35 @@
      %7B%0A         
+   
 rawDataArray%5Bi%5D 
@@ -913,13 +913,18 @@
 () ;
-%09%09%0A%09%09
+%0A         
 %7D%0A  
@@ -930,24 +930,27 @@
      %7D%0A   %7D%0A
+   
 %0A   static v
@@ -1295,16 +1295,25 @@
 ity());%0A
+         
 %0A       
@@ -1371,32 +1371,33 @@
    %7B%0A           
+ 
 out.writeInt( hi
@@ -1420,16 +1420,17 @@
 ds() );%0A
+ 
         
@@ -1485,14 +1485,37 @@
 i++)
- %7B%0A%09%09%09
+%0A            %7B%0A              
  out
@@ -1555,14 +1555,8 @@
 ) ;%0A
-%09%09   %7D
     
@@ -1555,32 +1555,33 @@
 ) ;%0A            
+%7D
 %0A         %7D%0A    
@@ -1589,16 +1589,19 @@
  %7D%0A   %7D%0A
+   
 %0A   priv
@@ -1786,16 +1786,22 @@
 ality);%0A
+      
 %0A      i
@@ -1894,17 +1894,20 @@
 ength);%0A
-%09
+    
      for
@@ -1948,19 +1948,29 @@
 th; i++)
+%0A        
  %7B%0A
+ 
         
@@ -2008,9 +2008,12 @@
 %5D);%0A
-%09
+    
     

Remove spurious import