Sha256: 16ba9641db51d1d468b79c02e0a60dd98f4a0481124de4260a9707f494c5ec2d
Contents?: true
Size: 1.01 KB
Versions: 7
Compression:
Stored size: 1.01 KB
Contents
#encoding: utf-8 # A mixin for collections of A transitions. # class YPetri::Simulation::Transitions module Type_A attr_reader :assignment_closure def initialize @assignment_closure = to_assignment_closure end # Assignment closures that directly affect the marking when called. # def assignment_closures map &:assignment_closure end # Combined assignment action, as it would occur if these A transitions fired # in order, as hash place >> action. # def action each_with_object Hash.new do |t, hsh| hsh.update( t.action ) end end # Returns the assignments to all places, as they would happen if A transition # could change their values. # def act each_with_object Hash.new do |t, hsh| hsh.update( t.act ) end end # Builds a joint assignment closure. # def to_assignment_closure closures = assignment_closures -> { closures.each &:call } end end # Type_A end # class YPetri::Simulation::Transitions
Version data entries
7 entries across 7 versions & 1 rubygems