Class: Roby::EventConstraints::UnboundTaskPredicate::And
- Inherits:
-
BinaryCommutativePredicate
- Object
- Roby::EventConstraints::UnboundTaskPredicate
- BinaryCommutativePredicate
- Roby::EventConstraints::UnboundTaskPredicate::And
- Defined in:
- lib/roby/event_constraints.rb
Overview
Representation of UnboundPredicateSupport#and and UnboundTaskPredicate#and
See documentation from UnboundTaskPredicate
Instance Attribute Summary
Attributes inherited from BinaryCommutativePredicate
Instance Method Summary collapse
- #and(pred) ⇒ Object
- #code ⇒ Object
- #explain_static(task) ⇒ Object
- #static?(task) ⇒ Boolean
- #to_s ⇒ Object
Methods inherited from BinaryCommutativePredicate
#==, #each_atomic_predicate, #explain_false, #explain_true, #has_atomic_predicate?, #initialize, #required_events
Methods inherited from Roby::EventConstraints::UnboundTaskPredicate
#compile, #evaluate, #explain_false, #explain_true, #initialize, #negate, #or, #pretty_print, #to_unbound_task_predicate
Constructor Details
This class inherits a constructor from Roby::EventConstraints::UnboundTaskPredicate::BinaryCommutativePredicate
Instance Method Details
#and(pred) ⇒ Object
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 |
# File 'lib/roby/event_constraints.rb', line 651 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 ⇒ Object
647 648 649 |
# File 'lib/roby/event_constraints.rb', line 647 def code "(#{predicates[0].code}) && (#{predicates[1].code})" end |
#explain_static(task) ⇒ Object
675 676 677 678 679 680 681 682 683 684 685 |
# File 'lib/roby/event_constraints.rb', line 675 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) ⇒ Boolean
667 668 669 670 671 672 673 |
# File 'lib/roby/event_constraints.rb', line 667 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 ⇒ Object
687 688 689 |
# File 'lib/roby/event_constraints.rb', line 687 def to_s "(#{predicates[0]}) && (#{predicates[1]})" end |