class YPetri::Agent::SimulationAspect::SimulationPoint

Public Instance Methods

identify( name: nil, net: nil, cc: nil, imc: nil, ssc: nil, **nn ) click to toggle source

Helper method specifying how a simulation is identified by arguments.

# File lib/y_petri/agent/simulation_aspect.rb, line 45
def identify( name: nil, net: nil, cc: nil, imc: nil, ssc: nil, **nn )
  name || { net: net, cc: cc, imc: imc, ssc: ssc }.merge( nn )
end
reset() click to toggle source

Reset to the first simulation, or nil if that is absent.

# File lib/y_petri/agent/simulation_aspect.rb, line 29
def reset
  @key = @hash.empty? ? nil : set( @hash.first[0] )
end
set(**nn) click to toggle source

A simulation is identified either by its name (if named), or by its parameters and settings (:net, :cc, :imc, :ssc).

# File lib/y_petri/agent/simulation_aspect.rb, line 36
def set **nn
  key = identify **nn
  @key = if key.nil? then key
         elsif @hash.has_key? key then key
         else raise "No simulation identified by #{key}!" end
end