Module: YPetri::Transition::TypeInformation

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

Instance Method Summary collapse

Instance Method Details

#a?Boolean

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

Returns:

  • (Boolean)


100
101
102
# File 'lib/y_petri/transition/type.rb', line 100

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)


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

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)


62
63
64
# File 'lib/y_petri/transition/type.rb', line 62

def functional?
  @functional
end

#functionless?Boolean

Opposite of #functional?

Returns:

  • (Boolean)


68
69
70
# File 'lib/y_petri/transition/type.rb', line 68

def functionless?
  not functional?
end

#nonstoichiometric?Boolean Also known as: s?

Is this a non-stoichiometric transition?

Returns:

  • (Boolean)


35
36
37
# File 'lib/y_petri/transition/type.rb', line 35

def nonstoichiometric?
  ! stoichiometric?
end

#stoichiometric?Boolean Also known as: S?

Is this a stoichiometric transition?

Returns:

  • (Boolean)


30
# File 'lib/y_petri/transition/type.rb', line 30

def stoichiometric?; @stoichiometric end

#timed?Boolean Also known as: T?

Does the transition’s action depend on delta time?

Returns:

  • (Boolean)


42
43
44
# File 'lib/y_petri/transition/type.rb', line 42

def timed?
  @timed
end

#timeless?Boolean Also known as: t?

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

Returns:

  • (Boolean)


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

def timeless?
  not timed?
end

#ts?Boolean

Is this a timeless non-stoichiometric transition?

Returns:

  • (Boolean)


24
25
26
# File 'lib/y_petri/transition/type.rb', line 24

def ts?
  type == :ts
end

#Ts?Boolean

Is this a timed non-stoichiometric transition?

Returns:

  • (Boolean)


12
13
14
# File 'lib/y_petri/transition/type.rb', line 12

def Ts?
  type == :Ts
end

#TS?Boolean

Is this a timed stoichiometric transition?

Returns:

  • (Boolean)


6
7
8
# File 'lib/y_petri/transition/type.rb', line 6

def TS?
  type == :TS
end

#tS?Boolean

Is this a timeless stoichiometric transition?

Returns:

  • (Boolean)


18
19
20
# File 'lib/y_petri/transition/type.rb', line 18

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



83
84
85
86
# File 'lib/y_petri/transition/type.rb', line 83

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