class Roby::EventConstraints::UnboundTaskPredicate::And

Representation of UnboundPredicateSupport#and and UnboundTaskPredicate#and

See documentation from UnboundTaskPredicate

Public Instance Methods

and(pred) click to toggle source
# File lib/roby/event_constraints.rb, line 550
def and(pred)
    pred = pred.to_unbound_task_predicate
    if pred.kind_of?(And)
        # Only add predicates in +pred+ that are not already in
        # +self+
        result = self
        pred.each_atomic_predicate do |predicate|
            result = result.and(predicate)
        end
    elsif has_atomic_predicate?(pred)
        self
    else
        super
    end
end
code() click to toggle source
# File lib/roby/event_constraints.rb, line 546
def code
    "(#{predicates[0].code}) && (#{predicates[1].code})"
end
explain_static(task) click to toggle source
# File lib/roby/event_constraints.rb, line 574
def explain_static(task)
    static0 = predicates[0].static?(task)
    static1 = predicates[1].static?(task)
    if static0 && static1
        super(task)
    elsif static0 && !predicates[0].evaluate(task)
        predicates[0].explain_static(task)
    elsif static1 && !predicates[1].evaluate(task)
        predicates[1].explain_static(task)
    end
end
static?(task) click to toggle source
# File lib/roby/event_constraints.rb, line 566
def static?(task)
    static0 = predicates[0].static?(task)
    static1 = predicates[1].static?(task)
    static0 && static1 ||
        (static0 && !predicates[0].evaluate(task) ||
         static1 && !predicates[1].evaluate(task))
end
to_s() click to toggle source
# File lib/roby/event_constraints.rb, line 586
def to_s; "(#{predicates[0]}) && (#{predicates[1]})" end