module Roby::Relations

Attributes

all_relations[R]

Public Class Methods

add_relation(rel) click to toggle source
# File lib/roby/relations.rb, line 34
def self.add_relation(rel)
    sorted_relations = Array.new

    # Remove from the set of relations the ones that are not leafs
    remaining = self.all_relations
    remaining << rel
    target_size = remaining.size

    while sorted_relations.size != target_size
        queue, remaining = remaining.partition { |g| !g.subsets.intersect?(remaining.to_set) }
        sorted_relations.concat(queue)
    end

    @all_relations = sorted_relations
end
each_graph_topologically(graphs) { |g| ... } click to toggle source
# File lib/roby/relations.rb, line 25
def self.each_graph_topologically(graphs)
    rel_to_graph = Hash[*graphs.flat_map { |g| [g.class, g] }]
    all_relations.each do |rel|
        if g = rel_to_graph[rel]
            yield(g)
        end
    end
end
remove_relation(rel) click to toggle source
# File lib/roby/relations.rb, line 50
def self.remove_relation(rel)
    all_relations.delete(rel)
end