Module: Roby::EventConstraints::UnboundPredicateSupport
- Defined in:
- lib/roby/event_constraints.rb
Overview
Module that defines the unbound task predicate methods that are added to the Symbol class
Instance Method Summary collapse
-
#and(other) ⇒ Object
Returns an UnboundTaskPredicate that will be true if the generator represented by this symbol has emitted at least once, and the predicate represented by
other
is true at the same time. -
#emitted? ⇒ Boolean
Returns an UnboundTaskPredicate that will be true if the generator represented by this symbol has emitted at least once.
-
#followed_by(other) ⇒ Object
Returns an UnboundTaskPredicate that will be true if the generator represented by this symbol and the generator represented by
other
(as a symbol) have emitted in sequence, i.e. -
#happened? ⇒ Boolean
deprecated
Deprecated.
use #emitted? instead
-
#negate ⇒ Object
Returns an UnboundTaskPredicate that will be true if the generator represented by
self
has never emitted. -
#never ⇒ Object
Returns an UnboundTaskPredicate that will be true if the generator represented by this symbol will never be emitted.
-
#not_followed_by(other) ⇒ Object
Returns an UnboundTaskPredicate that will be true if the generator represented by this symbol and the generator represented by
other
(as a symbol) have not emitted in sequence, i.e. -
#or(other) ⇒ Object
Returns an UnboundTaskPredicate that will be true if the generator represented by this symbol has emitted at least once, or the predicate represented by
other
is true. -
#to_unbound_task_predicate ⇒ Object
Protocol method.
Instance Method Details
#and(other) ⇒ Object
Returns an UnboundTaskPredicate that will be true if the generator represented by this symbol has emitted at least once, and the predicate represented by other
is true at the same time.
In its simplest form,
:blocked.and(:updated)
it will be true if the task on which it is applied has both emitted :blocked and :updated at least once.
97 98 99 100 |
# File 'lib/roby/event_constraints.rb', line 97 def and(other) to_unbound_task_predicate .and(other.to_unbound_task_predicate) end |
#emitted? ⇒ Boolean
Returns an UnboundTaskPredicate that will be true if the generator represented by this symbol has emitted at least once.
In its simplest form,
:blocked.emitted?
will be true when evaluated on a task whose blocked
event has emitted at least once
58 59 60 |
# File 'lib/roby/event_constraints.rb', line 58 def emitted? to_unbound_task_predicate end |
#followed_by(other) ⇒ Object
Returns an UnboundTaskPredicate that will be true if the generator represented by this symbol and the generator represented by other
(as a symbol) have emitted in sequence, i.e. if both self
and other
have emitted at least once, and if the last event e0 emitted by self
and the last event e1 emitted by other
match
e0.time < e1.time
Unlike and
, or
and negate
, this only works on single events (i.e. it cannot be applied on other predicates)
128 129 130 131 |
# File 'lib/roby/event_constraints.rb', line 128 def followed_by(other) to_unbound_task_predicate .followed_by(other.to_unbound_task_predicate) end |
#happened? ⇒ Boolean
use #emitted? instead
63 64 65 66 |
# File 'lib/roby/event_constraints.rb', line 63 def happened? Roby.warn_deprecated "#happened? is deprecated, use #emitted? instead" emitted? end |
#negate ⇒ Object
Returns an UnboundTaskPredicate that will be true if the generator represented by self
has never emitted
151 152 153 |
# File 'lib/roby/event_constraints.rb', line 151 def negate to_unbound_task_predicate.negate end |
#never ⇒ Object
Returns an UnboundTaskPredicate that will be true if the generator represented by this symbol will never be emitted.
In its simplest form,
:blocked.never
will be true when evaluated on a task whose blocked
event has not yet been emitted, and has been declared as unreachable
83 84 85 |
# File 'lib/roby/event_constraints.rb', line 83 def never to_unbound_task_predicate.never end |
#not_followed_by(other) ⇒ Object
Returns an UnboundTaskPredicate that will be true if the generator represented by this symbol and the generator represented by other
(as a symbol) have not emitted in sequence, i.e. if self
has emitted at least once, and either other
has not emitted or other
has emitted and the last event e0 emitted by self
and the last event e1 emitted by other
do not match
e0.time < e1.time
Unlike and
, or
and negate
, this only works on single events (i.e. it cannot be applied on other predicates)
144 145 146 147 |
# File 'lib/roby/event_constraints.rb', line 144 def not_followed_by(other) to_unbound_task_predicate .not_followed_by(other.to_unbound_task_predicate) end |
#or(other) ⇒ Object
Returns an UnboundTaskPredicate that will be true if the generator represented by this symbol has emitted at least once, or the predicate represented by other
is true.
In its simplest form,
:blocked.or(:updated)
it will be true if the task on which it is applied has either emitted :blocked, or emitted :updated, or both.
112 113 114 115 |
# File 'lib/roby/event_constraints.rb', line 112 def or(other) to_unbound_task_predicate .or(other.to_unbound_task_predicate) end |
#to_unbound_task_predicate ⇒ Object
Protocol method. The unbound task predicate call always calls #to_unbound_task_predicate on the arguments given to it.
70 71 72 |
# File 'lib/roby/event_constraints.rb', line 70 def to_unbound_task_predicate UnboundTaskPredicate::SingleEvent.new(self) end |