class SFRP::Flat::Set

Public Class Methods

new(&block) click to toggle source
# File lib/sfrp/flat/set.rb, line 9
def initialize(&block)
  @funcs = []
  @tconsts = []
  @vconsts = []
  @nodes = []
  @output_node_strs = []
  @init_func_strs = []
  block.call(self) if block
end

Public Instance Methods

<<(element) click to toggle source
# File lib/sfrp/flat/set.rb, line 37
def <<(element)
  case element
  when Function
    @funcs << element
  when TConst
    @tconsts << element
  when VConst
    @vconsts << element
  when Node
    @nodes << element
  else
    raise
  end
end
append_init_func_str(init_func_str) click to toggle source
# File lib/sfrp/flat/set.rb, line 33
def append_init_func_str(init_func_str)
  @init_func_strs << init_func_str
end
append_output_node_str(node_str) click to toggle source
# File lib/sfrp/flat/set.rb, line 29
def append_output_node_str(node_str)
  @output_node_strs << node_str
end
node(str) click to toggle source
# File lib/sfrp/flat/set.rb, line 56
def node(str)
  @nodes.find { |node| node.str == str }
end
tconst(str) click to toggle source
# File lib/sfrp/flat/set.rb, line 52
def tconst(str)
  @tconsts.find { |tconst| tconst.str == str }
end
to_poly() click to toggle source
# File lib/sfrp/flat/set.rb, line 19
def to_poly
  Poly::Set.new do |dest_set|
    (@funcs + @tconsts + @vconsts + @nodes).each do |element|
      element.to_poly(self, dest_set)
    end
    @output_node_strs.each { |s| dest_set.append_output_node_str(s) }
    @init_func_strs.each { |s| dest_set.append_init_func_str(s) }
  end
end