Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions OnixLabs.Core/IValueComparable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,54 +20,54 @@ namespace OnixLabs.Core;
/// Defines an extension to the default <see cref="IComparable{T}"/> and <see cref="IComparable"/> interfaces,
/// including equality, inequality, greater than, greater than or equal, less than, and less than or equal operators.
/// </summary>
/// <typeparam name="T">The underlying type of the objects to compare.</typeparam>
public interface IValueComparable<in T> : IComparable<T>, IComparable where T : IValueComparable<T>
/// <typeparam name="TSelf">The underlying type of the objects to compare.</typeparam>
public interface IValueComparable<in TSelf> : IComparable<TSelf>, IComparable where TSelf : IValueComparable<TSelf>
{
/// <summary>
/// Performs an equality comparison between two object instances.
/// </summary>
/// <param name="left">The left-hand instance to compare.</param>
/// <param name="right">The right-hand instance to compare.</param>
/// <returns>Returns <see langword="true"/> if the left-hand instance is equal to the right-hand instance; otherwise, <see langword="false"/>.</returns>
public static abstract bool operator ==(T left, T right);
public static abstract bool operator ==(TSelf left, TSelf right);

/// <summary>
/// Performs an inequality comparison between two object instances.
/// </summary>
/// <param name="left">The left-hand instance to compare.</param>
/// <param name="right">The right-hand instance to compare.</param>
/// <returns>Returns <see langword="true"/> if the left-hand instance is not equal to the right-hand instance; otherwise, <see langword="false"/>.</returns>
public static abstract bool operator !=(T left, T right);
public static abstract bool operator !=(TSelf left, TSelf right);

/// <summary>
/// Performs a greater than comparison between two object instances.
/// </summary>
/// <param name="left">The left-hand instance to compare.</param>
/// <param name="right">The right-hand instance to compare.</param>
/// <returns>Returns <see langword="true"/> if the left-hand instance is greater than the right-hand instance; otherwise, <see langword="false"/>.</returns>
public static abstract bool operator >(T left, T right);
public static abstract bool operator >(TSelf left, TSelf right);

/// <summary>
/// Performs a greater than or equal comparison between two object instances.
/// </summary>
/// <param name="left">The left-hand instance to compare.</param>
/// <param name="right">The right-hand instance to compare.</param>
/// <returns>Returns <see langword="true"/> if the left-hand instance is greater than or equal to the right-hand instance; otherwise, <see langword="false"/>.</returns>
public static abstract bool operator >=(T left, T right);
public static abstract bool operator >=(TSelf left, TSelf right);

/// <summary>
/// Performs a less than comparison between two object instances.
/// </summary>
/// <param name="left">The left-hand instance to compare.</param>
/// <param name="right">The right-hand instance to compare.</param>
/// <returns>Returns <see langword="true"/> if the left-hand instance is less than the right-hand instance; otherwise, <see langword="false"/>.</returns>
public static abstract bool operator <(T left, T right);
public static abstract bool operator <(TSelf left, TSelf right);

/// <summary>
/// Performs a less than or equal comparison between two object instances.
/// </summary>
/// <param name="left">The left-hand instance to compare.</param>
/// <param name="right">The right-hand instance to compare.</param>
/// <returns>Returns <see langword="true"/> if the left-hand instance is less than or equal to the right-hand instance; otherwise, <see langword="false"/>.</returns>
public static abstract bool operator <=(T left, T right);
public static abstract bool operator <=(TSelf left, TSelf right);
}
8 changes: 4 additions & 4 deletions OnixLabs.Core/IValueEquatable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ namespace OnixLabs.Core;
/// <summary>
/// Defines an extension to the default <see cref="IEquatable{T}"/> interface, including equality and inequality operators.
/// </summary>
/// <typeparam name="T">The underlying type of the objects to compare.</typeparam>
public interface IValueEquatable<T> : IEquatable<T> where T : IValueEquatable<T>
/// <typeparam name="TSelf">The underlying type of the objects to compare.</typeparam>
public interface IValueEquatable<TSelf> : IEquatable<TSelf> where TSelf : IValueEquatable<TSelf>
{
/// <summary>
/// Performs an equality comparison between two object instances.
/// </summary>
/// <param name="left">The left-hand instance to compare.</param>
/// <param name="right">The right-hand instance to compare.</param>
/// <returns>Returns <see langword="true"/> if the left-hand instance is equal to the right-hand instance; otherwise, <see langword="false"/>.</returns>
public static abstract bool operator ==(T? left, T? right);
public static abstract bool operator ==(TSelf? left, TSelf? right);

/// <summary>
/// Performs an inequality comparison between two object instances.
/// </summary>
/// <param name="left">The left-hand instance to compare.</param>
/// <param name="right">The right-hand instance to compare.</param>
/// <returns>Returns <see langword="true"/> if the left-hand instance is not equal to the right-hand instance; otherwise, <see langword="false"/>.</returns>
public static abstract bool operator !=(T? left, T? right);
public static abstract bool operator !=(TSelf? left, TSelf? right);
}
2 changes: 1 addition & 1 deletion OnixLabs.Core/Text/IBaseValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ public interface IBaseValue : IBinaryConvertible, ISpanFormattable
/// <summary>
/// Defines a generic base encoding representation.
/// </summary>
public interface IBaseValue<T> : IValueEquatable<T>, ISpanParsable<T>, IBaseValue where T : struct, IBaseValue<T>;
public interface IBaseValue<TSelf> : IValueEquatable<TSelf>, ISpanParsable<TSelf>, IBaseValue where TSelf : struct, IBaseValue<TSelf>;
1 change: 1 addition & 0 deletions OnixLabs.Playground/OnixLabs.Playground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<ProjectReference Include="..\OnixLabs.Numerics\OnixLabs.Numerics.csproj"/>
<ProjectReference Include="..\OnixLabs.Security.Cryptography\OnixLabs.Security.Cryptography.csproj"/>
<ProjectReference Include="..\OnixLabs.Security\OnixLabs.Security.csproj"/>
<ProjectReference Include="..\OnixLabs.Units\OnixLabs.Units.csproj" />
<Using Include="OnixLabs.Core.Preconditions" Static="True"/>
</ItemGroup>
</Project>
Loading