class Roby::Queries::OrMatcher

Combines multiple task matching predicates through a OR boolean operator. I.e. it will match if any of the underlying predicates match.

Public Class Methods

new(*ops) click to toggle source

Create a new OrMatcher object combining the given predicates.

# File lib/roby/queries/or_matcher.rb, line 8
def initialize(*ops)
    @ops = ops 
end

Public Instance Methods

<<(op) click to toggle source

Add a new predicate to the combination

# File lib/roby/queries/or_matcher.rb, line 22
def <<(op); @ops << op end
===(task) click to toggle source
# File lib/roby/queries/or_matcher.rb, line 24
def ===(task)
    @ops.any? { |op| op === task }
end
filter(task_set, task_index) click to toggle source

Overload of TaskMatcher#filter

# File lib/roby/queries/or_matcher.rb, line 13
def filter(task_set, task_index)
    result = Set.new
    for child in @ops
        result.merge child.filter(task_set, task_index)
    end
    result
end