class Flowckerc::SolverClass::LinksSolver

Public Class Methods

new(syms) click to toggle source
# File lib/flowckerc.rb, line 88
def initialize syms
  @syms = syms
end

Public Instance Methods

solve(links) click to toggle source
# File lib/flowckerc.rb, line 92
def solve links
  links.each do |link|
    if link.from_atom.is_a? Symbol
      solve_src link
    end
    if link.to_atom.is_a? Symbol
      solve_dst link
    end
  end
end
solve_dst(link) click to toggle source
# File lib/flowckerc.rb, line 116
def solve_dst link
  name = link.to_atom
  port = link.to_port
  if @syms.isAtom name
    link.to_atom = @syms.getId name
  else
    solution = @syms.value name
    actual_port =  solution.molecule_ports.inportByName port
    link.to_atom = actual_port[:to_atom]
    link.to_port = actual_port[:to_port]
  end
end
solve_src(link) click to toggle source
# File lib/flowckerc.rb, line 103
def solve_src link
  name = link.from_atom
  port = link.from_port
  if @syms.isAtom name
    link.from_atom = @syms.getId name
  else
    solution = @syms.value name
    actual_port =  solution.molecule_ports.outportByName port
    link.from_atom = actual_port[:from_atom]
    link.from_port = actual_port[:from_port]
  end
end