class RegisterSliceMap(_Generic[_DataType]):
A map of non-overlapping register slices associated to some data.
The data of register slices that would overlap is merged/subtracted with the one of a register slice that would be added/removed from the map.
Method | __init__ |
Creates a new instance of RegisterSliceMap. |
Method | __iter__ |
Undocumented |
Method | __len__ |
Returns the number of register slices in this map. |
Method | add |
Adds the passed register slice with the associated data to the map. |
Method | intersection |
Iterates over the intersection of any register slice contained in the map with the passed slice, returning their associated data. |
Method | keys |
Returns an iterator on all the register slices in the map. |
Method | remove |
Removes the passed register slice with the associated data from the map. |
Method | remove |
Removes the passed register slice with the associated data from the map, iterating on the removed elements. |
Property | register |
The number of different register that are sliced in this map. |
Method | _compare |
Returns: new index value where next element should be inserted, and whether we should stop immediately |
Method | _compare |
Returns: new index value where next element should be inserted, and whether we should stop immediately |
Method | _first |
Undocumented |
Method | _fuse |
Undocumented |
Method | _insert |
Undocumented |
Instance Variable | _merge |
Undocumented |
Instance Variable | _slices |
Undocumented |
Instance Variable | _subtract |
Undocumented |
Creates a new instance of RegisterSliceMap.
Information
Parameters | |
merge:_Callable[ | Function indicating how to merge data when adding overlapping slices. |
subtract:_Callable[ | Function indicating how to subtract data when removing overlapping slices. A return value of None will remove the corresponding register slice. |
items:_Iterable[ | Initial (keys, values) for the map. If they overlap, they will be merged upon insertion. |
Adds the passed register slice with the associated data to the map.
The slice can overlap with keys already contained in the map. After the addition, the intersecting slice will contain the data obtained by merging the passed data with the data of the overlapping existing slice.
After the addition, contiguous slices associated to the same data (in the sense of the data type's __eq__ method) will be replaced by their union.
Parameters | |
register_Union[ | Undocumented |
data:_DataType | Undocumented |
Iterates over the intersection of any register slice contained in the map with the passed slice, returning their associated data.
Parameters | |
register_Union[ | Undocumented |
Returns | |
_Iterator[ | Undocumented |
Returns an iterator on all the register slices in the map.
Returns | |
_Iterator[ | Undocumented |
Removes the passed register slice with the associated data from the map.
The passed data will be subtracted from the data associated with any overlapping existing slice, and the resulting data will be associated with the intersection of such slices. If the subtracted data is None for a slice after this operation, then it will be removed from the map.
If the passed data is None, then the intersection of any slice overlapping with the passed slice will always be removed regardless of its data.
After the removal, contiguous slices associated to the same data (in the sense of the data type's __eq__ method) will be replaced by their union.
Parameters | |
register_Union[ | Undocumented |
data:_Optional[ | Undocumented |
Removes the passed register slice with the associated data from the map, iterating on the removed elements.
For each removed slice, returns a tuple containing that slice and the data that was removed from the map.
After this iterator is fully consumed or deleted, contiguous slices associated to the same data (in the sense of the data type's __eq__ method) will be replaced by their union.
Parameters | |
register_Union[ | Undocumented |
data:_Optional[ | Undocumented |
Returns | |
_Iterator[ | Undocumented |
Returns: new index value where next element should be inserted, and whether we should stop immediately
Parameters | |
new:_LexicographicKeyVal[ | Undocumented |
existing:_LexicographicKeyVal[ | Undocumented |
slices:_List[ | Undocumented |
intersection:RegisterSlice | Undocumented |
index:int | Undocumented |
Returns | |
_Tuple[ | Undocumented |
Returns: new index value where next element should be inserted, and whether we should stop immediately
Parameters | |
new:_LexicographicKeyVal[ | Undocumented |
existing:_LexicographicKeyVal[ | Undocumented |
slices:_List[ | Undocumented |
intersection:RegisterSlice | Undocumented |
index:int | Undocumented |
Returns | |
_Tuple[ | Undocumented |
Undocumented
Parameters | |
register_Union[ | Undocumented |
Returns | |
_Optional[ | Undocumented |
Undocumented
Parameters | |
slices:_List[ | Undocumented |
beginint | Undocumented |
endint | Undocumented |
Undocumented
Parameters | |
slices:_List[ | Undocumented |
index:int | Undocumented |
slice:RegisterSlice | Undocumented |
data:_DataType | Undocumented |
Returns | |
int | Undocumented |