Module: YPetri::Simulation::Transitions::Type_A

Defined in:
lib/y_petri/simulation/transitions/A.rb

Instance Method Summary collapse

Instance Method Details

#actObject

Returns the assignments to all places, as they would happen if A transition could change their values.



26
27
28
# File 'lib/y_petri/simulation/transitions/A.rb', line 26

def act
  each_with_object Hash.new do |t, hsh| hsh.update( t.act ) end
end

#actionObject

Combined assignment action, as it would occur if these A transitions fired in order, as hash place >> action.



19
20
21
# File 'lib/y_petri/simulation/transitions/A.rb', line 19

def action
  each_with_object Hash.new do |t, hsh| hsh.update( t.action ) end
end

#assignment_closuresObject

Assignment closures that directly affect the marking when called.



12
13
14
# File 'lib/y_petri/simulation/transitions/A.rb', line 12

def assignment_closures
  map &:assignment_closure
end

#initializeObject



7
8
# File 'lib/y_petri/simulation/transitions/A.rb', line 7

def initialize
end

#to_assignment_closureObject Also known as: assignment_closure

Builds a joint assignment closure.



32
33
34
35
# File 'lib/y_petri/simulation/transitions/A.rb', line 32

def to_assignment_closure
  closures = assignment_closures
  -> { closures.each &:call }
end