Class: XES::Event

Inherits:
Object
  • Object
show all
Includes:
EventAttributeAccessor
Defined in:
lib/xes/event.rb

Overview

XESEvent represents “event” element of XES.

Instance Attribute Summary collapse

Attributes included from EventAttributeAccessor

#concept_instance, #concept_name, #cost_currency, #cost_total, #identity_id, #lifecycle_transition, #org_group, #org_resource, #org_role, #semantic_modelReference, #time_timestamp

Instance Method Summary collapse

Methods included from AttributeAccessor

#define_attribute

Constructor Details

#initialize(attributes = []) ⇒ Event

Create a XES event.

Parameters:

  • attributes (Array<Attribute>) (defaults to: [])

    attributes of the event



14
15
16
# File 'lib/xes/event.rb', line 14

def initialize(attributes=[])
  @attributes = attributes
end

Instance Attribute Details

#attributesArray<Attribute>

Returns event attributes.

Returns:



8
9
10
# File 'lib/xes/event.rb', line 8

def attributes
  @attributes
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.



39
40
41
42
# File 'lib/xes/event.rb', line 39

def ==(other)
  return false unless other.kind_of?(self.class)
  @attributes == other.attributes
end

#formatREXML::Element

Format as a XML element.

Returns:

  • (REXML::Element)

    XML element



30
31
32
33
34
35
36
# File 'lib/xes/event.rb', line 30

def format
  REXML::Element.new("event").tap do |event|
    @attributes.each do |attribute|
      event.elements << attribute.format if attribute.formattable?
    end
  end
end

#formattable?Boolean

Return true if the element is formattable.

Returns:

  • (Boolean)

    true if the element is formattable



22
23
24
# File 'lib/xes/event.rb', line 22

def formattable?
  not(@attributes.empty?)
end

#hashObject

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
# File 'lib/xes/event.rb', line 46

def hash
  @attributes.hash
end