Saxon.Api

 

 

Saxon.Api

Class Predicate<T>


public class Predicate<T>
implements IPredicate<T>

This class implements the IPredicate interface which represents a predicate (boolean-valued Func) of one argument.

Constructor Summary

Predicate (Func<T, bool> f)

Predicate constructor method to wrap the Func object.

 

Property Summary

  Func

Unwrapped Func property which evaluates to boolean.

 

Method Summary

 <T1> IPredicate<T1> And(IPredicate<T1> other)

Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another. When evaluating the composed predicate, if this predicate is false, then the other predicate is not evaluated.

 <T1> bool Invoke(T1 item)

Evaluates this predicate on the given argument.

 IPredicate<T> Negate()

Returns a predicate that represents the logical negation of this predicate.

 <T1> IPredicate<T1> Or(IPredicate<T1> other)

Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another. When evaluating the composed predicate, if this predicate is true, then the other predicate is not evaluated.

 

Constructor Detail

Predicate

public Predicate(Func<T, bool> f)

Predicate constructor method to wrap the Func object.

Parameters:

f - boolean-valued Func object

Property Detail

Func

public  Func {get; }

Unwrapped Func property which evaluates to boolean.

Method Detail

And

public IPredicate<T1> And<T1>(IPredicate<T1> other)

Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another. When evaluating the composed predicate, if this predicate is false, then the other predicate is not evaluated.

Parameters:

other - A predicate that will be logically-ANDed with this predicate

Returns:

A composed predicate that represents the short-circuiting logical AND of this predicate the other predicate.

Invoke

public bool Invoke<T1>(T1 item)

Evaluates this predicate on the given argument.

Parameters:

item - The input item

Returns:

true if the input argument matches the predicate, otherwise false.

Negate

public IPredicate<T> Negate()

Returns a predicate that represents the logical negation of this predicate.

Returns:

A predicate that represents the logical negation of this predicate.

Or

public IPredicate<T1> Or<T1>(IPredicate<T1> other)

Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another. When evaluating the composed predicate, if this predicate is true, then the other predicate is not evaluated.

Parameters:

other - A predicate that will be logically-ORed with this predicate

Returns:

A composed predicate that represents the short-circuiting logical OR of this predicate and the other predicate.