module YPetri::Transition::Types
Public Instance Methods
Is this a timed stoichiometric transition?
# File lib/y_petri/transition/types.rb, line 47 def TS? type == :TS end
Is this a timed non-stoichiometric transition?
# File lib/y_petri/transition/types.rb, line 40 def Ts? type == :Ts end
Is this a non-assignment transition? (Opposite of #A?
)
# File lib/y_petri/transition/types.rb, line 20 def a? ! assignment_action? end
Is this a transition with assignment action? (Transitions with assignment action, or “assignment transitions”, completely replace the marking of their codomain with their action closure result, like in spreadsheets.)
# File lib/y_petri/transition/types.rb, line 12 def assignment_action? @assignment_action end
Is the transition functional?
Explanation: If rate or action closure is supplied, a transition is always considered 'functional'. Otherwise, it is considered not 'functional'. Note that even transitions that are not functional still have standard action acc. to Petri's definition. Also note that a timed transition is necessarily functional.
# File lib/y_petri/transition/types.rb, line 91 def functional? @functional end
Opposite of functional?
# File lib/y_petri/transition/types.rb, line 97 def functionless? not functional? end
Is this a non-stoichiometric transition?
# File lib/y_petri/transition/types.rb, line 59 def nonstoichiometric? ! stoichiometric? end
Is this a stoichiometric transition?
# File lib/y_petri/transition/types.rb, line 54 def stoichiometric?; @stoichiometric end
Reports the transition's membership in one of the 5 basic types using one-letter abbreviation:
-
A .… assignment
-
B .… timeless nonstoichiometric (ts)
-
C .… timeless stoichiometric (tS)
-
D .… timed nonstoichiometric (Ts)
-
E .… timed stoichiometric (TS)
# File lib/y_petri/transition/types.rb, line 110 def t return :A if assignment_action? timed? ? ( stoichiometric? ? :E : :D ) : ( stoichiometric? ? :C : :B ) end
Is this a timeless stoichiometric transition?
# File lib/y_petri/transition/types.rb, line 33 def tS? type == :tS end
Does the transition's action depend on delta time? (Note that although A transitions are technically timeless, for pragmatic reasons, they are excluded from T/t classification, because they are generally handled differently in Petri net execution.)
# File lib/y_petri/transition/types.rb, line 69 def timed? return nil if A? @timed end
Is the transition timeless? (Opposite of timed?
)
# File lib/y_petri/transition/types.rb, line 77 def timeless? return nil if A? not timed? end
Is this a timeless non-stoichiometric transition?
# File lib/y_petri/transition/types.rb, line 26 def ts? type == :ts end
Reports the transition's membership in one of the 5 basic types using two-letter abbreviation + A for assignment transition. This methods reflects the fact that the new users may take time to memorize the meaning of A, B, C, D, E transition types. Two-letter abbreviations may be easier to figure out.
-
A .… assignment transitions (A-type)
-
ts .… timeless nonstoichiometric (B-type)
-
tS .… timeless stoichiometric (C-type)
-
Ts .… timed nonstoichiometric (D-type)
-
TS .… timed stoichiometric (E-type)
# File lib/y_petri/transition/types.rb, line 127 def type { A: :A, B: :ts, C: :tS, D: :Ts, E: :TS }[ t ] end
Reports the transition's membership in one of the 5 basic types as a full string.
-
assignment (A-type)
-
timeless nonstoichiometric (B-type)
-
timeless stoichiometric (C-type)
-
timed nonstoichiometric (D-type)
-
timed stoichiometric (E-type)
# File lib/y_petri/transition/types.rb, line 140 def type_full { A: "assignment", ts: "timeless nonstoichiometric", tS: "timeless stoichiometric", Ts: "timed nonstoichiometric", TS: "timed stoichiometric" }[ type ] end