Module: YPetri::Simulation::TransitionRepresentation::Type_s

Includes:
Type_a
Included in:
Type_Ts, Type_ts
Defined in:
lib/y_petri/simulation/transition_representation/s.rb

Instance Method Summary collapse

Methods included from Type_a

#A?, #a?, #delta

Instance Method Details

#build_closureObject

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

#initObject

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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


11
12
13
# File 'lib/y_petri/simulation/transition_representation/s.rb', line 11

def S?
  false
end