class YPetri::Net::State::Feature::Marking
Marking
of a Petri net place.
Attributes
instances[R]
place[R]
Public Class Methods
new(id)
click to toggle source
# File lib/y_petri/net/state/feature/marking.rb, line 37 def new id instances[ id ] end
Also aliased as: __new__
new(place)
click to toggle source
The constructor of a marking feature takes exactly one argument (place identifier).
# File lib/y_petri/net/state/feature/marking.rb, line 51 def initialize place @place = net.place( place ) end
of(id)
click to toggle source
Alias of new method.
# File lib/y_petri/net/state/feature/marking.rb, line 43 def of id new id end
parametrize(*args)
click to toggle source
Customization of the Class#parametrize method.
# File lib/y_petri/net/state/feature/marking.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.place ] when ç.net.Place then p = begin ç.net.place id rescue TypeError => err raise TypeError, "Place #{id} not " + "present in net #{ç.net}! (#{err})" end hsh[ id ] = ç.__new__( id ) else hsh[ ç.net.place( id ) ] end end ) end end
Public Instance Methods
==(other)
click to toggle source
Marking
features are equal if they are of equal PS and refer to the same place.
# File lib/y_petri/net/state/feature/marking.rb, line 94 def == other other.is_a? net.State.Feature.Marking and place == other.place 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/marking.rb, line 58 def extract_from arg, **nn case arg when YPetri::Simulation then arg.m( place ).first else fail TypeError, "Argument type not supported!" end end
inspect()
click to toggle source
Inspect string of the marking feature.
# File lib/y_petri/net/state/feature/marking.rb, line 87 def inspect "<Feature::Marking of #{place.name ? place.name : place}>" end
label()
click to toggle source
Label for the marking feature (to use in graphics etc.)
# File lib/y_petri/net/state/feature/marking.rb, line 81 def label ":#{place.name}" end
to_s()
click to toggle source
A string briefly describing the marking feature.
# File lib/y_petri/net/state/feature/marking.rb, line 75 def to_s "m:#{label}" end
type()
click to toggle source
Type of this feature.
# File lib/y_petri/net/state/feature/marking.rb, line 69 def type :marking end