HierarchicalFilterGroup class final

Filter group of hierarchical filters.

The filter group is always conjunctive, meaning the group's filter operator should always be FilterOperator.and.

Example

Hierarchical filter group, optionally named 'categories':

  • Attributes: category.lvl0 and category.lvl1
  • Paths: Shoes and Shoes > Running
  • Filters: Shoes > Running
  const groupName = 'categories';
  const level0 = 'category.lvl0';
  const level1 = 'category.lvl1';
  final shoes = Filter.facet(level0, 'Shoes');
  final shoesRunning = Filter.facet(level1, 'Shoes > Running');

  final filterGroup = HierarchicalFilterGroup(
    const FilterGroupID(groupName),
    {shoesRunning},
    [shoes, shoesRunning],
    [level0, level1],
  );

The same example can be created using FilterGroup.hierarchical

  final filterGroup = FilterGroup.hierarchical(
    name: groupName,
    attributes: [level0, level1],
    path: [shoes, shoesRunning],
    filters: {shoesRunning},
  );
Implemented types
Available Extensions

Constructors

HierarchicalFilterGroup(FilterGroupID groupID, Set<FilterFacet> _filters, List<FilterFacet> path, List<String> attributes)
Creates an HierarchicalFilterGroup instance.

Properties

attributes List<String>
Attributes names.
final
first FilterFacet
The first element.
no setterinherited
groupID FilterGroupID
Filter group ID (name and operator)
final
hashCode int
The hash code for this object.
no setteroverride
isEmpty bool
Whether this collection has no elements.
no setterinherited
isNotEmpty bool
Whether this collection has at least one element.
no setterinherited
iterator Iterator<FilterFacet>
A new Iterator that allows iterating the elements of this Iterable.
no setterinherited
last FilterFacet
The last element.
no setterinherited
length int
The number of elements in this.
no setterinherited
path List<FilterFacet>
Filter facets path.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
single FilterFacet
Checks that this iterable has only one element, and returns that element.
no setterinherited

Methods

add(FilterFacet value) bool
Adds value to the set.
inherited
addAll(Iterable<FilterFacet> elements) → void
Adds all elements to this set.
inherited
any(bool test(FilterFacet)) bool
Checks whether any element of this iterable satisfies test.
inherited
cast<T>() Set<T>
A view of this iterable as an iterable of R instances.
inherited
clear() → void
Removes all elements from the set.
inherited
contains(Object? element) bool
Whether the collection contains an element equal to element.
inherited
containsAll(Iterable<Object?> other) bool
Whether this set contains all the elements of other.
inherited
copyWith({FilterGroupID? groupID, Set<FilterFacet>? filters, List<FilterFacet>? path, List<String>? attributes}) HierarchicalFilterGroup
Make a copy of the hierarchical filters group.
override
difference(Set<Object?> other) Set<FilterFacet>
Creates a new set with the elements of this that are not in other.
inherited
elementAt(int index) FilterFacet
Returns the indexth element.
inherited
every(bool test(FilterFacet)) bool
Checks whether every element of this iterable satisfies test.
inherited
expand<T>(Iterable<T> f(FilterFacet)) Iterable<T>
Expands each element of this Iterable into zero or more elements.
inherited
firstWhere(bool test(FilterFacet), {FilterFacet orElse()?}) FilterFacet
The first element that satisfies the given predicate test.
inherited
fold<T>(T initialValue, T combine(T previousValue, FilterFacet element)) → T
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value
inherited
followedBy(Iterable<FilterFacet> other) Iterable<FilterFacet>
Creates the lazy concatenation of this iterable and other.
inherited
forEach(void f(FilterFacet)) → void
Invokes action on each element of this iterable in iteration order.
inherited
intersection(Set<Object?> other) Set<FilterFacet>
Creates a new set which is the intersection between this set and other.
inherited
join([String separator = '']) String
Converts each element to a String and concatenates the strings.
inherited
lastWhere(bool test(FilterFacet), {FilterFacet orElse()?}) FilterFacet
The last element that satisfies the given predicate test.
inherited
lookup(Object? element) FilterFacet?
If an object equal to object is in the set, return it.
inherited
map<T>(T f(FilterFacet)) Iterable<T>
The current elements of this iterable modified by toElement.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reduce(FilterFacet combine(FilterFacet value, FilterFacet element)) FilterFacet
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.
inherited
remove(Object? value) bool
Removes value from the set.
inherited
removeAll(Iterable<Object?> elements) → void
Removes each element of elements from this set.
inherited
removeWhere(bool test(FilterFacet)) → void
Removes all elements of this set that satisfy test.
inherited
retainAll(Iterable<Object?> elements) → void
Removes all elements of this set that are not elements in elements.
inherited
retainWhere(bool test(FilterFacet)) → void
Removes all elements of this set that fail to satisfy test.
inherited
retype<T>() Set<T>
inherited
singleWhere(bool test(FilterFacet), {FilterFacet orElse()?}) FilterFacet
The single element that satisfies test.
inherited
skip(int n) Iterable<FilterFacet>
Creates an Iterable that provides all but the first count elements.
inherited
skipWhile(bool test(FilterFacet)) Iterable<FilterFacet>
Creates an Iterable that skips leading elements while test is satisfied.
inherited
take(int n) Iterable<FilterFacet>
Creates a lazy iterable of the count first elements of this iterable.
inherited
takeWhile(bool test(FilterFacet)) Iterable<FilterFacet>
Creates a lazy iterable of the leading elements satisfying test.
inherited
toList({bool growable = true}) List<FilterFacet>
Creates a List containing the elements of this Iterable.
inherited
toSet() Set<FilterFacet>
Creates a Set containing the same elements as this iterable.
inherited
toString() String
A string representation of this object.
union(Set<FilterFacet> other) Set<FilterFacet>
Creates a new set which contains all the elements of this set and other.
inherited
where(bool test(FilterFacet)) Iterable<FilterFacet>
Creates a new lazy Iterable with all elements that satisfy the predicate test.
inherited
whereType<T>() Iterable<T>
Creates a new lazy Iterable with all elements that have type T.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override