Module: YPetri::Transition::Types
- Defined in:
- lib/y_petri/transition/types.rb
Instance Method Summary collapse
-
#a? ⇒ Boolean
Is this a non-assignment transition? (Opposite of
#A?
). -
#assignment_action? ⇒ Boolean
(also: #assignment?, #A?)
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.).
-
#functional? ⇒ Boolean
Is the transition functional?.
-
#functionless? ⇒ Boolean
Opposite of #functional?.
-
#nonstoichiometric? ⇒ Boolean
(also: #s?)
Is this a non-stoichiometric transition?.
-
#stoichiometric? ⇒ Boolean
(also: #S?)
Is this a stoichiometric transition?.
-
#t ⇒ Object
Reports the transition’s membership in one of the 5 basic types using one-letter abbreviation:.
-
#timed? ⇒ Boolean
(also: #T?)
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.).
-
#timeless? ⇒ Boolean
(also: #t?)
Is the transition timeless? (Opposite of #timed?).
-
#TS? ⇒ Boolean
(also: #E?)
Is this a timed stoichiometric transition?.
-
#tS? ⇒ Boolean
(also: #C?)
Is this a timeless stoichiometric transition?.
-
#ts? ⇒ Boolean
(also: #B?)
Is this a timeless non-stoichiometric transition?.
-
#Ts? ⇒ Boolean
(also: #D?)
Is this a timed non-stoichiometric transition?.
-
#type ⇒ Object
Reports the transition’s membership in one of the 5 basic types using two-letter abbreviation + A for assignment transition.
-
#type_full ⇒ Object
Reports the transition’s membership in one of the 5 basic types as a full string.
Instance Method Details
#a? ⇒ Boolean
Is this a non-assignment transition? (Opposite of #A?
)
20 21 22 |
# File 'lib/y_petri/transition/types.rb', line 20 def a? ! assignment_action? end |
#assignment_action? ⇒ Boolean Also known as: assignment?, A?
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.)
12 13 14 |
# File 'lib/y_petri/transition/types.rb', line 12 def assignment_action? @assignment_action end |
#functional? ⇒ Boolean
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.
91 92 93 |
# File 'lib/y_petri/transition/types.rb', line 91 def functional? @functional end |
#functionless? ⇒ Boolean
Opposite of #functional?
97 98 99 |
# File 'lib/y_petri/transition/types.rb', line 97 def functionless? not functional? end |
#nonstoichiometric? ⇒ Boolean Also known as: s?
Is this a non-stoichiometric transition?
59 60 61 |
# File 'lib/y_petri/transition/types.rb', line 59 def nonstoichiometric? ! stoichiometric? end |
#stoichiometric? ⇒ Boolean Also known as: S?
Is this a stoichiometric transition?
54 |
# File 'lib/y_petri/transition/types.rb', line 54 def stoichiometric?; @stoichiometric end |
#t ⇒ Object
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)
110 111 112 113 |
# File 'lib/y_petri/transition/types.rb', line 110 def t return :A if assignment_action? timed? ? ( stoichiometric? ? :E : :D ) : ( stoichiometric? ? :C : :B ) end |
#timed? ⇒ Boolean Also known as: T?
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.)
69 70 71 72 |
# File 'lib/y_petri/transition/types.rb', line 69 def timed? return nil if A? @timed end |
#timeless? ⇒ Boolean Also known as: t?
Is the transition timeless? (Opposite of #timed?)
77 78 79 80 |
# File 'lib/y_petri/transition/types.rb', line 77 def timeless? return nil if A? not timed? end |
#TS? ⇒ Boolean Also known as: E?
Is this a timed stoichiometric transition?
47 48 49 |
# File 'lib/y_petri/transition/types.rb', line 47 def TS? type == :TS end |
#tS? ⇒ Boolean Also known as: C?
Is this a timeless stoichiometric transition?
33 34 35 |
# File 'lib/y_petri/transition/types.rb', line 33 def tS? type == :tS end |
#ts? ⇒ Boolean Also known as: B?
Is this a timeless non-stoichiometric transition?
26 27 28 |
# File 'lib/y_petri/transition/types.rb', line 26 def ts? type == :ts end |
#Ts? ⇒ Boolean Also known as: D?
Is this a timed non-stoichiometric transition?
40 41 42 |
# File 'lib/y_petri/transition/types.rb', line 40 def Ts? type == :Ts end |
#type ⇒ Object
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)
127 128 129 |
# File 'lib/y_petri/transition/types.rb', line 127 def type { A: :A, B: :ts, C: :tS, D: :Ts, E: :TS }[ t ] end |
#type_full ⇒ Object
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)
140 141 142 143 144 145 146 |
# 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 |