searchEntries method

Iterable<RTreeEntry<T>> searchEntries({
  1. Predicate1<RTreeNode<T>>? nodePredicate,
  2. Predicate1<RTreeEntry<T>>? entryPredicate,
})

Traverses the tree, returning leaf entries that match a condition. This method optionally accepts both a node condition and an entry condition. The node condition is evaluated at each level and eliminates entire subtrees. In order for a leaf entry to be returned, all parent node conditions must pass. The entry condition is evaluated only at the leaf level. Both conditions are optional, and if neither is passed in, all leaf entries are returned.

Implementation

Iterable<RTreeEntry<T>> searchEntries({
  Predicate1<RTreeNode<T>>? nodePredicate,
  Predicate1<RTreeEntry<T>>? entryPredicate,
}) sync* {
  for (final leaf in searchNodes(nodePredicate: nodePredicate)) {
    for (final entry in leaf.entries) {
      if (entryPredicate == null || entryPredicate(entry)) {
        yield entry;
      }
    }
  }
}