Class: Roby::NegateTaskMatcher

Inherits:
TaskMatcher show all
Defined in:
lib/roby/query.rb,
lib/roby/distributed/protocol.rb

Overview

Negate a given task-matching predicate

Defined Under Namespace

Classes: DRoby

Constant Summary

Constants inherited from TaskMatcher

TaskMatcher::STATE_PREDICATES

Instance Attribute Summary

Attributes inherited from TaskMatcher

#arguments, #improved_information, #model, #needed_information, #neg_predicates, #owners, #predicates

Instance Method Summary collapse

Methods inherited from TaskMatcher

#&, declare_class_methods, #each, match_predicates, #negate, #owned_by, #self_owned, #which_fullfills, #which_improves, #which_needs, #with_arguments, #with_model, #with_model_arguments, #|

Constructor Details

#initialize(op) ⇒ NegateTaskMatcher

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



414
415
416
417
# File 'lib/roby/query.rb', line 414

def initialize(op)
	    @op = op
	    super()
end

Instance Method Details

#===(task) ⇒ Object

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



431
432
433
434
# File 'lib/roby/query.rb', line 431

def ===(task)
    return if @op === task
    super
end

#droby_dump(dest) ⇒ Object

Returns an intermediate representation of self suitable to be sent to the dest peer.



250
251
252
253
254
# File 'lib/roby/distributed/protocol.rb', line 250

def droby_dump(dest)
    m = super(dest, NegateTaskMatcher::DRoby)
    m.args << @op
    m
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



421
422
423
424
425
426
427
428
# File 'lib/roby/query.rb', line 421

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