a
    V%'eA  ã                   @   s   d dl Z G dd„ deƒZdS )é    Nc                   @   sD   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dS )ÚListDictc                 C   s   i | _ g | _d S ©N)Úitem_to_positionÚitems©Úself© r   ú4/var/lib/ffplayout/scripts/mt_clockwheel/listdict.pyÚ__init__   s    zListDict.__init__c                 C   s2   || j v rd S | j |¡ t| jƒd | j |< d S )Né   )r   r   ÚappendÚlen©r   Úitemr   r   r	   Úadd_item   s    
zListDict.add_itemc                 C   s<   | j  |¡}| j ¡ }|t| jƒkr8|| j|< || j |< d S r   )r   Úpopr   r   )r   r   ZpositionZ	last_itemr   r   r	   Úremove_item   s
    

zListDict.remove_itemc                 C   s   t  | j¡S r   )ÚrandomÚchoicer   r   r   r   r	   Úchoose_random_item   s    zListDict.choose_random_itemc                 C   s
   || j v S r   )r   r   r   r   r	   Ú__contains__   s    zListDict.__contains__c                 C   s
   t | jƒS r   )Úiterr   r   r   r   r	   Ú__iter__   s    zListDict.__iter__c                 C   s
   t | jƒS r   )r   r   r   r   r   r	   Úlength   s    zListDict.lengthN)
Ú__name__Ú
__module__Ú__qualname__r
   r   r   r   r   r   r   r   r   r   r	   r      s   r   )r   Úobjectr   r   r   r   r	   Ú<module>   s   