module Tengine::Job::Structure::JobnetFinder
Public Instance Methods
find_descendant(vertex_id)
click to toggle source
# File lib/tengine/job/structure/jobnet_finder.rb, line 18 def find_descendant(vertex_id) vertex_id = String(vertex_id) return nil if vertex_id == self.id.to_s vertex(vertex_id) end
find_descendant_by_name_path(name_path)
click to toggle source
# File lib/tengine/job/structure/jobnet_finder.rb, line 31 def find_descendant_by_name_path(name_path) return nil if name_path == self.name_path vertex_by_name_path(name_path) end
find_descendant_edge(edge_id)
click to toggle source
# File lib/tengine/job/structure/jobnet_finder.rb, line 5 def find_descendant_edge(edge_id) edge_id = String(edge_id) visitor = Tengine::Job::Structure::Visitor::Any.new do |vertex| if vertex.respond_to?(:edges) vertex.edges.detect{|edge| edge.id.to_s == edge_id} else nil end end visitor.visit(self) end
Also aliased as: edge
vertex(vertex_id)
click to toggle source
# File lib/tengine/job/structure/jobnet_finder.rb, line 24 def vertex(vertex_id) vertex_id = String(vertex_id) return self if vertex_id == self.id.to_s visitor = Tengine::Job::Structure::Visitor::Any.new{|v| vertex_id == v.id.to_s ? v : nil } visitor.visit(self) end
vertex_by_absolute_name_path(name_path)
click to toggle source
# File lib/tengine/job/structure/jobnet_finder.rb, line 42 def vertex_by_absolute_name_path(name_path) return self if name_path.to_s == self.name_path visitor = Tengine::Job::Structure::Visitor::Any.new do |vertex| if name_path == (vertex.respond_to?(:name_path) ? vertex.name_path : nil) vertex else nil end end visitor.visit(self) end
vertex_by_name_path(name_path)
click to toggle source
# File lib/tengine/job/structure/jobnet_finder.rb, line 36 def vertex_by_name_path(name_path) Tengine::Job::Structure::NamePath.absolute?(name_path) ? root.vertex_by_absolute_name_path(name_path) : vertex_by_relative_name_path(name_path) end
vertex_by_relative_name_path(name_path)
click to toggle source
# File lib/tengine/job/structure/jobnet_finder.rb, line 54 def vertex_by_relative_name_path(name_path) head, tail = *name_path.split(Tengine::Job::Structure::NamePath::SEPARATOR, 2) child = child_by_name(head) tail ? child.vertex_by_relative_name_path(tail) : child end