Sha256: 1dd213f0aa5ca1385fe9237a1689701bbdba48afcdc4e40d4f0ef17edc03623a

Contents?: true

Size: 1017 Bytes

Versions: 39

Compression:

Stored size: 1017 Bytes

Contents

#encoding: utf-8

# Simulation mixin providing access to the marking clamps.
#
class YPetri::Simulation::MarkingClamps
  module Access
    # Without arguments, acts as a getter of the @marking_clamp hash. If
    # arguments are supplied, they must identify clamped places, and are mapped
    # to their clamp values.
    # 
    def marking_clamps ids=nil
      if ids.nil? then
        @marking_clamps or
          fail TypeError, "MarkingClamps object not instantiated yet!"
      else
        clamped_places( ids ).map { |p| marking_clamp of: p }
      end
    end
    alias clamps marking_clamps

    # Marking clamp identification.
    # 
    def marking_clamp( of: (fail ArgumentError) )
      marking_clamps.clamp_of( of )
    end

    # Sets the marking clamp of a place (frontend of +InitialMarking#set+).
    # 
    def set_marking_clamp( of: (fail ArgumentError), to: (fail ArgumentError) )
      marking_clamps.set( of, to: to )
    end
  end # module Access
end # class YPetri::Simulation::MarkingClamps

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
y_petri-2.2.4 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.2.3 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.2.2 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.2.1 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.2.0 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.51 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.50 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.49 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.48 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.47 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.46 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.45 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.44 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.42 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.40 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.39 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.37 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.36 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.35 lib/y_petri/simulation/marking_clamps/access.rb
y_petri-2.1.34 lib/y_petri/simulation/marking_clamps/access.rb