Commit in lcsim on MAIN
test/LCIOReadTest.java+201.8 -> 1.9
src/org/lcsim/util/loop/LCIOEventSource.java+16-111.2 -> 1.3
+36-11
2 modified files
Fix LCSIM-50

lcsim/test
LCIOReadTest.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- LCIOReadTest.java	18 Jul 2005 05:04:33 -0000	1.8
+++ LCIOReadTest.java	4 Aug 2005 03:08:57 -0000	1.9
@@ -1,5 +1,6 @@
 import java.io.File;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.List;
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -10,6 +11,7 @@
 import org.lcsim.util.Driver;
 import org.lcsim.util.cache.FileCache;
 import org.lcsim.util.loop.LCIODriver;
+import org.lcsim.util.loop.LCIOEventSource;
 
 import org.lcsim.util.loop.LCSimLoop;
 
@@ -42,6 +44,24 @@
       loop.add(new ReadDriver());
       loop.add(new LCIODriver(new File("test.slcio")));
       loop.loop(-1);
+      assertEquals(1000,loop.getTotalCountableSupplied());
+      loop.dispose();
+   }
+   public void testLCIOReadChain() throws Exception
+   {
+      URL url = new URL("http://www.lcsim.org/datasamples/slic_sdjan03_K0S_Theta90_1-10GeV.slcio");
+      FileCache cache = new FileCache();
+      File file = cache.getCachedFile(url);
+      
+      List<File> files = new ArrayList<File>();
+      files.add(file);
+      files.add(file);
+      LCIOEventSource es = new LCIOEventSource("TestChain", files);
+      
+      LCSimLoop loop = new LCSimLoop();
+      loop.setLCIORecordSource(es);
+      loop.loop(-1);
+      assertEquals(2000,loop.getTotalCountableSupplied());
       loop.dispose();
    }
    private class ReadDriver extends Driver

lcsim/src/org/lcsim/util/loop
LCIOEventSource.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- LCIOEventSource.java	19 Jul 2005 22:42:09 -0000	1.2
+++ LCIOEventSource.java	4 Aug 2005 03:08:58 -0000	1.3
@@ -14,7 +14,7 @@
 /**
  * Convert an LCIOReader to a SequentialRecordSource
  * @author tonyj
- * @version $Id: LCIOEventSource.java,v 1.2 2005/07/19 22:42:09 tonyj Exp $
+ * @version $Id: LCIOEventSource.java,v 1.3 2005/08/04 03:08:58 tonyj Exp $
  */
 public class LCIOEventSource implements SequentialRecordSource
 {
@@ -63,19 +63,24 @@
    
    public void next() throws IOException
    {
-      try
-      {
-         currentEvent = reader.read();
-      }
-      catch (EOFException x)
+      for (;;)
       {
-         currentFile++;
-         if (currentFile >= files.size()) atEnd = true;
-         else
+         try
+         {
+            currentEvent = reader.read();
+         }
+         catch (EOFException x)
          {
-             reader.close();
-             reader = new LCIOReader(files.get(currentFile));
+            currentFile++;
+            if (currentFile >= files.size()) atEnd = true;
+            else
+            {
+                reader.close();
+                reader = new LCIOReader(files.get(currentFile));
+                continue;
+            }
          }
+         return;
       }
    }
    public void releaseRecord(Object obj)
CVSspam 0.2.8