Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplekit-ruby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sanchez, Paul
simplekit-ruby
Commits
6d6cca3a
Commit
6d6cca3a
authored
13 years ago
by
pjs
Browse files
Options
Downloads
Patches
Plain Diff
simplekit.rb - updated comments, refactored Simulation to EventScheduler
Signed-off-by:
pjs
<
pjs@alum.mit.edu
>
parent
c3f20b90
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/simplekit.rb
+13
-12
13 additions, 12 deletions
lib/simplekit.rb
with
13 additions
and
12 deletions
lib/simplekit.rb
+
13
−
12
View file @
6d6cca3a
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 # 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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment