module YPetri::Simulation::Transitions::Access

Public Instance Methods

include_transition?( transition )
includes_transition?( transition ) click to toggle source

Does a transition belong to the simulation?

# File lib/y_petri/simulation/transitions/access.rb, line 9
def includes_transition?( transition )
  true.tap { begin; transition( transition ); rescue NameError, TypeError
               return false
             end }
end
Also aliased as: include_transition?
t( transition ) click to toggle source

Net's transition.

# File lib/y_petri/simulation/transitions/access.rb, line 18
def t( transition )
  transition( transition ).source
end

Protected Instance Methods

A_Transitions( array ) click to toggle source

Simulation's A transitions. Expects a single array of A transitions or their ids and returns an array of the corresponding A transition representations.

# File lib/y_petri/simulation/transitions/access.rb, line 177
def A_Transitions( array )
  transitions.A.subset( array )
end
A_transitions( *transitions ) click to toggle source

Simulation's A transitions. Without arguments, returns all the A transitions of the simulation. Otherwise, it accepts an arbitrary number of A transitions or transition ids as arguments, and returns an array of the corresponding A transitions of the simulation.

# File lib/y_petri/simulation/transitions/access.rb, line 186
def A_transitions( *transitions )
  return transitions().A if transitions.empty?
  A_Transitions( transitions )
end
S_Transitions( array ) click to toggle source

Simulation's S transitions. Expects a single array of S transitions or their ids and returns an array of the corresponding S transition representations.

# File lib/y_petri/simulation/transitions/access.rb, line 213
def S_Transitions( array )
  transitions.S.subset( array )
end
S_transitions( *transitions ) click to toggle source

Simulation's S transitions. Without arguments, returns all the S transitions of the simulation. Otherwise, it accepts an arbitrary number of S transitions or transition ids as arguments, and returns an array of the corresponding S transitions of the simulation.

# File lib/y_petri/simulation/transitions/access.rb, line 222
def S_transitions( *transitions )
  return transitions().S if transitions.empty?
  S_Transitions( transitions )
end
TS_Transitions( array ) click to toggle source

Simulation's TS transitions. Expects a single array of TS transitions or their ids and returns an array of the corresponding TS transition representations.

# File lib/y_petri/simulation/transitions/access.rb, line 159
def TS_Transitions( array )
  transitions.TS.subset( array )
end
TS_transitions( *transitions ) click to toggle source

Simulation's TS transitions. Without arguments, returns all the TS transitions of the simulation. Otherwise, it accepts an arbitrary number of TS transitions or transition ids as arguments, and returns an array of the corresponding TS transitions of the simulation.

# File lib/y_petri/simulation/transitions/access.rb, line 168
def TS_transitions( *transitions )
  return transitions().TS if transitions.empty?
  TS_Transitions( transitions )
end
T_Transitions( array ) click to toggle source

Simulation's T transitions. Expects a single array of T transitions or their ids and returns an array of the corresponding T transition representations.

# File lib/y_petri/simulation/transitions/access.rb, line 249
def T_Transitions( array )
  transitions.T.subset( array )
end
T_transitions( *transitions ) click to toggle source

Simulation's T transitions. Without arguments, returns all the T transitions of the simulation. Otherwise, it accepts an arbitrary number of T transitions or transition ids as arguments, and returns an array of the corresponding T transitions of the simulation.

# File lib/y_petri/simulation/transitions/access.rb, line 258
def T_transitions( *transitions )
  return transitions().T if transitions.empty?
  T_Transitions( transitions )
end
Transitions( array ) click to toggle source

Constructs an instance of @Transitions parametrized subclass. Expects a single array of transitions or transition ids and returns an array of corresponding transition representations in the simulation. Note that the includer of the Transitions::Access module normally overloads :Transitions message in such way, that even without an argument, it does not fil, but returns @Transitions parametrized subclass itself.

# File lib/y_petri/simulation/transitions/access.rb, line 87
def Transitions( array )
  TransitionsPS().load array.map &method( :transition )
end
Ts_Transitions( array ) click to toggle source

Simulation's Ts transitions. Expects a single array of Ts transitions or their ids and returns an array of the corresponding Ts transition representations.

# File lib/y_petri/simulation/transitions/access.rb, line 141
def Ts_Transitions( array )
  transitions.Ts.subset( array )
end
Ts_transitions( *transitions ) click to toggle source

Simulation's Ts transitions. Without arguments, returns all the Ts transitions of the simulation. Otherwise, it accepts an arbitrary number of Ts transitions or transition ids as arguments, and returns an array of the corresponding Ts transitions of the simulation.

# File lib/y_petri/simulation/transitions/access.rb, line 150
def Ts_transitions( *transitions )
  return transitions().Ts if transitions.empty?
  Ts_Transitions( transitions )
end
a_Transitions( array ) click to toggle source

Simulation's a transitions. Expects a single array of a transitions or their ids and returns an array of the corresponding a transition representations.

# File lib/y_petri/simulation/transitions/access.rb, line 195
def a_Transitions( array )
  transitions.a.subset( array )
end
a_transitions( *transitions ) click to toggle source

Simulation's a transitions. Without arguments, returns all the a transitions of the simulation. Otherwise, it accepts an arbitrary number of a transitions or transition ids as arguments, and returns an array of the corresponding a transitions of the simulation.

# File lib/y_petri/simulation/transitions/access.rb, line 204
def a_transitions( *transitions )
  return transitions().a if transitions.empty?
  a_Transitions( transitions )
end
s_Transitions( array ) click to toggle source

Simulation's s transitions. Expects a single array of s transitions or their ids and returns an array of the corresponding s transition representations.

# File lib/y_petri/simulation/transitions/access.rb, line 231
def s_Transitions( array )
  transitions.s.subset( array )
end
s_transitions( *transitions ) click to toggle source

Simulation's s transitions. Without arguments, returns all the s transitions of the simulation. Otherwise, it accepts an arbitrary number of s transitions or transition ids as arguments, and returns an array of the corresponding s transitions of the simulation.

# File lib/y_petri/simulation/transitions/access.rb, line 240
def s_transitions( *transitions )
  return transitions().s if transitions.empty?
  s_Transitions( transitions )
end
tS_Transitions( array ) click to toggle source

Simulation's tS transitions. Expects a single array of tS transitions or their ids and returns an array of the corresponding tS transition representations.

# File lib/y_petri/simulation/transitions/access.rb, line 123
def tS_Transitions( array )
  transitions.tS.subset( array )
end
tS_transitions( *transitions ) click to toggle source

Simulation's tS transitions. Without arguments, returns all the tS transitions of the simulation. Otherwise, it accepts an arbitrary number of tS transitions or transition ids as arguments, and returns an array of the corresponding tS transitions of the simulation.

# File lib/y_petri/simulation/transitions/access.rb, line 132
def tS_transitions( *transitions )
  return transitions().tS if transitions.empty?
  tS_Transitions( transitions )
end
t_Transitions( array ) click to toggle source

Simulation's t transitions. Expects a single array of t transitions or their ids and returns an array of the corresponding t transition representations.

# File lib/y_petri/simulation/transitions/access.rb, line 267
def t_Transitions( array )
  transitions.t.subset( array )
end
t_transitions( *transitions ) click to toggle source

Simulation's t transitions. Without arguments, returns all the t transitions of the simulation. Otherwise, it accepts an arbitrary number of t transitions or transition ids as arguments, and returns an array of the corresponding t transitions of the simulation.

# File lib/y_petri/simulation/transitions/access.rb, line 276
def t_transitions( *transitions )
  return transitions().t if transitions.empty?
  t_Transitions( transitions )
end
transition( transition ) click to toggle source

Transition instance identification.

# File lib/y_petri/simulation/transitions/access.rb, line 68
def transition( transition )
  begin; TransitionPS().instance( transition ); rescue NameError, TypeError
    begin
      transition = net.transition( transition )
      TransitionPS().instances.find { |t_rep| t_rep.source == transition } || 
        TransitionPS().instance( transition.name )
    rescue NameError, TypeError => msg
      fail TypeError, "Unknown transition instance: #{transition}! (#{msg})"
    end
  end
end
transitions( *transitions ) click to toggle source

Without arguments, returns all the transition representations in the simulation. Otherwise, it accepts an arbitrary number of nodes or node ids as arguments, and returns an array of the corresponding transition representations.

# File lib/y_petri/simulation/transitions/access.rb, line 96
def transitions( *transitions )
  return @transitions if transitions.empty?
  Transitions( transitions )
end
ts_Transitions( array ) click to toggle source

Simulation's ts transitions. Expects a single array of ts transitions or their ids and returns an array of the corresponding ts transition representations.

# File lib/y_petri/simulation/transitions/access.rb, line 105
def ts_Transitions( array )
  transitions.ts.subset( array )
end
ts_transitions( *transitions ) click to toggle source

Simulation's ts transitions. Without arguments, returns all the ts transitions of the simulation. Otherwise, it accepts an arbitrary number of ts transitions or transition ids as arguments, and returns an array of the corresponding ts transitions of the simulation.

# File lib/y_petri/simulation/transitions/access.rb, line 114
def ts_transitions( *transitions )
  return transitions().ts if transitions.empty?
  ts_Transitions( transitions )
end