lib/y_petri/net.rb in y_petri-2.0.3 vs lib/y_petri/net.rb in y_petri-2.0.7

- old
+ new

@@ -111,25 +111,41 @@ # Methods exposing transition collections acc. to their properties: # Array of <em>ts</em> transitions in the net. # def timeless_nonstoichiometric_transitions - transitions.select{ |t| t.timeless? and t.nonstoichiometric? } + transitions.select { |t| t.timeless? && t.nonstoichiometric? } end alias ts_transitions timeless_nonstoichiometric_transitions # Names of <em>ts</em> transitions in the net. # def timeless_nonstoichiometric_tt timeless_nonstoichiometric_transitions.map &:name end alias ts_tt timeless_nonstoichiometric_tt + # Array of <em>tsa</em> transitions in the net. + # + def timeless_nonstoichiometric_nonassignment_transitions + transitions.select { |t| + t.timeless? && t.nonstoichiometric? && ! t.assignment_action? + } + end + alias tsa_transitions timeless_nonstoichiometric_nonassignment_transitions + + # Names of <em>tsa</em> transitions in the net. + # + def timeless_nonstoichiometric_nonassignment_tt + timeless_nonstoichiometric_nonassignment_transitions.map &:name + end + alias tsa_tt timeless_nonstoichiometric_nonassignment_tt + # Array of <em>tS</em> transitions in the net. # def timeless_stoichiometric_transitions - transitions.select{ |t| t.timeless? and t.stoichiometric? } + transitions.select { |t| t.timeless? && t.stoichiometric? } end alias tS_transitions timeless_stoichiometric_transitions # Names of <em>tS</em> transitions in the net. # @@ -139,11 +155,11 @@ alias tS_tt timeless_stoichiometric_tt # Array of <em>Tsr</em> transitions in the net. # def timed_nonstoichiometric_transitions_without_rate - transitions.select{ |t| t.timed? and t.nonstoichiometric? and t.rateless? } + transitions.select { |t| t.timed? && t.nonstoichiometric? && t.rateless? } end alias timed_rateless_nonstoichiometric_transitions \ timed_nonstoichiometric_transitions_without_rate alias Tsr_transitions timed_nonstoichiometric_transitions_without_rate @@ -157,11 +173,11 @@ alias Tsr_tt timed_nonstoichiometric_tt_without_rate # Array of <em>TSr</em> transitions in the net. # def timed_stoichiometric_transitions_without_rate - transitions.select { |t| t.timed? and t.stoichiometric? and t.rateless? } + transitions.select { |t| t.timed? && t.stoichiometric? && t.rateless? } end alias timed_rateless_stoichiometric_transitions \ timed_stoichiometric_transitions_without_rate alias TSr_transitions timed_stoichiometric_transitions_without_rate @@ -174,11 +190,11 @@ alias Tsr_tt timed_stoichiometric_tt_without_rate # Array of <em>sR</em> transitions in the net. # def nonstoichiometric_transitions_with_rate - transitions.select { |t| t.has_rate? and t.nonstoichiometric? } + transitions.select { |t| t.has_rate? && t.nonstoichiometric? } end alias sR_transitions nonstoichiometric_transitions_with_rate # Names of <em>sR</em> transitions in the net. # @@ -202,27 +218,22 @@ alias SR_tt stoichiometric_tt_with_rate # Array of transitions with <em>explicit assignment action</em> # (<em>A</em> transitions) in the net. # - def transitions_with_explicit_assignment_action + def assignment_transitions transitions.select { |t| t.assignment_action? } end - alias transitions_with_assignment_action \ - transitions_with_explicit_assignment_action - alias assignment_transitions transitions_with_explicit_assignment_action - alias A_transitions transitions_with_explicit_assignment_action + alias A_transitions assignment_transitions # Names of transitions with <em>explicit assignment action</em> # (<em>A</em> transitions) in the net. # - def tt_with_explicit_assignment_action - transitions_with_explicit_assignment_action.map &:name + def assignment_tt + assignment_transitions.map &:name end - alias tt_with_assignment_action tt_with_explicit_assignment_action - alias assignment_tt tt_with_assignment_action - alias A_tt tt_with_assignment_action + alias A_tt assignment_tt # Array of <em>stoichiometric</em> transitions in the net. # def stoichiometric_transitions transitions.select &:stoichiometric? @@ -304,19 +315,17 @@ # ==== Simulation constructors # Creates a new simulation from the net. # - def new_simulation *args - oo = args.extract_options! - YPetri::Simulation.new *args, oo.merge( net: self ) + def new_simulation( **named_args ) + YPetri::Simulation.new **named_args.merge( net: self ) end # Creates a new timed simulation from the net. # - def new_timed_simulation *args - oo = args.extract_options! - YPetri::TimedSimulation.new oo.merge( net: self ) + def new_timed_simulation( **named_args ) + YPetri::TimedSimulation.new **named_args.merge( net: self ) end # ==== Sundry methods # Networks are equal when their places and transitions are equal.