ó
|c‹Ac           @   s=   d  Z  d d l m Z d d l m Z d d d „  ƒ  YZ d S(   sF    Association class
    http://www.topicmaps.org/xtm/#desc-association
iÿÿÿÿ(   t
   InstanceOf(   t   Membert   Associationc           B   sD   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   sN    Association class
        http://www.topicmaps.org/xtm/#desc-association
    c         C   s   | |  _  g  |  _ d S(   s1   Initialize Association object with a given id:intN(   t   _idt	   _children(   t   selft   id(    (    s   lib/xtm/Association.pyt   __init__   s    	c         C   s   |  j  S(   s#   Return id of the Association object(   R   (   R   (    (    s   lib/xtm/Association.pyt   getId   s    c         C   s   |  j  j | ƒ d S(   s6   Add object (:Member or :InstanceOf) to the AssociationN(   R   t   append(   R   t   child(    (    s   lib/xtm/Association.pyt   addChild   s    c         C   s)   g  |  j  D] } t | t ƒ r
 | ^ q
 S(   s;   Return list of the :InstanceOf objects for this Association(   R   t
   isinstanceR    (   R   t
   instanceOf(    (    s   lib/xtm/Association.pyt   getInstanceOfList   s    c         C   s)   g  |  j  D] } t | t ƒ r
 | ^ q
 S(   s7   Return list of the :Member objects for this Association(   R   R   R   (   R   t   member(    (    s   lib/xtm/Association.pyt   getMemberList   s    c         C   s<   d j  g  |  j D] } t | ƒ ^ q ƒ } d |  j | f S(   s3   Return XTM:str representation of Association objectt    s%   <association id="%s">%s</association>(   t   joinR   t   strR   (   R   R
   t   children(    (    s   lib/xtm/Association.pyt   __str__#   s    +(	   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   (    (    (    s   lib/xtm/Association.pyR   
   s   					N(    (   R   t   xtm.InstanceOfR    t
   xtm.MemberR   R   (    (    (    s   lib/xtm/Association.pyt   <module>   s   