Beispiel #1
0
  /**
   * WaveformSnapshot constructor.
   *
   * @param correlation The pulse's correlation event from which we extract the waveforms.
   * @param pvMap The map of entries each containing a waveform id as the key and PV name as the
   *     value.
   * @param timeMap The map of entries each containing a waveform id as the key and the associated
   *     WaveformTime as the value
   */
  public WaveformSnapshot(
      final Correlation<ChannelTimeRecord> correlation,
      final Map<String, String> pvMap,
      final Map<String, WaveformTime> timeMap) {
    timestamp = correlation.meanDate();

    final Set<String> keys = new HashSet<>(pvMap.keySet());
    keys.retainAll(correlation.names());

    int count = keys.size();
    waveforms = new Waveform[count];
    int index = 0;
    for (final String key : keys) {
      final ChannelRecord record = correlation.getRecord(key);
      final WaveformTime timeInfo = timeMap.get(key);
      final String pvName = pvMap.get(key);
      waveforms[index] = new Waveform(pvName, record.doubleArray(), timeInfo);
      ++index;
    }
  }