public SymbolAndPower(string symbol, int power) { Ensure.NotNullOrEmpty(symbol, nameof(symbol)); Ensure.LessThan(power, 5, nameof(power)); Ensure.GreaterThan(power, -5, nameof(power)); // not sure about throwing here but I think it means something is wrong more often. this.Symbol = symbol; this.Power = power; }
public bool Equals(AnglePerUnitless other, AnglePerUnitless tolerance) { Ensure.GreaterThan(tolerance.radiansPerUnitless, 0, nameof(tolerance)); return(Math.Abs(this.radiansPerUnitless - other.radiansPerUnitless) < tolerance.radiansPerUnitless); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Energy"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Energy as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Energy"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Energy other, Energy tolerance) { Ensure.GreaterThan(tolerance.joules, 0, nameof(tolerance)); return(Math.Abs(this.joules - other.joules) < tolerance.joules); }
public bool Equals(MagneticFieldStrength other, MagneticFieldStrength tolerance) { Ensure.GreaterThan(tolerance.teslas, 0, nameof(tolerance)); return(Math.Abs(this.teslas - other.teslas) < tolerance.teslas); }
public bool Equals(Illuminance other, Illuminance tolerance) { Ensure.GreaterThan(tolerance.lux, 0, nameof(tolerance)); return(Math.Abs(this.lux - other.lux) < tolerance.lux); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.MassFlow"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same MassFlow as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.MassFlow"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(MassFlow other, MassFlow tolerance) { Ensure.GreaterThan(tolerance.kilogramsPerSecond, 0, nameof(tolerance)); return(Math.Abs(this.kilogramsPerSecond - other.kilogramsPerSecond) < tolerance.kilogramsPerSecond); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Capacitance"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Capacitance as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Capacitance"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Capacitance other, Capacitance tolerance) { Ensure.GreaterThan(tolerance.farads, 0, nameof(tolerance)); return(Math.Abs(this.farads - other.farads) < tolerance.farads); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Flexibility"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Flexibility as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Flexibility"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Flexibility other, Flexibility tolerance) { Ensure.GreaterThan(tolerance.metresPerNewton, 0, nameof(tolerance)); return(Math.Abs(this.metresPerNewton - other.metresPerNewton) < tolerance.metresPerNewton); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.AmountOfSubstance"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same AmountOfSubstance as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.AmountOfSubstance"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(AmountOfSubstance other, AmountOfSubstance tolerance) { Ensure.GreaterThan(tolerance.moles, 0, nameof(tolerance)); return(Math.Abs(this.moles - other.moles) < tolerance.moles); }
public bool Equals(Force other, Force tolerance) { Ensure.GreaterThan(tolerance.newtons, 0, nameof(tolerance)); return(Math.Abs(this.newtons - other.newtons) < tolerance.newtons); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Wavenumber"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Wavenumber as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Wavenumber"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Wavenumber other, Wavenumber tolerance) { Ensure.GreaterThan(tolerance.reciprocalMetres, 0, nameof(tolerance)); return(Math.Abs(this.reciprocalMetres - other.reciprocalMetres) < tolerance.reciprocalMetres); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.AngularAcceleration"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same AngularAcceleration as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.AngularAcceleration"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(AngularAcceleration other, AngularAcceleration tolerance) { Ensure.GreaterThan(tolerance.radiansPerSecondSquared, 0, nameof(tolerance)); return(Math.Abs(this.radiansPerSecondSquared - other.radiansPerSecondSquared) < tolerance.radiansPerSecondSquared); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Jerk"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Jerk as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Jerk"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Jerk other, Jerk tolerance) { Ensure.GreaterThan(tolerance.metresPerSecondCubed, 0, nameof(tolerance)); return(Math.Abs(this.metresPerSecondCubed - other.metresPerSecondCubed) < tolerance.metresPerSecondCubed); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Temperature"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Temperature as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Temperature"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Temperature other, Temperature tolerance) { Ensure.GreaterThan(tolerance.kelvin, 0, nameof(tolerance)); return(Math.Abs(this.kelvin - other.kelvin) < tolerance.kelvin); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Stiffness"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Stiffness as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Stiffness"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Stiffness other, Stiffness tolerance) { Ensure.GreaterThan(tolerance.newtonsPerMetre, 0, nameof(tolerance)); return(Math.Abs(this.newtonsPerMetre - other.newtonsPerMetre) < tolerance.newtonsPerMetre); }
public bool Equals(ElectricalConductance other, ElectricalConductance tolerance) { Ensure.GreaterThan(tolerance.siemens, 0, nameof(tolerance)); return(Math.Abs(this.siemens - other.siemens) < tolerance.siemens); }
public bool Equals(Area other, Area tolerance) { Ensure.GreaterThan(tolerance.squareMetres, 0, nameof(tolerance)); return(Math.Abs(this.squareMetres - other.squareMetres) < tolerance.squareMetres); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Data"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Data as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Data"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Data other, Data tolerance) { Ensure.GreaterThan(tolerance.bits, 0, nameof(tolerance)); return(Math.Abs(this.bits - other.bits) < tolerance.bits); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Speed"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Speed as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Speed"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Speed other, Speed tolerance) { Ensure.GreaterThan(tolerance.metresPerSecond, 0, nameof(tolerance)); return(Math.Abs(this.metresPerSecond - other.metresPerSecond) < tolerance.metresPerSecond); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Torque"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Torque as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Torque"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Torque other, Torque tolerance) { Ensure.GreaterThan(tolerance.newtonMetres, 0, nameof(tolerance)); return(Math.Abs(this.newtonMetres - other.newtonMetres) < tolerance.newtonMetres); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Momentum"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Momentum as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Momentum"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Momentum other, Momentum tolerance) { Ensure.GreaterThan(tolerance.newtonSecond, 0, nameof(tolerance)); return(Math.Abs(this.newtonSecond - other.newtonSecond) < tolerance.newtonSecond); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Pressure"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Pressure as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Pressure"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Pressure other, Pressure tolerance) { Ensure.GreaterThan(tolerance.pascals, 0, nameof(tolerance)); return(Math.Abs(this.pascals - other.pascals) < tolerance.pascals); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Density"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Density as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Density"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Density other, Density tolerance) { Ensure.GreaterThan(tolerance.kilogramsPerCubicMetre, 0, nameof(tolerance)); return(Math.Abs(this.kilogramsPerCubicMetre - other.kilogramsPerCubicMetre) < tolerance.kilogramsPerCubicMetre); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.AngularSpeed"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same AngularSpeed as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.AngularSpeed"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(AngularSpeed other, AngularSpeed tolerance) { Ensure.GreaterThan(tolerance.radiansPerSecond, 0, nameof(tolerance)); return(Math.Abs(this.radiansPerSecond - other.radiansPerSecond) < tolerance.radiansPerSecond); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.KinematicViscosity"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same KinematicViscosity as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.KinematicViscosity"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(KinematicViscosity other, KinematicViscosity tolerance) { Ensure.GreaterThan(tolerance.squareMetresPerSecond, 0, nameof(tolerance)); return(Math.Abs(this.squareMetresPerSecond - other.squareMetresPerSecond) < tolerance.squareMetresPerSecond); }
public bool Equals(Current other, Current tolerance) { Ensure.GreaterThan(tolerance.amperes, 0, nameof(tolerance)); return(Math.Abs(this.amperes - other.amperes) < tolerance.amperes); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Mass"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Mass as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Mass"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Mass other, Mass tolerance) { Ensure.GreaterThan(tolerance.kilograms, 0, nameof(tolerance)); return(Math.Abs(this.kilograms - other.kilograms) < tolerance.kilograms); }
public bool Equals(Frequency other, Frequency tolerance) { Ensure.GreaterThan(tolerance.hertz, 0, nameof(tolerance)); return(Math.Abs(this.hertz - other.hertz) < tolerance.hertz); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.CatalyticActivity"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same CatalyticActivity as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.CatalyticActivity"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(CatalyticActivity other, CatalyticActivity tolerance) { Ensure.GreaterThan(tolerance.katals, 0, nameof(tolerance)); return(Math.Abs(this.katals - other.katals) < tolerance.katals); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Angle"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Angle as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Angle"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(Angle other, Angle tolerance) { Ensure.GreaterThan(tolerance.radians, 0, nameof(tolerance)); return(Math.Abs(this.radians - other.radians) < tolerance.radians); }