// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

// THIS FILE WAS AUTO-GENERATED BY ./wpiunits/generate_units.py. DO NOT MODIFY

package org.wpilib.units.measure;

import static org.wpilib.units.Units.*;
import org.wpilib.units.*;

@SuppressWarnings({"unchecked", "cast", "checkstyle"})
public record Frequency(double magnitude, double baseUnitMagnitude, FrequencyUnit unit) implements Measure<FrequencyUnit> {
  /**
   * For doing math with measures of a known dimension but an unknown unit. Most users should use
   * {@link FrequencyUnit#of(double)} on a known unit from {@link Units} instead of calling this method.
   * @param magnitude the magnitude of the measurement in terms of the given unit
   * @param unit the unit of the measurement
   * @return a measurement object
   */
  public static  Frequency ofRelativeUnits(double magnitude, FrequencyUnit unit) {
    return new Frequency(magnitude, unit.toBaseUnits(magnitude), unit);
  }

  /**
   * For doing math with measures of a known dimension but an unknown unit. Most users should use
   * {@link FrequencyUnit#of(double)} on a known unit from {@link Units} instead of calling this method.
   * @param baseUnitMagnitude the magnitude of the measurement in terms of the given unit's base unit
   * @param unit the unit of the measurement
   * @return a measurement object
   */
  public static  Frequency ofBaseUnits(double baseUnitMagnitude, FrequencyUnit unit) {
    return new Frequency(unit.fromBaseUnits(baseUnitMagnitude), baseUnitMagnitude, unit);
  }

  @Override
  public FrequencyUnit baseUnit() { return (FrequencyUnit) unit().getBaseUnit(); }

  @Override
  public double in(FrequencyUnit unit) {
    return unit.fromBaseUnits(baseUnitMagnitude());
  }

  @Override
  @SuppressWarnings("rawtypes")
  public boolean equals(Object object) {
    return object instanceof Frequency m && isEquivalent(m);
  }

  @Override
  public Frequency unaryMinus() {
    return (Frequency) unit().ofBaseUnits(0 - baseUnitMagnitude());
  }

  @Override
  public Frequency plus(Measure<? extends FrequencyUnit> other) {
    return (Frequency) unit().ofBaseUnits(baseUnitMagnitude() + other.baseUnitMagnitude());
  }

  @Override
  public Frequency minus(Measure<? extends FrequencyUnit> other) {
    return (Frequency) unit().ofBaseUnits(baseUnitMagnitude() - other.baseUnitMagnitude());
  }

  @Override
  public Frequency times(double multiplier) {
    return (Frequency) unit().ofBaseUnits(baseUnitMagnitude() * multiplier);
  }

  @Override
  public Frequency div(double divisor) {
    return (Frequency) unit().ofBaseUnits(baseUnitMagnitude() / divisor);
  }


  @Override
  public Mult<FrequencyUnit, AccelerationUnit<?>> times(Acceleration<?> multiplier) {
    return (Mult<FrequencyUnit, AccelerationUnit<?>>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, AccelerationUnit<?>> div(Acceleration<?> divisor) {
    return (Per<FrequencyUnit, AccelerationUnit<?>>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, AccelerationUnit<?>> per(AccelerationUnit<?> divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public AngularVelocity times(Angle multiplier) {
    return RadiansPerSecond.of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }

  @Override
  public Per<FrequencyUnit, AngleUnit> div(Angle divisor) {
    return (Per<FrequencyUnit, AngleUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, AngleUnit> per(AngleUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, AngularAccelerationUnit> times(AngularAcceleration multiplier) {
    return (Mult<FrequencyUnit, AngularAccelerationUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, AngularAccelerationUnit> div(AngularAcceleration divisor) {
    return (Per<FrequencyUnit, AngularAccelerationUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, AngularAccelerationUnit> per(AngularAccelerationUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, AngularMomentumUnit> times(AngularMomentum multiplier) {
    return (Mult<FrequencyUnit, AngularMomentumUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, AngularMomentumUnit> div(AngularMomentum divisor) {
    return (Per<FrequencyUnit, AngularMomentumUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, AngularMomentumUnit> per(AngularMomentumUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public AngularAcceleration times(AngularVelocity multiplier) {
    return RadiansPerSecondPerSecond.of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }

  @Override
  public Per<FrequencyUnit, AngularVelocityUnit> div(AngularVelocity divisor) {
    return (Per<FrequencyUnit, AngularVelocityUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, AngularVelocityUnit> per(AngularVelocityUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, CurrentUnit> times(Current multiplier) {
    return (Mult<FrequencyUnit, CurrentUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, CurrentUnit> div(Current divisor) {
    return (Per<FrequencyUnit, CurrentUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, CurrentUnit> per(CurrentUnit divisorUnit) {
    return div(divisorUnit.one());
  }

  @Override
  public Frequency div(Dimensionless divisor) {
    return (Frequency) Hertz.of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
  }

  @Override
  public Frequency times(Dimensionless multiplier) {
    return (Frequency) Hertz.of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }


  @Override
  public LinearVelocity times(Distance multiplier) {
    return MetersPerSecond.of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }

  @Override
  public Per<FrequencyUnit, DistanceUnit> div(Distance divisor) {
    return (Per<FrequencyUnit, DistanceUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, DistanceUnit> per(DistanceUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, EnergyUnit> times(Energy multiplier) {
    return (Mult<FrequencyUnit, EnergyUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, EnergyUnit> div(Energy divisor) {
    return (Per<FrequencyUnit, EnergyUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, EnergyUnit> per(EnergyUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, ForceUnit> times(Force multiplier) {
    return (Mult<FrequencyUnit, ForceUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, ForceUnit> div(Force divisor) {
    return (Per<FrequencyUnit, ForceUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, ForceUnit> per(ForceUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, FrequencyUnit> times(Frequency multiplier) {
    return (Mult<FrequencyUnit, FrequencyUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Dimensionless div(Frequency divisor) {
    return Value.of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
  }

  @Override
  public Dimensionless per(FrequencyUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, LinearAccelerationUnit> times(LinearAcceleration multiplier) {
    return (Mult<FrequencyUnit, LinearAccelerationUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, LinearAccelerationUnit> div(LinearAcceleration divisor) {
    return (Per<FrequencyUnit, LinearAccelerationUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, LinearAccelerationUnit> per(LinearAccelerationUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, LinearMomentumUnit> times(LinearMomentum multiplier) {
    return (Mult<FrequencyUnit, LinearMomentumUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, LinearMomentumUnit> div(LinearMomentum divisor) {
    return (Per<FrequencyUnit, LinearMomentumUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, LinearMomentumUnit> per(LinearMomentumUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public LinearAcceleration times(LinearVelocity multiplier) {
    return MetersPerSecondPerSecond.of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }

  @Override
  public Per<FrequencyUnit, LinearVelocityUnit> div(LinearVelocity divisor) {
    return (Per<FrequencyUnit, LinearVelocityUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, LinearVelocityUnit> per(LinearVelocityUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, MassUnit> times(Mass multiplier) {
    return (Mult<FrequencyUnit, MassUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, MassUnit> div(Mass divisor) {
    return (Per<FrequencyUnit, MassUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, MassUnit> per(MassUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, MomentOfInertiaUnit> times(MomentOfInertia multiplier) {
    return (Mult<FrequencyUnit, MomentOfInertiaUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, MomentOfInertiaUnit> div(MomentOfInertia divisor) {
    return (Per<FrequencyUnit, MomentOfInertiaUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, MomentOfInertiaUnit> per(MomentOfInertiaUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, MultUnit<?, ?>> times(Mult<?, ?> multiplier) {
    return (Mult<FrequencyUnit, MultUnit<?, ?>>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, MultUnit<?, ?>> div(Mult<?, ?> divisor) {
    return (Per<FrequencyUnit, MultUnit<?, ?>>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, MultUnit<?, ?>> per(MultUnit<?, ?> divisorUnit) {
    return div(divisorUnit.ofNative(1));
  }


  @Override
  public Mult<FrequencyUnit, PerUnit<?, ?>> times(Per<?, ?> multiplier) {
    return (Mult<FrequencyUnit, PerUnit<?, ?>>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, PerUnit<?, ?>> div(Per<?, ?> divisor) {
    return (Per<FrequencyUnit, PerUnit<?, ?>>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, PerUnit<?, ?>> per(PerUnit<?, ?> divisorUnit) {
    return div(divisorUnit.ofNative(1));
  }


  @Override
  public Mult<FrequencyUnit, PowerUnit> times(Power multiplier) {
    return (Mult<FrequencyUnit, PowerUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, PowerUnit> div(Power divisor) {
    return (Per<FrequencyUnit, PowerUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, PowerUnit> per(PowerUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, ResistanceUnit> times(Resistance multiplier) {
    return (Mult<FrequencyUnit, ResistanceUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, ResistanceUnit> div(Resistance divisor) {
    return (Per<FrequencyUnit, ResistanceUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, ResistanceUnit> per(ResistanceUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, TemperatureUnit> times(Temperature multiplier) {
    return (Mult<FrequencyUnit, TemperatureUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, TemperatureUnit> div(Temperature divisor) {
    return (Per<FrequencyUnit, TemperatureUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, TemperatureUnit> per(TemperatureUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Dimensionless times(Time multiplier) {
    return Value.of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }

  @Override
  public Velocity<FrequencyUnit> div(Time divisor) {
    return VelocityUnit.combine(unit(), divisor.unit()).ofBaseUnits(baseUnitMagnitude() / divisor.baseUnitMagnitude());
  }

  @Override
  public Velocity<FrequencyUnit> per(TimeUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, TorqueUnit> times(Torque multiplier) {
    return (Mult<FrequencyUnit, TorqueUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, TorqueUnit> div(Torque divisor) {
    return (Per<FrequencyUnit, TorqueUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, TorqueUnit> per(TorqueUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, VelocityUnit<?>> times(Velocity<?> multiplier) {
    return (Mult<FrequencyUnit, VelocityUnit<?>>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, VelocityUnit<?>> div(Velocity<?> divisor) {
    return (Per<FrequencyUnit, VelocityUnit<?>>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, VelocityUnit<?>> per(VelocityUnit<?> divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<FrequencyUnit, VoltageUnit> times(Voltage multiplier) {
    return (Mult<FrequencyUnit, VoltageUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<FrequencyUnit, VoltageUnit> div(Voltage divisor) {
    return (Per<FrequencyUnit, VoltageUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<FrequencyUnit, VoltageUnit> per(VoltageUnit divisorUnit) {
    return div(divisorUnit.one());
  }
/** Converts this frequency to the time period between cycles. */
public Time asPeriod() { return Seconds.of(1 / baseUnitMagnitude()); }
}
