Esempio n. 1
0
        string OffsetHitsToGrid(List <Hit> hits)
        {
            Hits = Hits.OrderBy(h => h.Index).ThenBy(h => h.Skip).ToList();
            var low = Hits.FirstOrDefault().Index;

            var last = Hits.LastOrDefault();
            var high = last.Index;

            high += (last.Term?.Length ?? 1) * last.Skip;

            Hits = Hits.Select(h => new Hit(h.Term, (h.Index - low), h.Start, h.Skip)).ToList();
            low  = low - Start >= 0 ? low - Start : low;
            high = high >= Text.Length ? Text.Length - 1 : high;
            return(Range(Text, low, high));
        }