Class: Roby::EventConstraints::UnboundTaskPredicate::Or
- Inherits:
-
BinaryCommutativePredicate
- Object
- Roby::EventConstraints::UnboundTaskPredicate
- BinaryCommutativePredicate
- Roby::EventConstraints::UnboundTaskPredicate::Or
- Defined in:
- lib/roby/event_constraints.rb
Overview
Representation of UnboundPredicateSupport#or and UnboundTaskPredicate#or
See documentation from UnboundTaskPredicate
Instance Attribute Summary
Attributes inherited from BinaryCommutativePredicate
Instance Method Summary collapse
- #code ⇒ Object
- #explain_static(task) ⇒ Object
- #or(pred) ⇒ 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
#and, #compile, #evaluate, #explain_false, #explain_true, #initialize, #negate, #pretty_print, #to_unbound_task_predicate
Constructor Details
This class inherits a constructor from Roby::EventConstraints::UnboundTaskPredicate::BinaryCommutativePredicate
Instance Method Details
#code ⇒ Object
697 698 699 |
# File 'lib/roby/event_constraints.rb', line 697 def code "(#{predicates[0].code}) || (#{predicates[1].code})" end |
#explain_static(task) ⇒ Object
727 728 729 730 731 732 733 734 735 736 737 |
# File 'lib/roby/event_constraints.rb', line 727 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 |
#or(pred) ⇒ Object
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 |
# File 'lib/roby/event_constraints.rb', line 701 def or(pred) pred = pred.to_unbound_task_predicate if pred.kind_of?(Or) # Only add predicates in +pred+ that are not already in # +self+ result = self pred.each_atomic_predicate do |predicate| result = result.or(predicate) end result elsif has_atomic_predicate?(pred) # Do not add +pred+ if it is already included in +self+ self else super end end |
#static?(task) ⇒ Boolean
719 720 721 722 723 724 725 |
# File 'lib/roby/event_constraints.rb', line 719 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
739 740 741 |
# File 'lib/roby/event_constraints.rb', line 739 def to_s "(#{predicates[0]}) || (#{predicates[1]})" end |