Class: SISFC::Event

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/sisfc/event.rb

Constant Summary collapse

ET_REQUEST_GENERATION =
0
ET_REQUEST_ARRIVAL =
1
ET_REQUEST_FORWARDING =
2
ET_WORKFLOW_STEP_COMPLETED =
3
ET_REQUEST_CLOSURE =
4
ET_END_OF_SIMULATION =

ET_VM_SUSPEND = 5 ET_VM_RESUME = 6

100

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, data, time, destination) ⇒ Event

Returns a new instance of Event.



22
23
24
25
26
27
# File 'lib/sisfc/event.rb', line 22

def initialize(type, data, time, destination)
  @type        = type
  @data        = data
  @time        = time
  @destination = destination
end

Instance Attribute Details

#dataObject (readonly)

should this be attr_accessor instead?



20
21
22
# File 'lib/sisfc/event.rb', line 20

def data
  @data
end

#destinationObject (readonly)

should this be attr_accessor instead?



20
21
22
# File 'lib/sisfc/event.rb', line 20

def destination
  @destination
end

#timeObject (readonly)

should this be attr_accessor instead?



20
21
22
# File 'lib/sisfc/event.rb', line 20

def time
  @time
end

#typeObject (readonly)

should this be attr_accessor instead?



20
21
22
# File 'lib/sisfc/event.rb', line 20

def type
  @type
end

Instance Method Details

#<=>(event) ⇒ Object



29
30
31
# File 'lib/sisfc/event.rb', line 29

def <=> (event)
  @time <=> event.time
end

#to_sObject



33
34
35
# File 'lib/sisfc/event.rb', line 33

def to_s
  "Event type: #{@type}, data: #{@data}, time: #{@time}, #{@destination}"
end