Skip to content
Snippets Groups Projects
Commit 917d9fbf authored by pjs's avatar pjs
Browse files

Make EventNotice a struct

parent 8308cc54
No related branches found
No related tags found
No related merge requests found
...@@ -52,7 +52,7 @@ module SimpleKit ...@@ -52,7 +52,7 @@ module SimpleKit
# at invocation time. # at invocation time.
def schedule(event, delay, *args) def schedule(event, delay, *args)
fail 'Model scheduled event with negative delay.' if delay < 0 fail 'Model scheduled event with negative delay.' if delay < 0
@event_list.push EventNotice.new(event, @model_time + delay, *args) @event_list.push EventNotice.new(event, @model_time + delay, args)
end end
# Start execution of a model. The simulation +model_time+ is # Start execution of a model. The simulation +model_time+ is
...@@ -79,19 +79,10 @@ module SimpleKit ...@@ -79,19 +79,10 @@ module SimpleKit
private private
# This is a private helper class for the EventScheduler class. # This is a private helper Struct for the EventScheduler class.
# Users should never try to access anything in this class directly. # Users should never try to access this directly.
class EventNotice EventNotice = Struct.new(:event, :time, *:args) do
include Comparable include Comparable
attr_reader :event, :time, :args
def initialize(event, time, *args)
@event = event
@time = time
@args = args
end
def <=>(other) def <=>(other)
time <=> other.time time <=> other.time
end end
......
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