Module: YPetri::Simulation::TransitionRepresentation::Type_s
- Includes:
- Type_a
- Defined in:
- lib/y_petri/simulation/transition_representation/s.rb
Instance Method Summary collapse
-
#build_closure ⇒ Object
Builds the s transition's function into a closure.
-
#init ⇒ Object
Initialization subroutine.
-
#s? ⇒ Boolean
(also: #nonstoichiometric?)
True for stoichiometric transitions.
-
#S? ⇒ Boolean
(also: #stoichiometric?)
False for non-stoichiometric transitions.
Methods included from Type_a
Instance Method Details
#build_closure ⇒ Object
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.
34 35 36 37 38 |
# File 'lib/y_petri/simulation/transition_representation/s.rb', line 34 def build_closure mv, f = simulation.m_vector, function λ = "-> { Array f.( %s ) }" % domain_access_code( vector: :mv ) eval λ end |
#init ⇒ Object
Initialization subroutine.
25 26 27 |
# File 'lib/y_petri/simulation/transition_representation/s.rb', line 25 def init super end |
#s? ⇒ Boolean Also known as: nonstoichiometric?
True for stoichiometric transitions.
18 19 20 |
# File 'lib/y_petri/simulation/transition_representation/s.rb', line 18 def s? true end |
#S? ⇒ Boolean Also known as: stoichiometric?
False for non-stoichiometric transitions.
11 12 13 |
# File 'lib/y_petri/simulation/transition_representation/s.rb', line 11 def S? false end |