ó
Āö	Ic           @   s   d  d d     YZ  d S(   t   HashSetc           B   sĄ   e  Z d  Z g  d  Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sū   A set abstraction supporting the basic set operations.

    This implementation requires that all elements are hashable,
    which implies that elements must not mutate while contained.
    c         C   s+   i  |  _  x | D] } d |  j  | <q Wd S(   s   Initializes a new HashSet.i   N(   t   _HashSet__elements(   t   selft   elementst   e(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   __init__   s    	c         C   s   | |  j  k S(   s+   Returns true iff this set contains element.(   R   (   R   t   element(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   __contains__   s    c         C   se   t  | t  s d Sx$ |  j   D] } | | k r  d Sq  Wx$ | j   D] } | |  k rG d SqG Wd S(   s6   Returns true iff x == y for all elements in self, set.i    i   (   t
   isinstanceR    t   list(   R   t   sett   x(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   __eq__   s      c         C   s   t  |  j  S(   s+   Returns the number of elements in this set.(   t   lenR   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   __len__!   s    c         C   s   |  j  |  S(   s.   Returns true iff this set is not equal to set.(   R   (   R   R
   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   __ne__%   s    c         C   s   d t  |  j    d S(   s6   Returns a debugging string representation of this set.s   HashSet(t   )(   t   reprR	   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   __repr__)   s    c         C   s$   d d j  t t |  j     d S(   s,   Returns a string representation of this set.t   {t   ,t   }(   t   joint   mapt   strR	   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   __str__-   s    c         C   s   d |  j  | <d S(   s   Adds element to this set.i   N(   R   (   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   add3   s    c         C   s   |  j  |  S(   s+   Returns true iff this set contains element.(   R   (   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   contains7   s    c         C   s&   y |  j  | =Wn t k
 r! n Xd S(   s   Removes element from this set.N(   R   t   KeyError(   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   remove;   s    c         C   s   |  j  j   S(   s+   Returns the elements of this set in a list.(   R   t   keys(   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyR	   B   s    c         C   s   t  |  j  d k S(   s#   Returns true iff this set is empty.i    (   R   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   emptyH   s    c         C   s   t  |  j   | j    S(   s$   Returns the union of this set and s.(   R    R	   (   R   t   s(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   unionN   s    c         C   s   t  t | d  |  j     S(   s+   Returns the intersection of this set and s.c         S   s
   |  | k S(   N(    (   R   R    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   <lambda>T   s    (   R    t   filterR	   (   R   R    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   intersectionR   s    c         C   s   t  t | d  |  j     S(   s)   Returns the difference of this set and s.c         S   s
   |  | k S(   N(    (   R   R    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyR"   X   s    (   R    R#   R	   (   R   R    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt
   differenceV   s    c         C   sQ   g  } x> |  j    D]0 } x' | j    D] } | j | | f  q& Wq Wt |  S(   s0   Returns the Cartesian product of this set and s.(   R	   t   appendR    (   R   R    t   pt   it   j(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt	   cartesianZ   s
    (   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   R   R   R   R   R	   R   R!   R$   R%   R*   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyR       s"   		
												N(    (   R    (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Pathway/Rep/HashSet.pyt   <module>   s    