Commit in lcsim/src/org/lcsim/util on MAIN | |||
RemoveCollectionDriver.java | +36 | added 1.1 |
Utility for removing collections
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); + } + } + +}
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