Nevron Open Vision Documentation
Filters

Filters are predicates that execute a boolean algebra expression upon an item of a specific type. The abstraction of a filter is defined by the INFilter<T> interface, that has only one method:

bool Filter(T item);

The filter method returns true, if the item passes the filter, otherwise it returns false.

NOV Data Structures implement a large set of commonly used filters that are summarized by the following table:

Filter Description

Basic Boolean Algebra Filters

NAndFilter<T> Aggregates two other filters. Returns true if both filters return true, otherwise returns false.
NOrFilter<T> Aggregates two other filters. Returns true if at least one of the filters return true, otherwise returns false.
NNotFilter<T> Aggregates a single other filter. Returns true if the aggregated filter returns false, otherwise returns true.
NFalseFilter<T>.Instance Singleton filter that always returns false.
NTrueFilter<T>.Instance Singleton filter that always returns true.

Comparison Filters.
 (available only when T implements the IComparable<T> interface)
All take a comparison Value at construction time.

NEqualsToFilter<T> Returns true if item.CompareTo(Value) == 0.
NGreaterThanFilter<T> Returns true if item.CompareTo(Value) > 0.
NGreaterThanOrEqualToFilter<T> Returns true if item.CompareTo(Value) >= 0.
NLessThanFilter<T> Returns true if item.CompareTo(Value) < 0.
NLessThanOrEqualToFilter<T> Returns true if item.CompareTo(Value) <= 0.

Objects Equality Filters.
All take a comparison Other object at construction time.

NObjectEqualsFilter<T> Returns true if item.Equals(Other) == true. Both item and Other can be null.
NReferenceEqualsFilter<T> Returns true if Object.ReferenceEquals(Other) == true. Both item and Other can be null.

Type Filters.
All take a TTargetType as generic argument.

NAsFilter<T, TTargetType> Aggregates another filter of type INFilter<TTargetType>. Returns true, if the item can be casted to TTargetType and the aggregated filter returns true.
NIsFilter<T, TTargetType>.Instance Singleton filter, which only passes items, which are instances of TTargetType.
NTypeEqualsFilter<T, TTargetType>.Instance Singleton filter, which only passes items, whose type is exactly TTargetType.

 

Send Feedback