Sha256: b02b32de1f8fbf6c41ada4d20294062030aded058c004a9c9538b8be8156e932
Contents?: true
Size: 1.32 KB
Versions: 32
Compression:
Stored size: 1.32 KB
Contents
# encoding: utf-8 # Workspace instance methods related to Petri net itsef (places, transitions, # net instances). # module YPetri::World::PetriNetRelated # Instance initialization. # def initialize set_up_Top_net # Sets up :Top net encompassing all places and transitions. super end # Returns a place instance identified by the argument. # def place( id ) Place().instance( id ) end # Returns a transition instance identified by the argument. # def transition( id ) Transition().instance( id ) end # Returns a net instance identified by the argument. # def net( id ) Net().instance( id ) end # Place instances. # def places Place().instances end # Transition instances. # def transitions Transition().instances end # Net instances. # def nets Net().instances end private # Creates all-encompassing Net instance named :Top. # def set_up_Top_net Net().send :new, name: :Top # all-encompassing :Top net # Hook new places to add themselves magically to the :Top net. Place().new_instance_closure { |new_inst| net( :Top ) << new_inst } # Hook new transitions to add themselves magically to the :Top net. Transition().new_instance_closure { |new_inst| net( :Top ) << new_inst } end end # module YPetri::World::PetriNetRelated
Version data entries
32 entries across 32 versions & 1 rubygems