Property :: intersect - Intersect collections
The result collection contains all instances that exist in both source collections. The existence of an instance in a collection can be checked based on a access key (passing true for bSortKey) or on local identities (LOID). Using the LOID is save but comparing keys is much faster. Hence, the key check should be used whenever possible.
The function throws an exception, when operands passed are invalid or when keys are not comparable (bSortKey=true).
Reference to the property handle that contains the result of an operation. Note that invalid properties may cause exceptions.
Implementation overview
- Create intersect result in first collection
Property :: intersect ( cProperty, bSortKey ) - Intersect two collections
Property :: intersect ( cProperty1, cProperty2, bSortKey )
Implementation details
-
Create intersect result in first collection
odaba::Property & Property  :: intersect ( odaba::Property &cProperty, bool bSortKey )
The function creates the intersect from the collection referenced by the current property handle and the collection passed via rProperty, i.e. all instances in the current collection, which do not exist in the operand collection, will be removed.
- cProperty
- Property reference
A property handle refers to a (usually) opened property. Invalid properties may cause an exception.
- bSortKey
- Sort key option
The sort key option indicates whether the operation should be performed according to the sort key set for the collections (true). Otherwise (false) the operation is performed by comparing instances.
to list
- cProperty
- Property reference
-
Intersect two collections
odaba::Property & Property  :: intersect ( odaba::Property &cProperty1, odaba::Property &cProperty2, bool bSortKey )
The result collection will contain all instances, which are element of the collection referenced in rProperty1 and element of the collection referenced in rProperty2. The result is stored in the collection handled by the current property handle.
When the current property handle refers to a non empty collection, all instances are removed before performing the operation. When the calling property handle is not opened (invalid), the function creates a temporary extend for storing the result.
- cProperty1
- Property reference
A property handle refers to a (usually) opened property. Invalid properties may cause an exception.
- cProperty2
- Property reference
A property handle refers to a (usually) opened property. Invalid properties may cause an exception.
- bSortKey
- Sort key option
The sort key option indicates whether the operation should be performed according to the sort key set for the collections (true). Otherwise (false) the operation is performed by comparing instances.
to list
- cProperty1
- Property reference