From 6d6cca3ac046155a82789c4dd2bbd8803315f611 Mon Sep 17 00:00:00 2001 From: pjs <pjs@alum.mit.edu> Date: Fri, 17 Feb 2012 10:28:03 -0800 Subject: [PATCH] simplekit.rb - updated comments, refactored Simulation to EventScheduler Signed-off-by: pjs <pjs@alum.mit.edu> --- lib/simplekit.rb | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/simplekit.rb b/lib/simplekit.rb index 640f25c..9626adc 100644 --- a/lib/simplekit.rb +++ b/lib/simplekit.rb @@ -1,21 +1,22 @@ require 'rubygems' require 'pqueue' -# install the 'pqueue' gem before using SimpleKit: -# gem install pqueue -# or -# sudo gem install pqueue # on Unix systems/OS X. - +# You must install the 'pqueue' gem before using SimpleKit: +# <ul> +# <li>gem install pqueue<br> +# or<br> +# <li>sudo gem install pqueue # 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 - # 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] + # Run the model by creating a new EventScheduler and invoking its run method. def run - @mySim = Simulation.new(self) + @mySim = EventScheduler.new(self) @mySim.run end @@ -35,7 +36,7 @@ module SimpleKit # <li>Instantiates a model and invokes # the run() method to start execution. # </ul> - class Simulation + class EventScheduler attr_reader :model_time, :user_model def initialize(the_model) -- GitLab