Struct Literal<T>
A Boolean Literal.
public readonly struct Literal<T> : IEquatable<Literal<T>> where T : IEquatable<T>
Type Parameters
T
The underlying type used to identify/compare Literals.
- Implements
-
IEquatable<Literal<T>>
- Inherited Members
Constructors
Literal(T, bool)
Creates a Literal.
public Literal(T value, bool negated = false)
Parameters
value
TThe underlying value used to identify/compare Literals.
negated
boolIndicates whether this Literal has been negated.
Properties
Negated
Indicates whether this Literal has been negated.
public bool Negated { get; }
Property Value
Value
The underlying value used to identify/compare Literals.
public T Value { get; }
Property Value
- T
Methods
ConflictsWith(Literal<T>)
Checks whether this Literal conflicts with the given literal
.
public bool ConflictsWith(Literal<T> literal)
Parameters
literal
Literal<T>
Returns
Equals(Literal<T>)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Literal<T> other)
Parameters
other
Literal<T>An object to compare with this object.
Returns
- bool
true if the current object is equal to the
other
parameter; otherwise, false.
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
obj
objectAnother object to compare to.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
IsPure(IEnumerable<Literal<T>>)
Checks whether this Literal conflicts with any of the given literals
.
public bool IsPure(IEnumerable<Literal<T>> literals)
Parameters
literals
IEnumerable<Literal<T>>
Returns
Negate()
Returns a negated copy of this Literal.
public Literal<T> Negate()
Returns
- Literal<T>
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
Operators
operator &(Literal<T>, Literal<T>)
Creates a Formula<T> consisting of two Clause<T>s, each containing a single Literal<T>.
public static Formula<T> operator &(Literal<T> literal1, Literal<T> literal2)
Parameters
literal1
Literal<T>The Literal in the first Clause.
literal2
Literal<T>The Literal in the second Clause.
Returns
- Formula<T>
operator |(Literal<T>, Literal<T>)
Creates a Clause<T> consisting of two Literal<T>s.
public static Clause<T> operator |(Literal<T> literal1, Literal<T> literal2)
Parameters
literal1
Literal<T>The first Literal in the Clause.
literal2
Literal<T>The second Literal in the Clause.
Returns
- Clause<T>
operator ==(Literal<T>, Literal<T>)
public static bool operator ==(Literal<T> left, Literal<T> right)
Parameters
Returns
implicit operator Clause<T>(Literal<T>)
Creates a Clause<T> consisting of a single Literal<T>.
public static implicit operator Clause<T>(Literal<T> literal)
Parameters
literal
Literal<T>The single Literal in the Clause.
Returns
- Clause<T>
implicit operator Literal<T>(T)
Creates a Literal<T>.
public static implicit operator Literal<T>(T value)
Parameters
value
TThe underlying value used to identify/compare Literals.
Returns
- Literal<T>
operator !=(Literal<T>, Literal<T>)
public static bool operator !=(Literal<T> left, Literal<T> right)
Parameters
Returns
operator !(Literal<T>)
Returns a negated copy of this Literal.
public static Literal<T> operator !(Literal<T> literal)
Parameters
literal
Literal<T>
Returns
- Literal<T>