ailist.AIList.intersect#

AIList.intersect(self, int start, int end)#

Find intervals overlapping given range

Parameters:
start : int

Start position of query range

end : int

End position of query range

Returns:

  • overlapsAIList

    Overlapping intervals

  • .. warning:: – This requires construct() and will run it if not already run. This will re-sort intervals inplace.

See also

AIList.construct

Construct AIList, required to call AIList.intersect

AIList.add

Add interval to AIList

AIList.intersect_index

Find interval indices overlapping given range

AIList.intersect_from_array

Find interval indices overlapping given ranges

Examples

>>> from ailist import AIList
>>> ail = AIList()
>>> ail.add(1, 2)
>>> ail.add(3, 4)
>>> ail.add(2, 6)
>>> ail
AIList
  range: (1-6)
   (1-2, 0)
   (3-4, 1)
   (2-6, 2)
>>> q = ail.intersect(2, 10)
>>> q
AIList
  range: (2-6)
   (2-6, 2)
   (3-4, 1)