Print

Print


Commit in lcsim/src/org/lcsim/util on MAIN
RemoveCollectionDriver.java+36added 1.1
Utility for removing collections

lcsim/src/org/lcsim/util
RemoveCollectionDriver.java added at 1.1
diff -N RemoveCollectionDriver.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ RemoveCollectionDriver.java	11 Oct 2012 13:17:30 -0000	1.1
@@ -0,0 +1,36 @@
+package org.lcsim.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.lcsim.event.EventHeader;
+
+/**
+ * Convenience driver to remove a set of collections from the event.
+ * @author cgrefe
+ */
+public class RemoveCollectionDriver extends Driver {
+
+	protected List<String> collectionNames;
+	
+	public RemoveCollectionDriver() {
+		collectionNames = new ArrayList<String>();
+	}
+	
+	public void setRemoveCollections(String[] collectionNames) {
+		this.collectionNames.addAll(Arrays.asList(collectionNames));
+	}
+	
+	public void setRemoveCollection(String collectionName) {
+		this.collectionNames.add(collectionName);
+	}
+	
+	@Override
+	protected void process(EventHeader event) {
+		for (String collectionName : collectionNames) {
+			event.remove(collectionName);
+		}
+	}
+
+}
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1