Class: Pione::PNML::FlowRuleBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/pione/pnml/compiler.rb

Overview

FlowRuleBuilder builds a flow rule definition for PNML net.

Instance Method Summary collapse

Constructor Details

#initialize(net, net_name, env) ⇒ FlowRuleBuilder

Returns a new instance of FlowRuleBuilder.

Parameters:



389
390
391
392
393
# File 'lib/pione/pnml/compiler.rb', line 389

def initialize(net, net_name, env)
  @net = net
  @net_name = net_name
  @env = env
end

Instance Method Details

#build(flow_elements, params, features, variable_bindings) ⇒ RuleDefinition

Build a flow rule definition for PNML net.

Parameters:

  • flow_elements (Array)

    flow elements

Returns:



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/pione/pnml/compiler.rb', line 401

def build(flow_elements, params, features, variable_bindings)
  inputs = @net.places.select {|place| Perspective.net_input_data_place?(@env, place)}
  inputs = inputs.map {|input| InputData.new(input)}

  outputs = @net.places.select {|place| Perspective.net_output_data_place?(@env, place)}
  outputs = outputs.map {|output| OutputData.new(output)}

  option = {
    :inputs => inputs,
    :outputs => outputs,
    :params => params,
    :features => features,
    :variable_bindings => variable_bindings,
    :flow_elements => flow_elements
  }

  RuleDefinition.new(@net_name, :flow, false, @net_name, 0, option)
end