Record Class WfdbSignal

java.lang.Object
java.lang.Record
com.framed.communicator.driver.protocol.mimic.WfdbSignal
Record Components:
fileName - name of the .dat file holding this signal's samples (relative to the header), or "~" for a layout-header placeholder signal
format - WFDB storage format code (e.g. 80, 16, 212)
byteOffset - preamble length in bytes to skip at the start of fileName (the +N decorator on the format field; 0 if absent)
gain - ADC units per physical unit; 0 means uncalibrated
baseline - ADC value corresponding to a physical value of 0
units - physical unit string (e.g. "mV", "mmHg"); may be null
description - human-readable signal name (e.g. "II", "PLETH", "ABP")

public record WfdbSignal(String fileName, int format, int byteOffset, double gain, int baseline, String units, String description) extends Record
The specification of a single signal, as declared on one signal-specification line of a WFDB header file.

All fields are taken verbatim from the header; the physical value of a raw ADC sample is recovered with toPhysical(int) using the WFDB convention physical = (adc - baseline) / gain. A gain of 0 marks the signal as uncalibrated: no physical unit is defined and the raw ADC value is passed through unchanged (see uncalibrated()).

  • Constructor Summary

    Constructors
    Constructor
    Description
    WfdbSignal(String fileName, int format, int byteOffset, double gain, int baseline, String units, String description)
    Creates an instance of a WfdbSignal record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the baseline record component.
    int
    Returns the value of the byteOffset record component.
    Returns the value of the description record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the fileName record component.
    int
    Returns the value of the format record component.
    double
    Returns the value of the gain record component.
    final int
    Returns a hash code value for this object.
    double
    toPhysical(int adc)
    Converts a raw ADC sample to its physical value using (adc - baseline) / gain.
    final String
    Returns a string representation of this record class.
    boolean
    Whether this signal is uncalibrated (WFDB gain 0).
    Returns the value of the units record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • WfdbSignal

      public WfdbSignal(String fileName, int format, int byteOffset, double gain, int baseline, String units, String description)
      Creates an instance of a WfdbSignal record class.
      Parameters:
      fileName - the value for the fileName record component
      format - the value for the format record component
      byteOffset - the value for the byteOffset record component
      gain - the value for the gain record component
      baseline - the value for the baseline record component
      units - the value for the units record component
      description - the value for the description record component
  • Method Details

    • uncalibrated

      public boolean uncalibrated()
      Whether this signal is uncalibrated (WFDB gain 0). Uncalibrated signals carry no physical unit and toPhysical(int) returns the raw ADC value.
      Returns:
      true if gain() is 0
    • toPhysical

      public double toPhysical(int adc)
      Converts a raw ADC sample to its physical value using (adc - baseline) / gain.
      Parameters:
      adc - the raw (already format-decoded, sign-corrected) ADC sample value
      Returns:
      the physical value, or the unchanged adc when uncalibrated()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • fileName

      public String fileName()
      Returns the value of the fileName record component.
      Returns:
      the value of the fileName record component
    • format

      public int format()
      Returns the value of the format record component.
      Returns:
      the value of the format record component
    • byteOffset

      public int byteOffset()
      Returns the value of the byteOffset record component.
      Returns:
      the value of the byteOffset record component
    • gain

      public double gain()
      Returns the value of the gain record component.
      Returns:
      the value of the gain record component
    • baseline

      public int baseline()
      Returns the value of the baseline record component.
      Returns:
      the value of the baseline record component
    • units

      public String units()
      Returns the value of the units record component.
      Returns:
      the value of the units record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component