random_events.set#
Attributes#
Classes#
Represents a SetElement. |
|
Represents a set. |
Module Contents#
- random_events.set.HashMap: random_events.sigma_algebra.Dict[int, typing_extensions.Hashable]#
- random_events.set.AllElements: random_events.sigma_algebra.Tuple[typing_extensions.Hashable]#
- class random_events.set.SetElement(element: typing_extensions.Optional[typing_extensions.Hashable], all_elements: random_events.sigma_algebra.Iterable[typing_extensions.Hashable])#
Bases:
random_events.sigma_algebra.AbstractSimpleSetRepresents 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.
- _cpp_object: random_events.sigma_algebra.rl.SetElement#
The C++ object that this class wraps.
- all_elements: AllElements#
The set of all elements.
- property hash_map: HashMap#
:return:A map that maps the hashes of each element in all_elements to the element.
- _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.
- 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
- non_empty_to_string() str#
- Returns:
A string representation of this set if it is not empty.
- __hash__()#
- __repr__()#
- to_json() random_events.sigma_algebra.Dict[str, random_events.sigma_algebra.Any]#
- classmethod _from_json(data: random_events.sigma_algebra.Dict[str, random_events.sigma_algebra.Any]) random_events.sigma_algebra.Self#
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.
- Parameters:
data – The json dict
- Returns:
The deserialized object
- as_composite_set() random_events.sigma_algebra.AbstractCompositeSet#
Convert this simple set to a composite set.
- Returns:
The composite set
- __deepcopy__()#
- class random_events.set.Set(*simple_sets)#
Bases:
random_events.sigma_algebra.AbstractCompositeSetRepresents 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.
- simple_set_example: 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.
- _cpp_object: random_events.sigma_algebra.rl.Set#
The C++ object that this class wraps.
- all_elements: random_events.sigma_algebra.Tuple[typing_extensions.Hashable]#
- _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.
- classmethod from_iterable(iterable: random_events.sigma_algebra.Iterable) random_events.sigma_algebra.Self#
- property hash_map: HashMap#
- Returns:
A map that maps the hashes of each element in all_elements to the element.