Class | JavaClass::Dependencies::Graph |
In: |
lib/javaclass/dependencies/graph.rb
|
Parent: | Object |
A graph contains a list of Node
Author: | Peter Kofler |
Add a node to this graph.
# File lib/javaclass/dependencies/graph.rb, line 18 def add(node) @nodes << node end
Find the nodes that satisfy the given dependency
# File lib/javaclass/dependencies/graph.rb, line 41 def nodes_satisfying(dependency) @nodes.find_all { |n| n.satisfies?(dependency) } end
Iterates all nodes and fills the dependency fields of the Node.
# File lib/javaclass/dependencies/graph.rb, line 27 def resolve_dependencies @nodes.each do |node| puts "processing #{node}" node.outgoing_dependencies do |dependency| providers = nodes_satisfying(dependency.target) node.add_dependency(dependency, providers) end node.dependencies.values.each { |vals| vals.sort! } end end