Sha256: d965471bdf6afcc227ea9786dfbc71d3b846c2ef76409fcf5f8235907707697e

Contents?: true

Size: 957 Bytes

Versions: 8

Compression:

Stored size: 957 Bytes

Contents

# encoding: utf-8

require_relative 'world/dependency'
require_relative 'world/petri_net_aspect'
require_relative 'world/simulation_aspect'

# As the name suggests, represents the world. Holds places, transitions, nets
# and other assets needed to set up and simulate Petri nets (settings, clamps,
# initial markings etc.). Provides basic methods to do what is necessary. More
# ergonomic and DSL-like methods are up to the YPetri::Agent.
# 
class YPetri::World
  ★ NameMagic                        # ★ means include
  ★ PetriNetAspect
  ★ SimulationAspect

  def initialize
    # Parametrize the Place / Transition / Net classes.
    param_class!( { Place: YPetri::Place,
                    Transition: YPetri::Transition,
                    Net: YPetri::Net },
                  with: { world: self } )
    # Make them their own namespaces.
    [ Place(), Transition(), Net() ].each &:namespace!
    # And proceeed as usual.
    super
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
y_petri-2.3.10 lib/y_petri/world.rb
y_petri-2.3.9 lib/y_petri/world.rb
y_petri-2.3.8 lib/y_petri/world.rb
y_petri-2.3.6 lib/y_petri/world.rb
y_petri-2.3.5 lib/y_petri/world.rb
y_petri-2.3.4 lib/y_petri/world.rb
y_petri-2.3.3 lib/y_petri/world.rb
y_petri-2.3.2 lib/y_petri/world.rb