Print

Print


Commit in lcsim/src/org/lcsim/util/event on MAIN
BaseLCSimEvent.java+281.16 -> 1.17
GL: fix to 'could not find decoder' error (reported by Magill,Matt)

lcsim/src/org/lcsim/util/event
BaseLCSimEvent.java 1.16 -> 1.17
diff -u -r1.16 -r1.17
--- BaseLCSimEvent.java	19 Aug 2005 23:33:58 -0000	1.16
+++ BaseLCSimEvent.java	9 Feb 2006 22:17:37 -0000	1.17
@@ -126,6 +126,34 @@
    public void put(String name, List collection, Class type, int flags, String readoutName)
    {
       super.put(name,collection);
+      // First check readout validity
+      boolean isOriginal = false;
+      boolean isValid = false;
+      for(LCMetaData tmp : metaDataMap.values())
+      {
+	  String[] names = tmp.getStringParameters().get(READOUT_NAME);
+
+	  if(tmp.getName().equals(readoutName))
+	  {
+	    // readoutName already exists as a collection
+	    // does it have a parent collection?
+	    if(names == null || names.length == 0) {
+		// no parent, original collection
+		isOriginal=true;
+		break;
+	    }
+	    else {
+		// yes, reset readoutName from its parent
+		readoutName = names[0];
+		isValid = true;
+		break;
+	    }
+	  }
+      }
+
+      // not a valid readout name provided
+      if(!isValid && !isOriginal) readoutName = null;
+
       LCMetaData meta = new MetaData(name, type, flags, readoutName);
       metaDataMap.put(new ListHolder(collection),meta);
       // Fixme: This needs to be generalized
CVSspam 0.2.8