Esempio n. 1
0
class XAttributable:
    """
    This class is implemented by all elements of the log hierarchy, which can
    be equipped with attributes

    :param attribute: A XAttributeMap with the attribute for this class.
    :type attribute: XAttributeMap
    """
    def __init__(self, attribute=None):
        if attribute:
            self.__attributes = attribute
        else:
            self.__attributes = XAttributeMap()

    def get_extensions(self):
        """Retrieves the extensions used by this element, i.e. the extensions
        used by all attributes of this element, and the element itself

        :return: A set of extensions
        :rtype: set(XExtension)
        """
        extensions = set()
        for attribute in self.__attributes.values():
            extension = attribute.get_extensions()
            if len(extension) != 0:
                extensions.add(extension)
        return extensions

    def get_attributes(self):
        """Retrieves the attributes set for this element.

        :return: A map of attributes.
        :rtype: XAttributeMap
        """
        return self.__attributes

    def set_attributes(self, attributes):
        """Sets the map of attributes for this element.

        :param attributes: A map of attributes
        :type attributes: XAttributeMap
        """
        self.__attributes = attributes

    def has_attributes(self):
        """Checks for the existence of attributes

        :return: True if this element has any attributes; False otherwise.
        :rtype: bool
        """
        return not self.__attributes.is_empty()
Esempio n. 2
0
    def create_attribute_map():
        """Creates a new XES attribute map.

        :return: A new attribute map instance.
        :rtype: XAttributeMap
        """
        return XAttributeMap()
Esempio n. 3
0
 def __init__(self, attributes=None, identity=None):
     if not attributes:
         attributes = XAttributeMap()
     if identity:
         self.__id = identity
     else:
         self.__id = XIDFactory.create_id()
     super().__init__(attributes)
Esempio n. 4
0
    def create_trace(attribute=None):
        """Creates a new XES trace instance.

        :param attribute: A XAttributeMap with the attribute for the trace.
        :type attribute: XAttributeMap
        :return: A new trace instance.
        :rtype: XTrace
        """
        if attribute:
            return XTrace(attribute)
        return XTrace(XAttributeMap())
Esempio n. 5
0
    def create_log(attribute=None):
        """Creates a new XES log instance.

        :param attribute: A XAttributeMap with the attribute for the log.
        :type attribute: XAttributeMap
        :return: A new log instance.
        :rtype: XLog
        """
        if attribute:
            return XLog(attribute)
        return XLog(XAttributeMap())
Esempio n. 6
0
 def __init__(self, attribute=None):
     if attribute:
         self.__attributes = attribute
     else:
         self.__attributes = XAttributeMap()
Esempio n. 7
0
 def __init__(self, attribute=XAttributeMap()):
     super(XElement, self).__init__(attribute)