class Roby::Queries::TaskEventGeneratorMatcher
Object
that allows to describe a task's event generator and match it in the plan
It uses a task matcher to match the underlying task
Attributes
symbol[R]
@return [#===] the required event name
task_matcher[R]
@return [TaskMatcher] the task matcher that describes this event's
task
Public Class Methods
new(task_matcher = Roby::Task.match, symbol = Queries.any)
click to toggle source
Calls superclass method
Roby::Queries::PlanObjectMatcher::new
# File lib/roby/queries/task_event_generator_matcher.rb, line 18 def initialize(task_matcher = Roby::Task.match, symbol = Queries.any) if symbol.respond_to?(:to_sym) # Probably a symbol, convert to string symbol = symbol.to_s end @symbol = symbol @task_matcher = task_matcher @generalized = false super() end
Public Instance Methods
===(object)
click to toggle source
Tests whether the given task event generator matches self
@param [TaskEventGenerator] object @return [Boolean]
# File lib/roby/queries/task_event_generator_matcher.rb, line 65 def ===(object) return if !object.kind_of?(TaskEventGenerator) if match_not_generalized(object) true elsif generalized? && object.plan forwarding_graph = object.relation_graph_for(EventStructure::Forwarding) forwarding_graph.depth_first_visit(object) do |generator| return true if match_not_generalized(generator) end false end end
Also aliased as: plan_object_match
filter(initial_set, index)
click to toggle source
@raise [NotImplementedError] Cannot yet do plan queries on task
event generators
# File lib/roby/queries/task_event_generator_matcher.rb, line 51 def filter(initial_set, index) raise NotImplementedError end
generalized()
click to toggle source
Makes this matcher a generalized matcher @see generalized? @return self
# File lib/roby/queries/task_event_generator_matcher.rb, line 31 def generalized @generalized = true self end
match_not_generalized(object)
click to toggle source
# File lib/roby/queries/task_event_generator_matcher.rb, line 79 def match_not_generalized(object) (symbol === object.symbol.to_s) && plan_object_match(object) && (task_matcher === object.task) end
to_s()
click to toggle source
# File lib/roby/queries/task_event_generator_matcher.rb, line 57 def to_s "#{task_matcher}.#{symbol}" end
with_name(symbol)
click to toggle source
Adds a matching object for the event's name
@param [Regexp,Symbol,String,#===] symbol an object that will
allow to match the event's name
@return self
# File lib/roby/queries/task_event_generator_matcher.rb, line 41 def with_name(symbol) @symbol = if symbol.respond_to?(:to_sym) then symbol.to_s else symbol end self end