Table of Contents

Class BooleanResultBase<TMetadata>

Namespace
Motiv
Assembly
Motiv.dll

Represents a base class for boolean results with metadata.

public abstract class BooleanResultBase<TMetadata> : BooleanResultBase, IEquatable<BooleanResultBase>, IEquatable<bool>

Type Parameters

TMetadata

The type of the metadata associated with the boolean result.

Inheritance
BooleanResultBase<TMetadata>
Implements
Derived
Inherited Members
Extension Methods

Properties

CausesWithValues

Gets the underlying causes with metadata that contribute to this result.

public abstract IEnumerable<BooleanResultBase<TMetadata>> CausesWithValues { get; }

Property Value

IEnumerable<BooleanResultBase<TMetadata>>

MetadataTier

Gets the metadata tree associated with this result.

public abstract MetadataNode<TMetadata> MetadataTier { get; }

Property Value

MetadataNode<TMetadata>

RootValues

Gets the metadata yielded by all results that evaluated.

public IEnumerable<TMetadata> RootValues { get; }

Property Value

IEnumerable<TMetadata>

Remarks

Materialised on the first read and answered from that array thereafter, as its two siblings RootAssertions and AllRootAssertions already were — a result cannot change once evaluated, which is the premise all three rest on. It was the one root projection without a cache, so every read re-folded the tier tree that ticket #189 had just made the only reader of (ticket #193).

The alternative was to hoist the walk's memo onto MetadataNode<TMetadata>, beside the Underlying and Resolved it already caches. That is sound but a worse trade: the memo holds an array per node, and over a fully-causal chain the tier tree's arrays sum to the square of the chain — retained for the lifetime of the result rather than dropped when the walk ends. Caching here retains one array per result that was actually asked, which is the trade the siblings already make.

UnderlyingMetadataSources

Gets the underlying BooleanResultBases that are the sources of the Values.

public IEnumerable<BooleanResultBase<TMetadata>> UnderlyingMetadataSources { get; }

Property Value

IEnumerable<BooleanResultBase<TMetadata>>

Remarks

Empty for a result with no causal values — a leaf has nothing underlying it, so its own values are reached through Values, not through this property.

UnderlyingWithValues

Gets the underlying boolean results with metadata that contribute to this result.

public abstract IEnumerable<BooleanResultBase<TMetadata>> UnderlyingWithValues { get; }

Property Value

IEnumerable<BooleanResultBase<TMetadata>>

Values

Gets the metadata/assertions yielded by results that caused the outcome.

public IEnumerable<TMetadata> Values { get; }

Property Value

IEnumerable<TMetadata>

Methods

And(BooleanResultBase<TMetadata>)

Performs a logical AND operation between the current BooleanResultBase instance and another BooleanResultBase instance.

public BooleanResultBase<TMetadata> And(BooleanResultBase<TMetadata> right)

Parameters

right BooleanResultBase<TMetadata>

The other boolean result instance to perform the logical AND operation with.

Returns

BooleanResultBase<TMetadata>

A new boolean result instance representing the result of the logical AND operation.

AndAlso(BooleanResultBase<TMetadata>)

Performs a conditional AND operation between the current BooleanResultBase instance and another BooleanResultBase instance. This will short-circuit the evaluation of the right operand if the left operand is not satisfied.

public BooleanResultBase<TMetadata> AndAlso(BooleanResultBase<TMetadata> right)

Parameters

right BooleanResultBase<TMetadata>

The other boolean result instance to perform the logical AND operation with.

Returns

BooleanResultBase<TMetadata>

A new boolean result instance representing the result of the logical AND operation.

Not()

Returns a new instance of Motiv.Not.NotBooleanOperationResult<TMetadata> that represents the logical negation of the current instance.

public BooleanResultBase<TMetadata> Not()

Returns

BooleanResultBase<TMetadata>

A new instance of Motiv.Not.NotBooleanOperationResult<TMetadata> that represents the logical negation of the current instance.

Or(BooleanResultBase<TMetadata>)

Performs a logical OR operation between the current BooleanResultBase instance and another BooleanResultBase instance.

public BooleanResultBase<TMetadata> Or(BooleanResultBase<TMetadata> right)

Parameters

right BooleanResultBase<TMetadata>

The other boolean result instance to perform the OR operation with.

Returns

BooleanResultBase<TMetadata>

A new boolean result instance representing the result of the OR operation.

OrElse(BooleanResultBase<TMetadata>)

Performs a conditional OR operation between the current BooleanResultBase instance and another BooleanResultBase instance. This will short-circuit the evaluation of the right operand if the left operand is satisfied.

public BooleanResultBase<TMetadata> OrElse(BooleanResultBase<TMetadata> right)

Parameters

right BooleanResultBase<TMetadata>

The other boolean result instance to perform the OR operation with.

Returns

BooleanResultBase<TMetadata>

A new boolean result instance representing the result of the OR operation.

XOr(BooleanResultBase<TMetadata>)

Performs a logical exclusive OR (XOR) operation between this BooleanResultBase instance and another BooleanResultBase instance.

public BooleanResultBase<TMetadata> XOr(BooleanResultBase<TMetadata> right)

Parameters

right BooleanResultBase<TMetadata>

The other boolean result instance to perform the XOR operation with.

Returns

BooleanResultBase<TMetadata>

A new boolean result instance representing the result of the XOR operation.

Operators

operator &(BooleanResultBase<TMetadata>, BooleanResultBase<TMetadata>)

Overloads the bitwise AND operator to perform a logical AND operation on two BooleanResultBase instances.

public static BooleanResultBase<TMetadata> operator &(BooleanResultBase<TMetadata> left, BooleanResultBase<TMetadata> right)

Parameters

left BooleanResultBase<TMetadata>

The left boolean result instance.

right BooleanResultBase<TMetadata>

The right boolean result instance.

Returns

BooleanResultBase<TMetadata>

A new BooleanResultBase instance representing the result of the logical AND operation.

operator |(BooleanResultBase<TMetadata>, BooleanResultBase<TMetadata>)

Overloads the logical OR operator (|) to perform a logical OR operation on two BooleanResultBase instances.

public static BooleanResultBase<TMetadata> operator |(BooleanResultBase<TMetadata> left, BooleanResultBase<TMetadata> right)

Parameters

left BooleanResultBase<TMetadata>

The left boolean result instance.

right BooleanResultBase<TMetadata>

The right boolean result instance.

Returns

BooleanResultBase<TMetadata>

A new BooleanResultBase instance representing the result of the logical OR operation.

operator ^(BooleanResultBase<TMetadata>, BooleanResultBase<TMetadata>)

Overloads the ^ operator to perform an exclusive OR (XOR) operation on two BooleanResultBase instances.

public static BooleanResultBase<TMetadata> operator ^(BooleanResultBase<TMetadata> left, BooleanResultBase<TMetadata> right)

Parameters

left BooleanResultBase<TMetadata>

The left boolean result operand.

right BooleanResultBase<TMetadata>

The right boolean result operand.

Returns

BooleanResultBase<TMetadata>

A new BooleanResultBase instance representing the result of the XOR operation.

operator !(BooleanResultBase<TMetadata>)

Overloads the logical NOT operator for the BooleanResultBase class.

public static BooleanResultBase<TMetadata> operator !(BooleanResultBase<TMetadata> result)

Parameters

result BooleanResultBase<TMetadata>

The boolean result object to negate.

Returns

BooleanResultBase<TMetadata>

A new boolean result object that represents the negation of the input.