Sha256: e09e41220094c39412b5427b0c3861623a1e5f984ca6330acadaa21b16e77340

Contents?: true

Size: 1001 Bytes

Versions: 17

Compression:

Stored size: 1001 Bytes

Contents

# encoding: utf-8

# A mixin for s (nonstoichiometric) transition representations.
# 
class YPetri::Simulation::TransitionRepresentation
  module Type_s
    include Type_a
    
    # False for non-stoichiometric transitions.
    # 
    def S?
      false
    end
    alias stoichiometric? S?
    
    # True for stoichiometric transitions.
    # 
    def s?
      true
    end
    alias nonstoichiometric? s?
    
    # Initialization subroutine.
    # 
    def init
      super
    end

    # Builds the s transition's function into a closure. Functions for s
    # transitions (nonstoichiometric transitions) have return value arity
    # equal to the codomain size. The returned closure here ensures that
    # the return value is always of Array type.
    # 
    def build_closure
      mv, f = simulation.m_vector, function
      λ = "-> { Array f.( %s ) }" % domain_access_code( vector: :mv )
      eval λ
    end
  end # module Type_s
end # class YPetri::Simulation::TransitionRepresentation

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
y_petri-2.4.9 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.4.8 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.4.6 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.4.4 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.4.3 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.4.2 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.4.0 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.3.12 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.3.11 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.3.10 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.3.9 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.3.8 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.3.6 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.3.5 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.3.4 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.3.3 lib/y_petri/simulation/transition_representation/s.rb
y_petri-2.3.2 lib/y_petri/simulation/transition_representation/s.rb