View Javadoc
1   package org.hps.conditions.svt;
2   
3   import org.hps.conditions.api.BaseConditionsObject;
4   import org.hps.conditions.api.BaseConditionsObjectCollection;
5   import org.hps.conditions.database.Field;
6   import org.hps.conditions.database.Table;
7   
8   /**
9    * Conditions object for SVT timing configuration constants, including offset phase and time (in nanoseconds).
10   * <p>
11   * There will generally be only one of these records per run.
12   *
13   * @author Jeremy McCormick, SLAC
14   */
15  @Table(names = {"svt_timing_constants"})
16  public final class SvtTimingConstants extends BaseConditionsObject {
17  
18      /**
19       * The collection implementation for {@link SvtTimingConstants}.
20       */
21      @SuppressWarnings("serial")
22      public static class SvtTimingConstantsCollection extends BaseConditionsObjectCollection<SvtTimingConstants> {
23  
24          /**
25           * Find timing constants by offset phase and time.
26           *
27           * @param offsetPhase the offset phase
28           * @param offsetTime the offset time
29           * @return the constants that match the params or <code>null</code> if not found
30           */
31          public SvtTimingConstants find(final int offsetPhase, final double offsetTime) {
32              for (final SvtTimingConstants constants : this) {
33                  if (constants.getOffsetPhase().equals(offsetPhase) && constants.getOffsetTime().equals(offsetTime)) {
34                      return constants;
35                  }
36              }
37              return null;
38          }
39      }
40  
41      /**
42       * The SVT offset phase (ns).
43       *
44       * @return the SVT offset phase
45       */
46      @Field(names = {"offset_phase"})
47      public Integer getOffsetPhase() {
48          return this.getFieldValue("offset_phase");
49      }
50  
51      /**
52       * The SVT offset time (ns).
53       *
54       * @return the SVT offset time (ns)
55       */
56      @Field(names = {"offset_time"})
57      public Double getOffsetTime() {
58          return this.getFieldValue("offset_time");
59      }
60  }