Skip to content
Snippets Groups Projects
Commit 6d6cca3a authored by pjs's avatar pjs
Browse files

simplekit.rb - updated comments, refactored Simulation to EventScheduler


Signed-off-by: default avatarpjs <pjs@alum.mit.edu>
parent c3f20b90
No related branches found
No related tags found
No related merge requests found
require 'rubygems' require 'rubygems'
require 'pqueue' require 'pqueue'
# install the 'pqueue' gem before using SimpleKit: # You must install the 'pqueue' gem before using SimpleKit:
# gem install pqueue # <ul>
# or # <li>gem install pqueue<br>
# sudo gem install pqueue # on Unix systems/OS X. # or<br>
# <li>sudo gem install pqueue&nbsp;&nbsp;&nbsp;&nbsp;# on Unix systems/OS X.
#</ul>
# Including SimpleKit gives you methods :run, :model_time, :schedule,
# and :halt as mixins. You <b>MUST NOT</b> provide your own implementations
# of methods with these names in your model. All but :run are
# delegated to the EventScheduler class.
module SimpleKit module SimpleKit
# including SimpleKit gives you methods :run, :model_time,
# :schedule, and :halt as mixins. You MUST NOT provide
# your own implementations of methods with these names in
# your model. All but :run are delegated to the Simulation
# class.
DELEGATED_METHODS = [:model_time, :schedule, :halt] DELEGATED_METHODS = [:model_time, :schedule, :halt]
# Run the model by creating a new EventScheduler and invoking its run method.
def run def run
@mySim = Simulation.new(self) @mySim = EventScheduler.new(self)
@mySim.run @mySim.run
end end
...@@ -35,7 +36,7 @@ module SimpleKit ...@@ -35,7 +36,7 @@ module SimpleKit
# <li>Instantiates a model and invokes # <li>Instantiates a model and invokes
# the run() method to start execution. # the run() method to start execution.
# </ul> # </ul>
class Simulation class EventScheduler
attr_reader :model_time, :user_model attr_reader :model_time, :user_model
def initialize(the_model) def initialize(the_model)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment