-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAmountOfSubstance.g.cs
More file actions
57 lines (52 loc) · 3.79 KB
/
AmountOfSubstance.g.cs
File metadata and controls
57 lines (52 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) ktsu.dev
// All rights reserved.
// Licensed under the MIT license.
// <auto-generated />
namespace ktsu.Semantics.Quantities;
using System.Numerics;
/// <summary>
/// Magnitude (Vector0) quantity for the AmountOfSubstance dimension.
/// </summary>
/// <typeparam name="T">The numeric storage type.</typeparam>
public record AmountOfSubstance<T> : PhysicalQuantity<AmountOfSubstance<T>, T>, IVector0<AmountOfSubstance<T>, T>
where T : struct, INumber<T>
{
/// <summary>Gets a quantity with value zero.</summary>
public static AmountOfSubstance<T> Zero => Create(T.Zero);
/// <summary>
/// Creates a new <see cref="AmountOfSubstance{T}"/> from a value in Mole.
/// </summary>
/// <param name="value">The value in Mole.</param>
/// <returns>A new <see cref="AmountOfSubstance{T}"/> instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static AmountOfSubstance<T> FromMoles(T value) => Create(Vector0Guards.EnsureNonNegative(value, nameof(value)));
/// <summary>
/// Subtracts two AmountOfSubstance values, returning the absolute difference as a non-negative AmountOfSubstance.
/// Magnitude subtraction stays a magnitude (per the unified-vector model).
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static AmountOfSubstance<T> operator -(AmountOfSubstance<T> left, AmountOfSubstance<T> right) => Create(T.Abs(left.Quantity - right.Quantity));
/// <summary>
/// Divides AmountOfSubstance by Volume to produce Concentration.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static Concentration<T> operator /(AmountOfSubstance<T> left, Volume<T> right) => Divide<Concentration<T>>(left, right);
/// <summary>
/// Divides AmountOfSubstance by Concentration to produce Volume.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static Volume<T> operator /(AmountOfSubstance<T> left, Concentration<T> right) => Divide<Volume<T>>(left, right);
/// <summary>
/// Multiplies AmountOfSubstance by MolarMass to produce Mass.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static Mass<T> operator *(AmountOfSubstance<T> left, MolarMass<T> right) => Multiply<Mass<T>>(left, right);
/// <summary>
/// Divides AmountOfSubstance by Duration to produce CatalyticActivity.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static CatalyticActivity<T> operator /(AmountOfSubstance<T> left, Duration<T> right) => Divide<CatalyticActivity<T>>(left, right);
/// <summary>
/// Divides AmountOfSubstance by CatalyticActivity to produce Duration.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static Duration<T> operator /(AmountOfSubstance<T> left, CatalyticActivity<T> right) => Divide<Duration<T>>(left, right);
/// <summary>
/// Multiplies AmountOfSubstance by MolarEnergy to produce Energy.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static Energy<T> operator *(AmountOfSubstance<T> left, MolarEnergy<T> right) => Multiply<Energy<T>>(left, right);
};