class Roby::EventStructure::SchedulingConstraints
Attributes
task_graph[R]
The graph of tasks related to each other by their events
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/roby/event_structure/temporal_constraints.rb, line 262 def initialize(*args) super @task_graph = Relations::BidirectionalDirectedAdjacencyGraph.new end
Public Instance Methods
add_edge(from, to, info)
click to toggle source
Calls superclass method
# File lib/roby/event_structure/temporal_constraints.rb, line 267 def add_edge(from, to, info) if super if from.respond_to?(:task) && to.respond_to?(:task) add_edge_in_task_graph(from.task, to.task) end end end
add_edge_in_task_graph(from_task, to_task)
click to toggle source
# File lib/roby/event_structure/temporal_constraints.rb, line 275 def add_edge_in_task_graph(from_task, to_task) return if from_task == to_task if task_graph.has_edge?(from_task, to_task) count = task_graph.edge_info(from_task, to_task) task_graph.set_edge_info(from_task, to_task, count + 1) else task_graph.add_edge(from_task, to_task, 1) end end
clear()
click to toggle source
Calls superclass method
# File lib/roby/event_structure/temporal_constraints.rb, line 342 def clear super task_graph.clear end
merge(graph)
click to toggle source
Calls superclass method
# File lib/roby/event_structure/temporal_constraints.rb, line 297 def merge(graph) super # There's really no easy way to handle the merge nicely. Rebuild # the task graph task_graph.clear each_edge do |from, to| if from.respond_to?(:task) && to.respond_to?(:task) add_edge_in_task_graph(from.task, to.task) end end end
remove_edge(from, to)
click to toggle source
Calls superclass method
# File lib/roby/event_structure/temporal_constraints.rb, line 331 def remove_edge(from, to) super if from.respond_to?(:task) && to.respond_to?(:task) remove_edge_in_task_graph(from.task, to.task) end end
remove_edge_in_task_graph(from_task, to_task)
click to toggle source
# File lib/roby/event_structure/temporal_constraints.rb, line 286 def remove_edge_in_task_graph(from_task, to_task) return if from_task == to_task count = task_graph.edge_info(from_task, to_task) if count == 1 task_graph.remove_edge(from_task, to_task) else task_graph.set_edge_info(from_task, to_task, count - 1) end end
remove_vertex(event)
click to toggle source
Calls superclass method
# File lib/roby/event_structure/temporal_constraints.rb, line 315 def remove_vertex(event) if event.respond_to?(:task) each_in_neighbour(event) do |from| if from.respond_to?(:task) remove_edge_in_task_graph(from.task, event.task) end end each_out_neighbour(event) do |to| if to.respond_to?(:task) remove_edge_in_task_graph(event.task, to.task) end end end super end
replace(graph)
click to toggle source
Calls superclass method
# File lib/roby/event_structure/temporal_constraints.rb, line 310 def replace(graph) super task_graph.replace(graph.task_graph) end