Class: EventTree::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/agent/event_tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, label, startTime, endTime, payload) ⇒ Event

Returns a new instance of Event.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/agent/event_tree.rb', line 12

def initialize(name, label, startTime, endTime, payload)
  if startTime > endTime
    raise "Invalid event, startTime is greater than endTime " + startTime.to_s + "->" + endTime.to_s 
  end
  @name = name
  @label = label
  @startTime = startTime
  @endTime = endTime
  @payload = payload
  @invertEndTime =  - endTime.to_f
  @duration = endTime - startTime
end

Instance Attribute Details

#durationObject

Returns the value of attribute duration.



24
25
26
# File 'lib/agent/event_tree.rb', line 24

def duration
  @duration
end

#endTimeObject

Returns the value of attribute endTime.



24
25
26
# File 'lib/agent/event_tree.rb', line 24

def endTime
  @endTime
end

#invertEndTimeObject

Returns the value of attribute invertEndTime.



24
25
26
# File 'lib/agent/event_tree.rb', line 24

def invertEndTime
  @invertEndTime
end

#labelObject

Returns the value of attribute label.



24
25
26
# File 'lib/agent/event_tree.rb', line 24

def label
  @label
end

#nameObject

Returns the value of attribute name.



24
25
26
# File 'lib/agent/event_tree.rb', line 24

def name
  @name
end

#payloadObject

Returns the value of attribute payload.



24
25
26
# File 'lib/agent/event_tree.rb', line 24

def payload
  @payload
end

#startTimeObject

Returns the value of attribute startTime.



24
25
26
# File 'lib/agent/event_tree.rb', line 24

def startTime
  @startTime
end

Instance Method Details

#contains(event) ⇒ Object



26
27
28
# File 'lib/agent/event_tree.rb', line 26

def contains(event)
  event.startTime >= @startTime && event.endTime <= @endTime
end