Module: Roby::Relations::Models::Graph
- Includes:
- MetaRuby::ModelAsClass
- Defined in:
- lib/roby/relations/models/graph.rb
Instance Attribute Summary collapse
-
#child_name ⇒ Object
readonly
The child_name as given to Space#relation.
-
#parent ⇒ Graph?
The one and only graph that is a superset of self.
-
#subsets ⇒ Set<Graph>
readonly
The set of graphs that are subsets of self.
Instance Method Summary collapse
-
#root_relation? ⇒ Boolean
True if this relation graph is the subset of no other relation.
-
#setup_submodel(submodel, child_name: nil, distribute: true, dag: false, weak: false, strong: false, copy_on_replace: false, noinfo: true, subsets: Set.new) ⇒ Object
private
Hook method called to setup a new relation graph.
-
#superset_of(rel) ⇒ Object
Declare that self is a superset of another graph.
Instance Attribute Details
#child_name ⇒ Object (readonly)
The child_name as given to Space#relation
This is used to dispatch to the relation-specific hooks in DirectedRelationSupport
39 40 41 |
# File 'lib/roby/relations/models/graph.rb', line 39 def child_name @child_name end |
#parent ⇒ Graph?
The one and only graph that is a superset of self
49 50 51 |
# File 'lib/roby/relations/models/graph.rb', line 49 def parent @parent end |
Instance Method Details
#root_relation? ⇒ Boolean
True if this relation graph is the subset of no other relation
63 64 65 |
# File 'lib/roby/relations/models/graph.rb', line 63 def root_relation? !parent end |
#setup_submodel(submodel, child_name: nil, distribute: true, dag: false, weak: false, strong: false, copy_on_replace: false, noinfo: true, subsets: Set.new) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Hook method called to setup a new relation graph
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/roby/relations/models/graph.rb', line 12 def setup_submodel(submodel, child_name: nil, distribute: true, dag: false, weak: false, strong: false, copy_on_replace: false, noinfo: true, subsets: Set.new) super submodel.instance_variable_set :@child_name, child_name submodel.distribute = distribute submodel.dag = dag submodel.weak = weak submodel.strong = strong submodel.copy_on_replace = copy_on_replace submodel. = !noinfo submodel.instance_variable_set :@subsets, Set.new submodel.instance_variable_set :@parent, nil subsets.each do |rel| submodel.superset_of(rel) end end |
#superset_of(rel) ⇒ Object
Declare that self is a superset of another graph
70 71 72 73 |
# File 'lib/roby/relations/models/graph.rb', line 70 def superset_of(rel) subsets << rel rel.parent = self end |