Module: YPetri::Transition::Types

Defined in:
lib/y_petri/transition/types.rb

Instance Method Summary collapse

Instance Method Details

#a?Boolean

Is this a non-assignment transition? (Opposite of #A?)

Returns:

  • (Boolean)


109
110
111
# File 'lib/y_petri/transition/types.rb', line 109

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.)

Returns:

  • (Boolean)


101
102
103
# File 'lib/y_petri/transition/types.rb', line 101

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.

Returns:

  • (Boolean)


71
72
73
# File 'lib/y_petri/transition/types.rb', line 71

def functional?
  @functional
end

#functionless?Boolean

Opposite of #functional?

Returns:

  • (Boolean)


77
78
79
# File 'lib/y_petri/transition/types.rb', line 77

def functionless?
  not functional?
end

#nonstoichiometric?Boolean Also known as: s?

Is this a non-stoichiometric transition?

Returns:

  • (Boolean)


39
40
41
# File 'lib/y_petri/transition/types.rb', line 39

def nonstoichiometric?
  ! stoichiometric?
end

#stoichiometric?Boolean Also known as: S?

Is this a stoichiometric transition?

Returns:

  • (Boolean)


34
# File 'lib/y_petri/transition/types.rb', line 34

def stoichiometric?; @stoichiometric 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.)

Returns:

  • (Boolean)


49
50
51
52
# File 'lib/y_petri/transition/types.rb', line 49

def timed?
  return nil if A?
  @timed
end

#timeless?Boolean Also known as: t?

Is the transition timeless? (Opposite of #timed?)

Returns:

  • (Boolean)


57
58
59
60
# File 'lib/y_petri/transition/types.rb', line 57

def timeless?
  return nil if A?
  not timed?
end

#ts?Boolean

Is this a timeless non-stoichiometric transition?

Returns:

  • (Boolean)


28
29
30
# File 'lib/y_petri/transition/types.rb', line 28

def ts?
  type == :ts
end

#Ts?Boolean

Is this a timed non-stoichiometric transition?

Returns:

  • (Boolean)


16
17
18
# File 'lib/y_petri/transition/types.rb', line 16

def Ts?
  type == :Ts
end

#TS?Boolean

Is this a timed stoichiometric transition?

Returns:

  • (Boolean)


10
11
12
# File 'lib/y_petri/transition/types.rb', line 10

def TS?
  type == :TS
end

#tS?Boolean

Is this a timeless stoichiometric transition?

Returns:

  • (Boolean)


22
23
24
# File 'lib/y_petri/transition/types.rb', line 22

def tS?
  type == :tS
end

#typeObject

Reports the transition’s membership in one of the 4 basic types:

  1. TS .… timed stoichiometric

  2. tS .… timeless stoichiometric

  3. Ts .… timed nonstoichiometric

  4. ts .… timeless nonstoichiometric

plus the fifth type

  1. A .… assignment transitions



92
93
94
95
# File 'lib/y_petri/transition/types.rb', line 92

def type
  return :A if assignment_action?
  timed? ? ( stoichiometric? ? :TS : :Ts ) : ( stoichiometric? ? :tS : :ts )
end