Class: YPetri::Agent

Inherits:
Object
  • Object
show all
Defined in:
lib/y_petri/agent.rb,
lib/y_petri/agent/selection.rb

Overview

A dumb agent that represents and helps the user.

An instance of this class (an agent) helps the user to interact with the world (YPetri::World instance) and the objects in it (Petri net places, transitions, nets etc.). In particular, this (YPetri::Agent) class is a convenient place to store various “shortcuts” meant to reduce the amount of typing the user has to do in order to construct and manipulate the world and its objects (such as “pl” instead of “place”, “tr” instead of “transition” etc.) It would not be a good practice to encumber the classes where these methods are implemented with these semi-idiosyncratic shortcuts. This way, the implementation of the methods stays the concern of the mother classes, and Agent class is responsible for improving the ergonomy of their invocation.

Defined Under Namespace

Modules: PetriNetAspect, SimulationAspect Classes: HashKeyPointer, Selection

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAgent

Returns a new instance of Agent.



29
30
31
32
# File 'lib/y_petri/agent.rb', line 29

def initialize
  @world = YPetri::World.new
  super
end

Instance Attribute Details

#worldObject (readonly)

Returns the value of attribute world.



27
28
29
# File 'lib/y_petri/agent.rb', line 27

def world
  @world
end