Lines Matching defs:span

42  * Implement span() etc. for a set with strings.
49 * Which span() variant will be used? The object is either built for one variant and used once,
75 /** Set for span(). Same as parent but without strings. */
79 * Set for span(not contained).
87 /** The lengths of span(), spanBack() etc. for each string. */
96 /** Set up for all variants of span()? */
103 * Constructs for all variants of span(), or only for any one variant.
111 // (We do not want to create multiple Iterator objects in each span().)
123 // Determine if the strings even need to be taken into account at all for span() etc.
125 // span(longest match) but only the relevant ones for span(while contained).
137 spanLength = spanSet.span(string, SpanCondition.CONTAINED);
160 // 2 sets of span lengths
163 allocSize = stringsLength; // One set of span lengths.
168 // Store span lengths for all span() variants.
171 // Store span lengths for only one span() variant.
180 spanLength = spanSet.span(string, SpanCondition.CONTAINED);
199 // a span(while not contained) stops before any string.
227 * Do the strings need to be checked in span() etc.?
229 * @return true if strings need to be checked (call span() here),
243 * so that a character span ends before any string.
256 * Note: In span() when spanLength==0
257 * (after a string match, or at the beginning after an empty code point span)
270 * Algorithm for span(SpanCondition.CONTAINED)
276 * + Either recursively span for each code point or string match, or recursively span
277 * for all but the shortest one and iteratively continue the span with the shortest local match.
278 * + Remember the longest recursive span (the farthest end point).
281 * then stop and return the longest recursive span length.
286 * A span using a string-less set is extremely fast.)
291 * - Start with spanLength=spanSet.span(SpanCondition.CONTAINED).
298 * are irrelevant for span(SpanCondition.CONTAINED)
302 * + If no set string matched after spanSet.span(),
303 * then return with where the spanSet.span() ended.
304 * + If at least one set string matched after spanSet.span(),
312 * then try another spanLength=spanSet.span(SpanCondition.CONTAINED).
323 * Algorithm for span(SIMPLE)
336 * - Start with spanLength=spanSet.span(SpanCondition.CONTAINED).
345 * Such set strings need not be matched earlier inside the code point span
350 * + If no set string matched after spanSet.span(),
351 * then return with where the spanSet.span() ended.
355 * then try another spanLength=spanSet.span(SpanCondition.CONTAINED).
362 * @param start The start index that the span begins
363 * @param spanCondition The span condition
364 * @return the limit (exclusive end) of the span
366 public int span(CharSequence s, int start, SpanCondition spanCondition) {
370 int spanLimit = spanSet.span(s, start, SpanCondition.CONTAINED);
381 * @param spanLimit = spanSet.span(s, start, CONTAINED)
385 // Consider strings; they may overlap with the span.
410 // While contained: No point matching fully inside the code point span.
450 // Longest match: Need to match fully inside the code point span
488 // The position is after an unlimited code point span (spanLength!=0),
490 // The only position where spanLength==0 after a span is pos==0.
491 // Otherwise, an unlimited code point span is only tried again when no
492 // strings match, and if such a non-initial span fails we stop.
494 return pos; // No strings matched after a span.
501 // Try another code point span from after the last string match.
502 spanLimit = spanSet.span(s, pos, SpanCondition.CONTAINED);
505 spanLength == 0 // neither strings nor span progressed.
511 continue; // spanLength>0: Match strings from after a span.
541 * Spans a string and counts the smallest number of set elements on any path across the span.
546 * like span(), but such sets are likely rare, and this is at least still linear.
549 * @param start The start index that the span begins
550 * @param spanCondition The span condition
552 * @return the limit (exclusive end) of the span
559 // Consider strings; they may overlap with the span,
641 * @param spanCondition The span condition
642 * @return The string index which starts the span (i.e. inclusive).
654 // Consider strings; they may overlap with the span.
680 // While contained: No point matching fully inside the code point span.
721 // Longest match: Need to match fully inside the code point span
758 // The position is before an unlimited code point span (spanLength!=0),
760 // The only position where spanLength==0 before a span is pos==length.
761 // Otherwise, an unlimited code point span is only tried again when no
762 // strings match, and if such a non-initial span fails we stop.
764 return pos; // No strings matched before a span.
771 // Try another code point span from before the last string match.
776 spanLength == 0 // neither strings nor span progressed.
780 continue; // spanLength>0: Match strings from before a span.
807 * Algorithm for spanNot()==span(SpanCondition.NOT_CONTAINED)
816 * (Same assumption as for span() above.)
824 * + Do spanLength=spanNotSet.span(SpanCondition.NOT_CONTAINED).
833 * @param start The start index that the span begins
834 * @param outCount If not null: Receives the number of code points across the span.
835 * @return the limit (exclusive end) of the span
847 spanLimit = spanNotSet.span(s, pos, SpanCondition.NOT_CONTAINED);
878 // The span(while not contained) ended on a string start/end which is
925 // The span(while not contained) ended on a string start/end which is
1001 * for both increments (in span()) and decrements (in spanBack()).