Class: Roby::EventConstraints::UnboundTaskPredicate::Never
Overview
Representation of UnboundPredicateSupport#never
See documentation from UnboundPredicateSupport
Instance Attribute Summary collapse
Instance Method Summary
collapse
#and, #compile, #evaluate, #negate, #or, #pretty_print, #to_unbound_task_predicate
Constructor Details
#initialize(pred) ⇒ Never
Returns a new instance of Never.
498
499
500
501
502
503
504
505
506
507
|
# File 'lib/roby/event_constraints.rb', line 498
def initialize(pred)
unless pred.kind_of?(UnboundTaskPredicate::SingleEvent)
raise ArgumentError,
"can only create a Never predicate on top of a SingleEvent"
end
@predicate = pred
super()
end
|
Instance Attribute Details
#predicate ⇒ Object
Returns the value of attribute predicate.
496
497
498
|
# File 'lib/roby/event_constraints.rb', line 496
def predicate
@predicate
end
|
Instance Method Details
#==(other) ⇒ Object
509
510
511
|
# File 'lib/roby/event_constraints.rb', line 509
def ==(other)
other.kind_of?(Never) && other.predicate == predicate
end
|
543
544
545
546
|
# File 'lib/roby/event_constraints.rb', line 543
def code
"(!task_#{predicate.event_name} && "\
"task_event_#{predicate.event_name}.unreachable?)"
end
|
#explain_false(task) ⇒ Object
519
520
521
522
523
524
525
526
527
528
529
|
# File 'lib/roby/event_constraints.rb', line 519
def explain_false(task)
return if evaluate(task)
if predicate.evaluate(task)
predicate.explain_true(task)
elsif !predicate.static?(task)
explanation = predicate.explain_false(task)
explanation.value = true
explanation
end
end
|
#explain_static(task) ⇒ Object
531
532
533
534
535
536
537
|
# File 'lib/roby/event_constraints.rb', line 531
def explain_static(task)
if predicate.evaluate(task)
predicate.explain_true(task)
else
predicate.explain_static(task)
end
end
|
#explain_true(task) ⇒ Object
513
514
515
516
517
|
# File 'lib/roby/event_constraints.rb', line 513
def explain_true(task)
return unless evaluate(task)
predicate.explain_static(task)
end
|
#required_events ⇒ Object
539
540
541
|
# File 'lib/roby/event_constraints.rb', line 539
def required_events
predicate.required_events
end
|
#static?(task) ⇒ Boolean
548
549
550
|
# File 'lib/roby/event_constraints.rb', line 548
def static?(task)
evaluate(task) || predicate.static?(task)
end
|
552
553
554
|
# File 'lib/roby/event_constraints.rb', line 552
def to_s
"never(#{predicate})"
end
|