pymasep.circular_head_list ========================== .. py:module:: pymasep.circular_head_list Classes ------- .. autoapisummary:: pymasep.circular_head_list.CircularHeadList Module Contents --------------- .. py:class:: CircularHeadList(initlist=None) Bases: :py:obj:`collections.UserList` Implementation of a circular list with a head pointer. Initialize a circular list. The list is empty by default, and head points to nothing. :param initlist: Initialize the circular list. Head point to the first element if initList is passed. .. py:attribute:: _head_idx .. py:property:: head The pointer to the head of the circular list. :return: The element pointed by the head .. py:method:: append(item) Append an element at the end of the list (not circular). Change the head only if the list was empty. :param item: Item to add in the list .. py:method:: next() Return the next element of the circular list. :return: Return the next element. Return None if the list is empty .. py:method:: move_head_next() Move head to the next element. Head stay None if the list is empty. .. py:method:: insert(i, item) Insert item at position i. The head remains at the same position except if the insertion is in an empty list. :param i: Position :param item: item to insert .. py:method:: remove(item) Remove is not permitted. :param item: Any ite. :raise AttributeError: Remove is not permitted for CircularHeadList objects .. py:method:: to_xml() Transform a circular list to an XML structure. Format (empty list) is ``-1`` :return: An XML Element .. py:method:: from_xml(xml_node) Transform all XML elements from the xml_node to the current instance. :param xml_node: The XML node that contains the CircularList data. :return: None. The current instance is modified