Package PamUtils

Class FrequencyFormat

java.lang.Object
PamUtils.FrequencyFormat

public class FrequencyFormat extends Object
A set of static functions for formatting frequency values in a common way, i.e. if it's relatively low, do it in Hz, it it's high, do it in kHz;
Author:
Doug Gillespie
  • Method Details

    • formatFrequency

      public static String formatFrequency(double frequency, boolean includeUnits)
      Format a frequency value.
      Parameters:
      frequency - frequency in Hz
      includeUnits - flag to include units (Hz or kHz)
      Returns:
      formatted string
    • formatFrequencyRange

      public static String formatFrequencyRange(double[] frequency, boolean includeUnits)
      Format a frequency range.
      Parameters:
      frequency - array of frequency values in Hz.
      includeUnits - flag to include units (Hz or kHz)
      Returns:
      formatted string
    • getFrequencyFormat

      public static FrequencyFormat getFrequencyFormat(double frequency)
      Get everything you need to format a frequency string in a standard way.
      Parameters:
      frequency -
      Returns:
      Frequency format object containing a format string for the number, a unit (Hz or kHz) and a scale factor to divide the raw Hz value down by (1 or 1000).
    • getNumberFormat

      public String getNumberFormat()
      Returns:
      the numberFormat
    • getUnitText

      public String getUnitText()
      Returns:
      the unitText
    • getScale

      public double getScale()
      Returns:
      the scale