Method: Roby::Queries::TaskMatcher#indexed_sets

Defined in:
lib/roby/queries/task_matcher.rb

#indexed_sets(index) ⇒ (Set,Set)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Resolve the indexed sets needed to filter an initial set in #filter

Returns:

  • ((Set,Set))

    the positive (intersection) and negative (difference) sets. The result will be computed as

    positive.inject(&:&) - negative.inject(&:|)
    


449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
# File 'lib/roby/queries/task_matcher.rb', line 449

def indexed_sets(index)
    positive_sets = []
    @model.each do |m|
        positive_sets << index.by_model[m]
    end

    @owners.each do |o|
        candidates = index.by_owner[o]
        return [Set.new, Set.new] unless candidates

        positive_sets << candidates
    end

    @indexed_predicates.each do |pred|
        positive_sets << index.by_predicate[pred]
    end

    negative_sets =
        @indexed_neg_predicates
        .map { |pred| index.by_predicate[pred] }

    @plan_predicates.each do |name|
        positive_sets << index.send(PLAN_PREDICATES.fetch(name))
    end

    @neg_plan_predicates.each do |name|
        negative_sets << index.send(PLAN_PREDICATES.fetch(name))
    end

    [positive_sets, negative_sets]
end