random_events.set
=================

.. py:module:: random_events.set


Attributes
----------

.. autoapisummary::

   random_events.set.HashMap
   random_events.set.AllElements


Classes
-------

.. autoapisummary::

   random_events.set.SetElement
   random_events.set.Set


Module Contents
---------------

.. py:data:: HashMap
   :type:  random_events.sigma_algebra.Dict[int, typing_extensions.Hashable]

.. py:data:: AllElements
   :type:  random_events.sigma_algebra.Tuple[typing_extensions.Hashable]

.. py:class:: SetElement(element: typing_extensions.Optional[typing_extensions.Hashable], all_elements: random_events.sigma_algebra.Iterable[typing_extensions.Hashable])

   Bases: :py:obj:`random_events.sigma_algebra.AbstractSimpleSet`


   Represents a SetElement.
   A SetElement consists of an element and all possible elements.
   It is necessary to know of all possible elements to determine the index and complement of any element.
   All elements are a tuple to preserve ordering.

   Beware that an empty set element is an invariant of this class and is represented by None.
   All elements are not consistent with invariants of this class.

   This class is a wrapper for the C++ class SetElement.
   The elements in the C++ class are represented by their index in the all_elements tuple.
   The C++ object gets as all elements the hash values of all elements.
   A hash map is created to map the hash of each element to the element.


   .. py:attribute:: _cpp_object
      :type:  random_events.sigma_algebra.rl.SetElement

      The C++ object that this class wraps.



   .. py:attribute:: all_elements
      :type:  AllElements

      The set of all elements.



   .. py:property:: hash_map
      :type: HashMap


      :return:A map that maps the hashes of each element in all_elements to the element.



   .. py:method:: _from_cpp(cpp_object)

      Create a new instance of this class from a C++ object.

      This method should also add fields that are python only to the instance that is created.
      This cannot be a class method since the values of the python-only fields are instance-specific.



   .. py:method:: contains(item: random_events.sigma_algebra.Self) -> bool

      Check if this set contains an item.
      :param item: The item to check
      :return: Rather if the item is in the set or not



   .. py:method:: non_empty_to_string() -> str

      :return: A string representation of this set if it is not empty.



   .. py:method:: __hash__()


   .. py:method:: __repr__()


   .. py:method:: to_json() -> random_events.sigma_algebra.Dict[str, random_events.sigma_algebra.Any]


   .. py:method:: _from_json(data: random_events.sigma_algebra.Dict[str, random_events.sigma_algebra.Any]) -> random_events.sigma_algebra.Self
      :classmethod:


      Create a variable from a json dict.
      This method is called from the from_json method after the correct subclass is determined and should be
      overwritten by the respective subclass.

      :param data: The json dict
      :return: The deserialized object



   .. py:method:: as_composite_set() -> random_events.sigma_algebra.AbstractCompositeSet

      Convert this simple set to a composite set.

      :return: The composite set



   .. py:method:: __deepcopy__()


.. py:class:: Set(*simple_sets)

   Bases: :py:obj:`random_events.sigma_algebra.AbstractCompositeSet`


   Represents a set.

   A set is a union of simple sets.

   A set is simplified if no element is contained twice.

   This class is a wrapper for the C++ class Set.

   Beware that an empty set is an invariant of this class.
   All elements are not consistent with invariants of this class.


   .. py:attribute:: simple_set_example
      :type:  SetElement

      An example of a simple set that is used to create new simple sets. 
      Fields that are python only are read from this instance when reading from cpp.



   .. py:attribute:: _cpp_object
      :type:  random_events.sigma_algebra.rl.Set

      The C++ object that this class wraps.



   .. py:attribute:: all_elements
      :type:  random_events.sigma_algebra.Tuple[typing_extensions.Hashable]


   .. py:method:: _from_cpp(cpp_object)

      Create a new instance of this class from a C++ object.

      This method should also add fields that are python only to the instance that is created.
      This cannot be a class method since the values of the python-only fields are instance-specific.



   .. py:method:: from_iterable(iterable: random_events.sigma_algebra.Iterable) -> random_events.sigma_algebra.Self
      :classmethod:



   .. py:property:: hash_map
      :type: HashMap


      :return: A map that maps the hashes of each element in all_elements to the element.



