lib/connection/result/result.js
function findOverlappingChunks(chunks, windowStart, windowEnd)
{
  var overlappingChunks = [];

  if (chunks.length !== 0)
  {
    // get the index of the first chunk that overlaps with the specified window
    var index = findFirstOverlappingChunk(chunks, windowStart, windowEnd);

    // iterate over the chunks starting with the first overlapping chunk and
    // keep going until there's no overlap
    for (var length = chunks.length; index < length; index++)
    {
      var chunk = chunks[index];
      if (chunk.overlapsWithWindow(windowStart, windowEnd))
      {
        overlappingChunks.push(chunk);
      }
      else
      {
        // no future chunks will overlap because the chunks array is sorted
        break;
      }
    }
  }

  return overlappingChunks;
}
function findOverlappingChunks(chunks, windowStart, windowEnd)
{
  var overlappingChunks = [];

  if (chunks.length !== 0)
  {
    // get the index of the first chunk that overlaps with the specified window
    var index = findFirstOverlappingChunk(chunks, windowStart, windowEnd);

    // iterate over the chunks starting with the first overlapping chunk and
    // keep going until there's no overlap
    for (var length = chunks.length; index < length; index++)
    {
      var chunk = chunks[index];
      if (chunk.overlapsWithWindow(windowStart, windowEnd))
      {
        overlappingChunks.push(chunk);
      }
      else
      {
        // no future chunks will overlap because the chunks array is sorted
        break;
      }
    }
  }

  return overlappingChunks;
}
function findOverlappingChunks ( chunks , windowStart , windowEnd ) { var overlappingChunks = [ ] ; if ( chunks . length !== 0 ) { // get the index of the first chunk that overlaps with the specified window var index = findFirstOverlappingChunk ( chunks , windowStart , windowEnd ) ; // iterate over the chunks starting with the first overlapping chunk and // keep going until there's no overlap for ( var length = chunks . length ; index < length ; index ++ ) { var chunk = chunks [ index ] ; if ( chunk . overlapsWithWindow ( windowStart , windowEnd ) ) { overlappingChunks . push ( chunk ) ; } else { // no future chunks will overlap because the chunks array is sorted break ; } } } return overlappingChunks ; }
Given a sorted array of chunks, returns a sub-array that overlaps with a
specified window.

@param chunks
@param windowStart
@param windowEnd

@returns {Array}
Given a sorted array of chunks returns a sub - array that overlaps with a specified window .