class YPetri::Net::State::Feature::Flux
Flux
of a Petri net TS transition.
Attributes
instances[R]
transition[R]
Public Class Methods
new(id)
click to toggle source
# File lib/y_petri/net/state/feature/flux.rb, line 39 def new id instances[ id ] end
Also aliased as: __new__
new(id)
click to toggle source
The constructor of a marking feature takes exactly one argument (transition identifier).
# File lib/y_petri/net/state/feature/flux.rb, line 53 def initialize id @transition = net.transition id.is_a?( Flux ) ? id.transition : id end
of(transition_id)
click to toggle source
Alias of new method.
# File lib/y_petri/net/state/feature/flux.rb, line 45 def of transition_id new transition_id end
parametrize(*args)
click to toggle source
Customization of the Class#parametrize method.
# File lib/y_petri/net/state/feature/flux.rb, line 11 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 t = begin ç.net.TS_transitions( id ).first rescue TypeError => err msg = "Transition #{id} not " + "recognized as TS transition in " + "net #{ç.net}! (%s)" raise TypeError, msg % err end hsh[ id ] = ç.__new__( t ) else hsh[ ç.net.transition( id ) ] end end ) end end
Public Instance Methods
==(other)
click to toggle source
Flux
features are equal if they are of equal PS and refer to the same transition.
# File lib/y_petri/net/state/feature/flux.rb, line 96 def == other other.is_a? net.State.Feature.Flux and transition == other.transition end
extract_from(arg, **nn)
click to toggle source
Extracts the receiver marking feature from the argument. This can be typically a simulation instance.
# File lib/y_petri/net/state/feature/flux.rb, line 60 def extract_from arg, **nn case arg when YPetri::Simulation then arg.send( :TS_transitions, transition ).first.flux else fail TypeError, "Argument type not supported!" end end
inspect()
click to toggle source
Inspect string of the flux feature.
# File lib/y_petri/net/state/feature/flux.rb, line 89 def inspect "<Feature::Flux of #{transition.name ? transition.name : transition}>" end
label()
click to toggle source
Label for the flux feature (to use in the graphics etc.)
# File lib/y_petri/net/state/feature/flux.rb, line 83 def label "Φ:#{transition.name}" end
to_s()
click to toggle source
A string briefly describing the flux feature.
# File lib/y_petri/net/state/feature/flux.rb, line 77 def to_s label end
type()
click to toggle source
Type of this feature.
# File lib/y_petri/net/state/feature/flux.rb, line 71 def type :flux end