Commit in hps-java/src/main/java/org/lcsim/hps/conditions/svt on MAIN
SvtChannelMap.java+221.2 -> 1.3
add find method

hps-java/src/main/java/org/lcsim/hps/conditions/svt
SvtChannelMap.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- SvtChannelMap.java	4 Oct 2013 01:43:48 -0000	1.2
+++ SvtChannelMap.java	11 Oct 2013 01:01:42 -0000	1.3
@@ -1,6 +1,11 @@
 package org.lcsim.hps.conditions.svt;
 
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
+import java.util.List;
+
+import org.lcsim.hps.util.Pair;
 
 /**
  * This class represents a map between channels and their database IDs from the channels table.
@@ -16,6 +21,23 @@
      */
     SvtChannelMap() {
     }
+    
+    /**
+     * Find channels that match a DAQ pair (FPGA, hybrid).
+     * @param pair The DAQ pair.
+     * @return The channels matching the DAQ pair or null if not found.
+     */
+    public Collection<SvtChannel> find(Pair<Integer,Integer> pair) {
+        List<SvtChannel> channels = new ArrayList<SvtChannel>(); 
+        int fpga = pair.getFirstElement();
+        int hybrid = pair.getSecondElement();
+        for (SvtChannel channel : values()) {
+            if (channel.getFpga() == fpga && channel.getHybrid() == hybrid) {
+                channels.add(channel);
+            }
+        }
+        return channels;
+    }
                
     /**
      * Convert this object to a human readable string.
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