lib/y_petri/transition.rb in y_petri-2.0.2 vs lib/y_petri/transition.rb in y_petri-2.0.3
- old
+ new
@@ -373,29 +373,23 @@
#
# <tt>Transition( stoichiometry: { A: -1, B: 1 },
# rate: λ { |a| a * 0.5 } )
#
def initialize *args
- # do the big work of checking in the arguments
- check_in_arguments *args
- # Inform upstream and downstream places they have been connected:
- inform_upstream_places
- inform_downstream_places
- @cocked = false # transitions initialize uncocked
+ check_in_arguments *args # the big work of checking in args
+ inform_upstream_places # that they have been connected
+ inform_downstream_places # that they have been connected
+ @cocked = false # transitions initialize uncocked
end
# Marking of the domain places.
#
- def domain_marking
- domain.map &:marking
- end
+ def domain_marking; domain.map &:marking end
# Marking of the codomain places.
#
- def codomain_marking
- codomain.map &:marking
- end
+ def codomain_marking; codomain.map &:marking end
# Result of the transition's "function", regardless of the #enabled? status.
#
def action Δt=nil
raise ArgumentError, "Δtime argument required for timed transitions!" if
@@ -586,27 +580,18 @@
# else then defining the duck type of the input argument collection.
# TypeError is therefore raised if invalid collection has been supplied.
#
def check_in_arguments *args
oo = args.extract_options!
- oo.may_have :stoichiometry, syn!: [ :stoichio,
- :s ]
- oo.may_have :codomain, syn!: [ :codomain_arcs,
- :codomain_places,
+ oo.may_have :stoichiometry, syn!: [ :stoichio, :s ]
+ oo.may_have :codomain, syn!: [ :codomain_arcs, :codomain_places,
:downstream,
- :downstream_arcs,
- :downstream_places,
+ :downstream_arcs, :downstream_places,
:action_arcs ]
- oo.may_have :domain, syn!: [ :domain_arcs,
- :domain_places,
- :upstream,
- :upstream_arcs,
- :upstream_places ]
- oo.may_have :rate, syn!: [ :flux,
- :propensity,
- :rate_closure,
- :flux_closure,
- :propensity_closure ]
+ oo.may_have :domain, syn!: [ :domain_arcs, :domain_places,
+ :upstream, :upstream_arcs, :upstream_places ]
+ oo.may_have :rate, syn!: [ :rate_closure,
+ :propensity, :propensity_closure ]
oo.may_have :action, syn!: :action_closure
oo.may_have :timed
@has_rate = oo.has? :rate # was the rate was given?