Module: AutoC::Entity
- Includes:
- Comparable
- Included in:
- Allocator, BDWAllocator, Code, Composite, Function, Hasher, STD::Primitive
- Defined in:
- lib/autoc/module.rb
Defined Under Namespace
Classes: DependencySet
Constant Summary collapse
- ReferenceSet =
::Set
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#complexity ⇒ Object
Interface part is not considered as it is shared across the sources.
-
#dependencies ⇒ Object
A set of the entity’s immediate dependencies which enforce the entities relative ordering.
- #forward_declarations ⇒ Object
- #implementation ⇒ Object
- #interface ⇒ Object
-
#position ⇒ Object
Compute the entity’s relative position with respect to its dependencies.
-
#references ⇒ Object
A set of the entity’s immediate references which, unlike dependencies, do not enforce the entities relative ordering.
-
#total_dependencies ⇒ Object
Return the entire entity’s dependency set staring with self.
-
#total_references ⇒ Object
Return the entire entity’s reference set staring with self.
Instance Method Details
#<=>(other) ⇒ Object
328 |
# File 'lib/autoc/module.rb', line 328 def <=>(other) = position <=> other.position |
#complexity ⇒ Object
Interface part is not considered as it is shared across the sources
344 |
# File 'lib/autoc/module.rb', line 344 def complexity = forward_declarations.complexity + implementation.complexity # Interface part is not considered as it is shared across the sources |
#dependencies ⇒ Object
A set of the entity’s immediate dependencies which enforce the entities relative ordering
307 |
# File 'lib/autoc/module.rb', line 307 def dependencies = @dependencies ||= DependencySet.new(self) |
#forward_declarations ⇒ Object
353 354 355 356 357 358 |
# File 'lib/autoc/module.rb', line 353 def forward_declarations @forward_declarations ||= begin render_forward_declarations(stream = Module::Builder.new) stream end end |
#implementation ⇒ Object
360 361 362 363 364 365 |
# File 'lib/autoc/module.rb', line 360 def implementation @implementation ||= begin render_implementation(stream = Module::Builder.new) stream end end |
#interface ⇒ Object
346 347 348 349 350 351 |
# File 'lib/autoc/module.rb', line 346 def interface @interface ||= begin render_interface(stream = Module::Builder.new) stream end end |
#position ⇒ Object
Compute the entity’s relative position with respect to its dependencies
331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/autoc/module.rb', line 331 def position = @position ||= begin p = 0 # This code goes into infinite recursion on circular dependency # which must be resolved manually with Entity#references total_dependencies.each do |d| unless equal?(d) dp = d.position p = dp if p < dp # p <- max(p, dp) end end p + 1 # Arrange entity to follow all its dependencies end |
#references ⇒ Object
A set of the entity’s immediate references which, unlike dependencies, do not enforce the entities relative ordering
301 |
# File 'lib/autoc/module.rb', line 301 def references = @references ||= ReferenceSet.new |
#total_dependencies ⇒ Object
Return the entire entity’s dependency set staring with self
310 |
# File 'lib/autoc/module.rb', line 310 def total_dependencies = @total_dependencies ||= collect_dependencies(::Set.new) |
#total_references ⇒ Object
Return the entire entity’s reference set staring with self
304 |
# File 'lib/autoc/module.rb', line 304 def total_references = @total_references ||= collect_references(::Set.new) |