Class: YPetri::Simulation::InitialMarking

Inherits:
PlaceMapping
  • Object
show all
Defined in:
lib/y_petri/simulation/initial_marking/access.rb,
lib/y_petri/simulation/initial_marking.rb

Overview

Simulation mixin providing access to the initial marking.

Defined Under Namespace

Modules: Access

Instance Method Summary collapse

Methods inherited from PlaceMapping

#delete, #fetch, #keys_to_source_places, #load, load, #vector

Instance Method Details

#set(place_id, to: (fail ArgumentError)) ⇒ Object

Sets the initial marking for a given place to a given value.



7
8
9
10
11
12
13
# File 'lib/y_petri/simulation/initial_marking.rb', line 7

def set( place_id, to: (fail ArgumentError) )
  fail TypeError, "The place #{place_id} is already clamped!" if
    begin # fails if marking clamps are not set yet
      place( place_id ).clamped?
    rescue TypeError, NoMethodError; end
  super
end