Class: Roby::Queries::NotMatcher

Inherits:
MatcherBase show all
Includes:
DRoby::V5::Queries::NotMatcherDumper
Defined in:
lib/roby/queries/not_matcher.rb,
lib/roby/droby/enable.rb

Overview

Negate a given task-matching predicate

This matcher will match if the underlying predicate does not match.

Instance Attribute Summary

Attributes inherited from MatcherBase

#neg_predicates, #predicates

Instance Method Summary collapse

Methods included from DRoby::V5::Queries::NotMatcherDumper

#droby_dump

Methods inherited from MatcherBase

#&, declare_class_methods, #describe_failed_match, #each, #indexed_query?, #match, match_predicate, match_predicates, #negate, #|

Constructor Details

#initialize(op) ⇒ NotMatcher

Create a new TaskMatcher which matches if and only if op does not



9
10
11
# File 'lib/roby/queries/not_matcher.rb', line 9

def initialize(op)
    @op = op
end

Instance Method Details

#===(task) ⇒ Object

True if the task matches at least one of the underlying predicates



25
26
27
# File 'lib/roby/queries/not_matcher.rb', line 25

def ===(task)
    !(@op === task)
end

#filter(initial_set, task_index) ⇒ Object

Filters as much as non-matching tasks as possible out of task_set, based on the information in task_index



15
16
17
18
19
20
21
22
# File 'lib/roby/queries/not_matcher.rb', line 15

def filter(initial_set, task_index)
    # WARNING: the value returned by filter is a SUPERSET of the
    # possible values for the query. Therefore, the result of
    # NegateTaskMatcher#filter is NOT
    #
    #   initial_set - @op.filter(...)
    initial_set
end