class YPetri::Simulation::MarkingClamps

Simulation mixin providing access to the marking clamps.

Public Instance Methods

set(place_id, to: (fail ArgumentError, "No :to value!")) click to toggle source

Sets the clamp for a given place to a given value.

Calls superclass method
# File lib/y_petri/simulation/marking_clamps.rb, line 7
def set place_id, to: (fail ArgumentError, "No :to value!")
  pl = place( place_id )
  # free places change into clamped ones.
  initial_marking.delete pl if begin # fails if initial marking not set yet
                                 pl.free?
                               rescue TypeError, NoMethodError; end
  super
end