mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 19:28:48 +00:00
parent
dee28392e3
commit
c063ef6af4
@ -5,75 +5,6 @@
|
||||
/// </summary>
|
||||
public static class BooleanExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Performs logical AND on this <see cref="bool" /> and another <see cref="bool" />.
|
||||
/// </summary>
|
||||
/// <param name="value">The boolean.</param>
|
||||
/// <param name="comparison">The boolean comparator.</param>
|
||||
/// <returns>
|
||||
/// Returns <see langword="true" /> if <paramref name="value" /> AND <paramref name="comparison" />
|
||||
/// evaluate to <see langword="true" />, or <see langword="false" /> otherwise.
|
||||
/// </returns>
|
||||
public static bool And(this bool value, bool comparison)
|
||||
{
|
||||
return value && comparison;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs logical NAND on this <see cref="bool" /> and another <see cref="bool" />.
|
||||
/// </summary>
|
||||
/// <param name="value">The boolean.</param>
|
||||
/// <param name="comparison">The boolean comparator.</param>
|
||||
/// <returns>
|
||||
/// Returns <see langword="true" /> if <paramref name="value" /> NAND <paramref name="comparison" />
|
||||
/// evaluate to <see langword="true" />, or <see langword="false" /> otherwise.
|
||||
/// </returns>
|
||||
public static bool NAnd(this bool value, bool comparison)
|
||||
{
|
||||
return !(value && comparison);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs logical NOR on this <see cref="bool" /> and another <see cref="bool" />.
|
||||
/// </summary>
|
||||
/// <param name="value">The boolean.</param>
|
||||
/// <param name="comparison">The boolean comparator.</param>
|
||||
/// <returns>
|
||||
/// Returns <see langword="true" /> if <paramref name="value" /> NOR <paramref name="comparison" />
|
||||
/// evaluate to <see langword="true" />, or <see langword="false" /> otherwise.
|
||||
/// </returns>
|
||||
public static bool NOr(this bool value, bool comparison)
|
||||
{
|
||||
return !(value || comparison);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs logical NOT on this <see cref="bool" />.
|
||||
/// </summary>
|
||||
/// <param name="value">The boolean.</param>
|
||||
/// <returns>
|
||||
/// Returns <see langword="true" /> if <paramref name="value" /> is <see langword="false" />,
|
||||
/// or <see langword="false" /> otherwise.
|
||||
/// </returns>
|
||||
public static bool Not(this bool value)
|
||||
{
|
||||
return !value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs logical OR on this <see cref="bool" /> and another <see cref="bool" />.
|
||||
/// </summary>
|
||||
/// <param name="value">The boolean.</param>
|
||||
/// <param name="comparison">The boolean comparator.</param>
|
||||
/// <returns>
|
||||
/// Returns <see langword="true" /> if <paramref name="value" /> OR <paramref name="comparison" />
|
||||
/// evaluate to <see langword="true" />, or <see langword="false" /> otherwise.
|
||||
/// </returns>
|
||||
public static bool Or(this bool value, bool comparison)
|
||||
{
|
||||
return value || comparison;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of this boolean as represented by <see cref="byte" />.
|
||||
/// </summary>
|
||||
@ -113,33 +44,5 @@
|
||||
{
|
||||
return value.ToInt32();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs logical XNOR on this <see cref="bool" /> and another <see cref="bool" />.
|
||||
/// </summary>
|
||||
/// <param name="value">The boolean.</param>
|
||||
/// <param name="comparison">The boolean comparator.</param>
|
||||
/// <returns>
|
||||
/// Returns <see langword="true" /> if <paramref name="value" /> XNOR <paramref name="comparison" />
|
||||
/// evaluate to <see langword="true" />, or <see langword="false" /> otherwise.
|
||||
/// </returns>
|
||||
public static bool XNOr(this bool value, bool comparison)
|
||||
{
|
||||
return !(value ^ comparison);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs logical XOR on this <see cref="bool" /> and another <see cref="bool" />.
|
||||
/// </summary>
|
||||
/// <param name="value">The boolean.</param>
|
||||
/// <param name="comparison">The boolean comparator.</param>
|
||||
/// <returns>
|
||||
/// Returns <see langword="true" /> if <paramref name="value" /> XOR <paramref name="comparison" />
|
||||
/// evaluate to <see langword="true" />, or <see langword="false" /> otherwise.
|
||||
/// </returns>
|
||||
public static bool XOr(this bool value, bool comparison)
|
||||
{
|
||||
return value ^ comparison;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user