Sha256: e2f3d3bfed1a965b082fdba3d69877a5a230275b1ff9fdce8616da150903fe69

Contents?: true

Size: 668 Bytes

Versions: 39

Compression:

Stored size: 668 Bytes

Contents

module YPetri::Simulation::Timeless
  # A timeless recorder.
  # 
  class Recorder < YPetri::Simulation::Recorder
    attr_reader :next_event

    # Like +YPetri::Simulation::Recording#reset+, but allowing for additional
    # named argument +:next_sample+ that sets the event (label, hash key) of
    # the next sample.
    # 
    def reset! **nn
      super
      @next_event = nn[:next_event] || 0
    end

    private

    # Records the current system state under a numbered sample.
    # 
    def sample!
      super next_event
      @next_event = @next_event.next # "event" shoud implement next method
    end
  end # Recorder
end # YPetri::Simulation::Timeless

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
y_petri-2.1.33 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.31 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.30 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.26 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.25 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.24 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.22 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.21 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.20 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.18 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.17 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.16 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.12 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.11 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.10 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.9 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.7 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.6 lib/y_petri/simulation/timeless/recorder.rb
y_petri-2.1.3 lib/y_petri/simulation/timeless/recorder.rb