lib/y_petri/net/state/feature/firing.rb in y_petri-2.1.3 vs lib/y_petri/net/state/feature/firing.rb in y_petri-2.1.6
- old
+ new
@@ -1,57 +1,54 @@
# encoding: utf-8
-class YPetri::Net::State
- class Feature
- # Firing of a Petri net tS transition.
- #
- class Firing < Feature
- attr_reader :transition
- class << self
- def parametrize *args
- Class.instance_method( :parametrize ).bind( self ).( *args ).tap do |ç|
- ç.instance_variable_set( :@instances,
- Hash.new do |hsh, id|
- case id
- when Firing then
- hsh[ id.transition ]
- when ç.net.Transition then
- hsh[ id ] = ç.__new__( id )
- else
- hsh[ ç.net.transition( id ) ]
- end
- end )
- end
- end
+# Firing of a Petri net tS transition.
+#
+class YPetri::Net::State::Feature::Firing < YPetri::Net::State::Feature
+ attr_reader :transition
- attr_reader :instances
+ class << self
+ def parametrize *args
+ Class.instance_method( :parametrize ).bind( self ).( *args ).tap do |ç|
+ ç.instance_variable_set( :@instances,
+ Hash.new do |hsh, id|
+ case id
+ when self then
+ hsh[ id.transition ]
+ when ç.net.Transition then
+ hsh[ id ] = ç.__new__( id )
+ else
+ hsh[ ç.net.transition( id ) ]
+ end
+ end )
+ end
+ end
- alias __new__ new
+ attr_reader :instances
- def new id
- instances[ id ]
- end
+ alias __new__ new
- def of id
- new id
- end
- end
+ def new id
+ instances[ id ]
+ end
- def initialize transition
- @transition = net.transition( transition )
- end
+ def of id
+ new id
+ end
+ end
- def extract_from arg, **nn
- case arg
- when YPetri::Simulation then
- arg.send( :tS_transitions, [ transition ] ).firing.first
- else
- fail TypeError, "Argument type not supported!"
- end
- end
+ def initialize transition
+ @transition = net.transition( transition )
+ end
- def label
- "f:#{transition.name}"
- end
- end # class Firing
- end # class Feature
-end # YPetri::Net::State
+ def extract_from arg, **nn
+ case arg
+ when YPetri::Simulation then
+ arg.send( :tS_transitions, [ transition ] ).firing.first
+ else
+ fail TypeError, "Argument type not supported!"
+ end
+ end
+
+ def label
+ "f:#{transition.name}"
+ end
+end # YPetri::Net::State::Feature::Firing