Skip to content

Commit 6752b26

Browse files
committed
Removing equality methods/operators that do not accept a relative/absolute equality check.
1 parent 6cfc4c8 commit 6752b26

File tree

274 files changed

+189
-5090
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

274 files changed

+189
-5090
lines changed

Common/GeneratedCode/Quantities/Acceleration.Common.g.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -469,16 +469,6 @@ int CompareTo(Acceleration other)
469469
return _value.CompareTo(other.AsBaseNumericType(this.Unit));
470470
}
471471

472-
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")]
473-
public override bool Equals(object obj)
474-
{
475-
if(obj is null || !(obj is Acceleration))
476-
return false;
477-
478-
var objQuantity = (Acceleration)obj;
479-
return _value.Equals(objQuantity.AsBaseNumericType(this.Unit));
480-
}
481-
482472
/// <summary>
483473
/// <para>
484474
/// Compare equality to another Acceleration within the given absolute or relative tolerance.
@@ -530,20 +520,6 @@ public bool Equals(Acceleration other, double tolerance, ComparisonType comparis
530520
return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType);
531521
}
532522

533-
/// <summary>
534-
/// Compare equality to another Acceleration by specifying a max allowed difference.
535-
/// Note that it is advised against specifying zero difference, due to the nature
536-
/// of floating point operations and using System.Double internally.
537-
/// </summary>
538-
/// <param name="other">Other quantity to compare to.</param>
539-
/// <param name="maxError">Max error allowed.</param>
540-
/// <returns>True if the difference between the two values is not greater than the specified max.</returns>
541-
[Obsolete("Please use the Equals(Acceleration, double, ComparisonType) overload. This method will be removed in a future version.")]
542-
public bool Equals(Acceleration other, Acceleration maxError)
543-
{
544-
return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit);
545-
}
546-
547523
/// <summary>
548524
/// Returns the hash code for this instance.
549525
/// </summary>

Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -488,16 +488,6 @@ int CompareTo(AmountOfSubstance other)
488488
return _value.CompareTo(other.AsBaseNumericType(this.Unit));
489489
}
490490

491-
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")]
492-
public override bool Equals(object obj)
493-
{
494-
if(obj is null || !(obj is AmountOfSubstance))
495-
return false;
496-
497-
var objQuantity = (AmountOfSubstance)obj;
498-
return _value.Equals(objQuantity.AsBaseNumericType(this.Unit));
499-
}
500-
501491
/// <summary>
502492
/// <para>
503493
/// Compare equality to another AmountOfSubstance within the given absolute or relative tolerance.
@@ -549,20 +539,6 @@ public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType com
549539
return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType);
550540
}
551541

552-
/// <summary>
553-
/// Compare equality to another AmountOfSubstance by specifying a max allowed difference.
554-
/// Note that it is advised against specifying zero difference, due to the nature
555-
/// of floating point operations and using System.Double internally.
556-
/// </summary>
557-
/// <param name="other">Other quantity to compare to.</param>
558-
/// <param name="maxError">Max error allowed.</param>
559-
/// <returns>True if the difference between the two values is not greater than the specified max.</returns>
560-
[Obsolete("Please use the Equals(AmountOfSubstance, double, ComparisonType) overload. This method will be removed in a future version.")]
561-
public bool Equals(AmountOfSubstance other, AmountOfSubstance maxError)
562-
{
563-
return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit);
564-
}
565-
566542
/// <summary>
567543
/// Returns the hash code for this instance.
568544
/// </summary>

Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -297,16 +297,6 @@ int CompareTo(AmplitudeRatio other)
297297
return _value.CompareTo(other.AsBaseNumericType(this.Unit));
298298
}
299299

300-
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")]
301-
public override bool Equals(object obj)
302-
{
303-
if(obj is null || !(obj is AmplitudeRatio))
304-
return false;
305-
306-
var objQuantity = (AmplitudeRatio)obj;
307-
return _value.Equals(objQuantity.AsBaseNumericType(this.Unit));
308-
}
309-
310300
/// <summary>
311301
/// <para>
312302
/// Compare equality to another AmplitudeRatio within the given absolute or relative tolerance.
@@ -358,20 +348,6 @@ public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType compar
358348
return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType);
359349
}
360350

361-
/// <summary>
362-
/// Compare equality to another AmplitudeRatio by specifying a max allowed difference.
363-
/// Note that it is advised against specifying zero difference, due to the nature
364-
/// of floating point operations and using System.Double internally.
365-
/// </summary>
366-
/// <param name="other">Other quantity to compare to.</param>
367-
/// <param name="maxError">Max error allowed.</param>
368-
/// <returns>True if the difference between the two values is not greater than the specified max.</returns>
369-
[Obsolete("Please use the Equals(AmplitudeRatio, double, ComparisonType) overload. This method will be removed in a future version.")]
370-
public bool Equals(AmplitudeRatio other, AmplitudeRatio maxError)
371-
{
372-
return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit);
373-
}
374-
375351
/// <summary>
376352
/// Returns the hash code for this instance.
377353
/// </summary>

Common/GeneratedCode/Quantities/Angle.Common.g.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -487,16 +487,6 @@ int CompareTo(Angle other)
487487
return _value.CompareTo(other.AsBaseNumericType(this.Unit));
488488
}
489489

490-
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")]
491-
public override bool Equals(object obj)
492-
{
493-
if(obj is null || !(obj is Angle))
494-
return false;
495-
496-
var objQuantity = (Angle)obj;
497-
return _value.Equals(objQuantity.AsBaseNumericType(this.Unit));
498-
}
499-
500490
/// <summary>
501491
/// <para>
502492
/// Compare equality to another Angle within the given absolute or relative tolerance.
@@ -548,20 +538,6 @@ public bool Equals(Angle other, double tolerance, ComparisonType comparisonType)
548538
return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType);
549539
}
550540

551-
/// <summary>
552-
/// Compare equality to another Angle by specifying a max allowed difference.
553-
/// Note that it is advised against specifying zero difference, due to the nature
554-
/// of floating point operations and using System.Double internally.
555-
/// </summary>
556-
/// <param name="other">Other quantity to compare to.</param>
557-
/// <param name="maxError">Max error allowed.</param>
558-
/// <returns>True if the difference between the two values is not greater than the specified max.</returns>
559-
[Obsolete("Please use the Equals(Angle, double, ComparisonType) overload. This method will be removed in a future version.")]
560-
public bool Equals(Angle other, Angle maxError)
561-
{
562-
return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit);
563-
}
564-
565541
/// <summary>
566542
/// Returns the hash code for this instance.
567543
/// </summary>

Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -279,16 +279,6 @@ int CompareTo(ApparentEnergy other)
279279
return _value.CompareTo(other.AsBaseNumericType(this.Unit));
280280
}
281281

282-
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")]
283-
public override bool Equals(object obj)
284-
{
285-
if(obj is null || !(obj is ApparentEnergy))
286-
return false;
287-
288-
var objQuantity = (ApparentEnergy)obj;
289-
return _value.Equals(objQuantity.AsBaseNumericType(this.Unit));
290-
}
291-
292282
/// <summary>
293283
/// <para>
294284
/// Compare equality to another ApparentEnergy within the given absolute or relative tolerance.
@@ -340,20 +330,6 @@ public bool Equals(ApparentEnergy other, double tolerance, ComparisonType compar
340330
return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType);
341331
}
342332

343-
/// <summary>
344-
/// Compare equality to another ApparentEnergy by specifying a max allowed difference.
345-
/// Note that it is advised against specifying zero difference, due to the nature
346-
/// of floating point operations and using System.Double internally.
347-
/// </summary>
348-
/// <param name="other">Other quantity to compare to.</param>
349-
/// <param name="maxError">Max error allowed.</param>
350-
/// <returns>True if the difference between the two values is not greater than the specified max.</returns>
351-
[Obsolete("Please use the Equals(ApparentEnergy, double, ComparisonType) overload. This method will be removed in a future version.")]
352-
public bool Equals(ApparentEnergy other, ApparentEnergy maxError)
353-
{
354-
return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit);
355-
}
356-
357333
/// <summary>
358334
/// Returns the hash code for this instance.
359335
/// </summary>

Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,6 @@ int CompareTo(ApparentPower other)
298298
return _value.CompareTo(other.AsBaseNumericType(this.Unit));
299299
}
300300

301-
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")]
302-
public override bool Equals(object obj)
303-
{
304-
if(obj is null || !(obj is ApparentPower))
305-
return false;
306-
307-
var objQuantity = (ApparentPower)obj;
308-
return _value.Equals(objQuantity.AsBaseNumericType(this.Unit));
309-
}
310-
311301
/// <summary>
312302
/// <para>
313303
/// Compare equality to another ApparentPower within the given absolute or relative tolerance.
@@ -359,20 +349,6 @@ public bool Equals(ApparentPower other, double tolerance, ComparisonType compari
359349
return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType);
360350
}
361351

362-
/// <summary>
363-
/// Compare equality to another ApparentPower by specifying a max allowed difference.
364-
/// Note that it is advised against specifying zero difference, due to the nature
365-
/// of floating point operations and using System.Double internally.
366-
/// </summary>
367-
/// <param name="other">Other quantity to compare to.</param>
368-
/// <param name="maxError">Max error allowed.</param>
369-
/// <returns>True if the difference between the two values is not greater than the specified max.</returns>
370-
[Obsolete("Please use the Equals(ApparentPower, double, ComparisonType) overload. This method will be removed in a future version.")]
371-
public bool Equals(ApparentPower other, ApparentPower maxError)
372-
{
373-
return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit);
374-
}
375-
376352
/// <summary>
377353
/// Returns the hash code for this instance.
378354
/// </summary>

Common/GeneratedCode/Quantities/Area.Common.g.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -469,16 +469,6 @@ int CompareTo(Area other)
469469
return _value.CompareTo(other.AsBaseNumericType(this.Unit));
470470
}
471471

472-
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")]
473-
public override bool Equals(object obj)
474-
{
475-
if(obj is null || !(obj is Area))
476-
return false;
477-
478-
var objQuantity = (Area)obj;
479-
return _value.Equals(objQuantity.AsBaseNumericType(this.Unit));
480-
}
481-
482472
/// <summary>
483473
/// <para>
484474
/// Compare equality to another Area within the given absolute or relative tolerance.
@@ -530,20 +520,6 @@ public bool Equals(Area other, double tolerance, ComparisonType comparisonType)
530520
return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType);
531521
}
532522

533-
/// <summary>
534-
/// Compare equality to another Area by specifying a max allowed difference.
535-
/// Note that it is advised against specifying zero difference, due to the nature
536-
/// of floating point operations and using System.Double internally.
537-
/// </summary>
538-
/// <param name="other">Other quantity to compare to.</param>
539-
/// <param name="maxError">Max error allowed.</param>
540-
/// <returns>True if the difference between the two values is not greater than the specified max.</returns>
541-
[Obsolete("Please use the Equals(Area, double, ComparisonType) overload. This method will be removed in a future version.")]
542-
public bool Equals(Area other, Area maxError)
543-
{
544-
return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit);
545-
}
546-
547523
/// <summary>
548524
/// Returns the hash code for this instance.
549525
/// </summary>

Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,6 @@ int CompareTo(AreaDensity other)
241241
return _value.CompareTo(other.AsBaseNumericType(this.Unit));
242242
}
243243

244-
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")]
245-
public override bool Equals(object obj)
246-
{
247-
if(obj is null || !(obj is AreaDensity))
248-
return false;
249-
250-
var objQuantity = (AreaDensity)obj;
251-
return _value.Equals(objQuantity.AsBaseNumericType(this.Unit));
252-
}
253-
254244
/// <summary>
255245
/// <para>
256246
/// Compare equality to another AreaDensity within the given absolute or relative tolerance.
@@ -302,20 +292,6 @@ public bool Equals(AreaDensity other, double tolerance, ComparisonType compariso
302292
return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType);
303293
}
304294

305-
/// <summary>
306-
/// Compare equality to another AreaDensity by specifying a max allowed difference.
307-
/// Note that it is advised against specifying zero difference, due to the nature
308-
/// of floating point operations and using System.Double internally.
309-
/// </summary>
310-
/// <param name="other">Other quantity to compare to.</param>
311-
/// <param name="maxError">Max error allowed.</param>
312-
/// <returns>True if the difference between the two values is not greater than the specified max.</returns>
313-
[Obsolete("Please use the Equals(AreaDensity, double, ComparisonType) overload. This method will be removed in a future version.")]
314-
public bool Equals(AreaDensity other, AreaDensity maxError)
315-
{
316-
return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit);
317-
}
318-
319295
/// <summary>
320296
/// Returns the hash code for this instance.
321297
/// </summary>

Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -336,16 +336,6 @@ int CompareTo(AreaMomentOfInertia other)
336336
return _value.CompareTo(other.AsBaseNumericType(this.Unit));
337337
}
338338

339-
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")]
340-
public override bool Equals(object obj)
341-
{
342-
if(obj is null || !(obj is AreaMomentOfInertia))
343-
return false;
344-
345-
var objQuantity = (AreaMomentOfInertia)obj;
346-
return _value.Equals(objQuantity.AsBaseNumericType(this.Unit));
347-
}
348-
349339
/// <summary>
350340
/// <para>
351341
/// Compare equality to another AreaMomentOfInertia within the given absolute or relative tolerance.
@@ -397,20 +387,6 @@ public bool Equals(AreaMomentOfInertia other, double tolerance, ComparisonType c
397387
return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType);
398388
}
399389

400-
/// <summary>
401-
/// Compare equality to another AreaMomentOfInertia by specifying a max allowed difference.
402-
/// Note that it is advised against specifying zero difference, due to the nature
403-
/// of floating point operations and using System.Double internally.
404-
/// </summary>
405-
/// <param name="other">Other quantity to compare to.</param>
406-
/// <param name="maxError">Max error allowed.</param>
407-
/// <returns>True if the difference between the two values is not greater than the specified max.</returns>
408-
[Obsolete("Please use the Equals(AreaMomentOfInertia, double, ComparisonType) overload. This method will be removed in a future version.")]
409-
public bool Equals(AreaMomentOfInertia other, AreaMomentOfInertia maxError)
410-
{
411-
return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit);
412-
}
413-
414390
/// <summary>
415391
/// Returns the hash code for this instance.
416392
/// </summary>

0 commit comments

Comments
 (0)