class YPetri::World
Represents YPetri
workspace (“World” is shorter). Its instance holds places, transitions, nets and other assets needed to perform the tasks of system specification and simulation (simulation settings, place clamps, initial markings etc.). Provides basic methods to do just what is necessary. More ergonomic and DSL-like methods may be defined in YPetri::Agent
.
Provides basic skeleton for dependency injection for the triples of the parametrized subclasses of Place, Transition and Net in different workspaces.
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/y_petri/world.rb, line 18 def initialize # Set up parametrized subclasses of Place, Transition, Net. param_class!( { Place: YPetri::Place, Transition: YPetri::Transition, Net: YPetri::Net }, with: { world: self } ) # Invoke #namespace! method (from YSupport's NameMagic) on each of them. # This causes each of them to do bookkeeping of their instances. This is # because there is little point in keeping the objects from separate # worlds (ie. workspaces) on the same list. [ Place(), Transition(), Net() ].each &:namespace! # And proceed with initializations (if any) higher in the lookup chain. super end