module YPetri::Simulation::MarkingClamps::Access
Public Instance Methods
Marking_clamps(array)
click to toggle source
Expects a single array of clamped places or place ids, and returns an array of their clamp values.
# File lib/y_petri/simulation/marking_clamps/access.rb, line 10 def Marking_clamps array Clamped_places( array ).map { |place| marking_clamps.fetch( place ) } end
Also aliased as: marking_Clamps
marking_clamp( clamped_place )
click to toggle source
Identification of a single marking clamp. Expects a single clamped place or place id and returns the value of its clamp.
# File lib/y_petri/simulation/marking_clamps/access.rb, line 29 def marking_clamp( clamped_place ) marking_clamps( clamped_place ).first end
marking_clamps(*clamped_places)
click to toggle source
Expects an arbitrary number of arguments identifying clamped places, whose marking clamps are then returned. If no arguments are given, acts as a getter of +@marking_clamps+ instance variable.
# File lib/y_petri/simulation/marking_clamps/access.rb, line 19 def marking_clamps *clamped_places return Marking_clamps( clamped_places ) unless clamped_places.empty? @marking_clamps or fail TypeError, "+@marking_clamps+ not instantiated yet!" end
Also aliased as: clamps
set_marking_clamp( place, to: (fail ArgumentError) )
click to toggle source
Sets the marking clamp of a place (frontend of +InitialMarking#set+).
# File lib/y_petri/simulation/marking_clamps/access.rb, line 35 def set_marking_clamp( place, to: (fail ArgumentError) ) marking_clamps.set( place, to: to ) end