Module: Roby::Relations

Defined in:
lib/roby/relations.rb,
lib/roby/relations/graph.rb,
lib/roby/relations/space.rb,
lib/roby/relations/models/graph.rb,
lib/roby/relations/fork_merge_visitor.rb,
lib/roby/relations/task_relation_graph.rb,
lib/roby/relations/event_relation_graph.rb,
lib/roby/relations/directed_relation_support.rb,
lib/roby/relations/models/task_relation_graph.rb,
lib/roby/relations/models/directed_relation_support.rb,
lib/roby/relations/bidirectional_directed_adjacency_graph.rb,
lib/roby/droby/enable.rb

Defined Under Namespace

Modules: DirectedRelationSupport, Models Classes: BidirectionalDirectedAdjacencyGraph, CycleFoundError, EventRelationGraph, ForkMergeVisitor, Graph, Space, TaskRelationGraph

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.all_relationsObject (readonly)

Returns the value of attribute all_relations.



21
22
23
# File 'lib/roby/relations.rb', line 21

def all_relations
  @all_relations
end

Class Method Details

.add_relation(rel) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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) ⇒ Object



25
26
27
28
29
30
31
32
# 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) ⇒ Object



50
51
52
# File 'lib/roby/relations.rb', line 50

def self.remove_relation(rel)
    all_relations.delete(rel)
end