Class: XES::Trace
- Inherits:
-
Object
- Object
- XES::Trace
- Includes:
- TraceAttributeAccessor
- Defined in:
- lib/xes/trace.rb
Overview
Trace represents “trace” element of XES.
Instance Attribute Summary collapse
-
#attributes ⇒ Array<Attribute>
Attributes of the trace element.
-
#events ⇒ Array<Event>
Events included in the trace element.
Attributes included from TraceAttributeAccessor
#concept_name, #cost:total, #cost_currency, #identity_id, #semantic_modelReference
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?) private
-
#format ⇒ REXML::Element
Format as a XML element.
-
#formattable? ⇒ Boolean
Return true if the element is formattable.
- #hash ⇒ Object private
-
#initialize(attributes = [], events = []) ⇒ Trace
constructor
Create a XES trace.
Methods included from AttributeAccessor
Constructor Details
#initialize(attributes = [], events = []) ⇒ Trace
Create a XES trace.
18 19 20 21 |
# File 'lib/xes/trace.rb', line 18 def initialize(attributes=[], events=[]) @attributes = attributes @events = events end |
Instance Attribute Details
#attributes ⇒ Array<Attribute>
Returns attributes of the trace element.
8 9 10 |
# File 'lib/xes/trace.rb', line 8 def attributes @attributes end |
#events ⇒ Array<Event>
Returns events included in the trace element.
12 13 14 |
# File 'lib/xes/trace.rb', line 12 def events @events end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 49 |
# File 'lib/xes/trace.rb', line 46 def ==(other) return false unless other.kind_of?(self.class) @attributes == other.attributes and @events == other.events end |
#format ⇒ REXML::Element
Format as a XML element.
36 37 38 39 40 41 42 43 |
# File 'lib/xes/trace.rb', line 36 def format raise FormatError.new(self) unless formattable? REXML::Element.new("trace").tap do |trace| @attributes.each {|attribute| trace.elements << attribute.format if attribute.formattable?} @events.each {|event| trace.elements << event.format if event.formattable?} end end |
#formattable? ⇒ Boolean
Return true if the element is formattable.
27 28 29 |
# File 'lib/xes/trace.rb', line 27 def formattable? @events.any? {|event| event.formattable?} end |
#hash ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 |
# File 'lib/xes/trace.rb', line 53 def hash @attributes.hash + @events.hash end |