Sha256: 58395470565ebce46d1d4c9fdf666868a6abe295178ddb07e6a97671a86efe0d

Contents?: true

Size: 962 Bytes

Versions: 2

Compression:

Stored size: 962 Bytes

Contents

# encoding: utf-8

require_relative 'world/dependency'
require_relative 'world/petri_net_related'
require_relative 'world/simulation_related'


# 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
  ★ PetriNetRelated
  ★ SimulationRelated

  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

2 entries across 2 versions & 1 rubygems

Version Path
y_petri-2.1.7 lib/y_petri/world.rb
y_petri-2.1.6 lib/y_petri/world.rb