lib/spnet/core/link.rb
def save_state blocks
    from, to = nil, nil
    
    blocks.each do |block_name, block|
      block.out_ports.each do |port_name, port|
        if port == @from
          from = PortLocater.new(:block_name => block_name, :port_name => port_name)
          break
        end
      end
      
      block.in_ports.each do |port_name, port|
        if port == @to
          to = PortLocater.new(:block_name => block_name, :port_name => port_name)
          break
        end
      end
    end
    
    raise "could not find from port" if from.nil?
    raise "could not find to port" if to.nil?
    return LinkState.new(:from => from, :to => to)
  end
# Produce a LinkState object from the current Link object.
Produce a LinkState object from the current Link object.
Produce a LinkState object from the current Link object .
def save_state blocks
    from, to = nil, nil
    blocks.each do |block_name, block|
      block.out_ports.each do |port_name, port|
        if port == @from
          from = PortLocater.new(:block_name => block_name, :port_name => port_name)
          break
        end
      end
      block.in_ports.each do |port_name, port|
        if port == @to
          to = PortLocater.new(:block_name => block_name, :port_name => port_name)
          break
        end
      end
    end
    raise "could not find from port" if from.nil?
    raise "could not find to port" if to.nil?
    return LinkState.new(:from => from, :to => to)
  end
def save_state blocks from , to = nil , nil blocks . each do | block_name , block | block . out_ports . each do | port_name , port | if port == @from from = PortLocater . new ( :block_name => block_name , :port_name => port_name ) break end end block . in_ports . each do | port_name , port | if port == @to to = PortLocater . new ( :block_name => block_name , :port_name => port_name ) break end end end raise "could not find from port" if from . nil? raise "could not find to port" if to . nil? return LinkState . new ( :from => from , :to => to ) end
Produce a LinkState object from the current Link object.
Produce a LinkState object from the current Link object .
blocks