@@ -365,32 +365,14 @@ protected virtual void SearchPatterns(ReadOnlySpan<char> word, int index, Span<b
365365 }
366366 }
367367
368- /// <summary>
369- /// Hyphenate word and return a <see cref="Hyphenation"/> object.
370- /// </summary>
371- /// <param name="word"> the word to be hyphenated </param>
372- /// <param name="remainCharCount"> Minimum number of characters allowed before the
373- /// hyphenation point. </param>
374- /// <param name="pushCharCount"> Minimum number of characters allowed after the
375- /// hyphenation point. </param>
376- /// <returns> a <see cref="Hyphenation"/> object representing the
377- /// hyphenated word or null if word is not hyphenated. </returns>
378- public virtual Hyphenation Hyphenate ( string word , int remainCharCount , int pushCharCount )
379- {
380- // LUCENENET: use Span instead of ToCharArray
381- return Hyphenate ( word . AsSpan ( ) , 0 , word . Length , remainCharCount , pushCharCount ) ;
382- }
383-
384-
385-
386368 /// <summary>
387369 /// Hyphenate word and return an array of hyphenation points.
388370 /// </summary>
389371 /// <remarks>
390- /// w = "****nnllllllnnn*****", where n is a non-letter, l is a letter, all n
391- /// may be absent, the first n is at offset, the first l is at offset +
392- /// iIgnoreAtBeginning; word = ".llllll.'\0'***", where all l in w are copied
393- /// into word. In the first part of the routine len = w.length, in the second
372+ /// w = "****nnllllllnnn*****".AsSpan(offset, len), where n is a non-letter,
373+ /// l is a letter, all n may be absent, the first n is at offset, the first l is
374+ /// at offset + iIgnoreAtBeginning; word = ".llllll.'\0'***", where all l in w are
375+ /// copied into word. In the first part of the routine len = w.length, in the second
394376 /// part of the routine len = word.length. Three indices are used: index(w),
395377 /// the index in w, index(word), the index in word, letterindex(word), the
396378 /// index in the letter part of word. The following relations exist: index(w) =
@@ -399,18 +381,22 @@ public virtual Hyphenation Hyphenate(string word, int remainCharCount, int pushC
399381 /// offset - 1 + iIgnoreAtBeginning index(w) = letterindex(word) + offset +
400382 /// iIgnoreAtBeginning
401383 /// </remarks>
402- /// <param name="w"> char array that contains the word </param>
403- /// <param name="offset"> Offset to first character in word </param>
404- /// <param name="len"> Length of word </param>
405- /// <param name="remainCharCount"> Minimum number of characters allowed before the
406- /// hyphenation point. </param>
407- /// <param name="pushCharCount"> Minimum number of characters allowed after the
408- /// hyphenation point. </param>
409- /// <returns> a <see cref="Hyphenation"/> object representing the
410- /// hyphenated word or null if word is not hyphenated. </returns>
411- public virtual Hyphenation Hyphenate ( ReadOnlySpan < char > w , int offset , int len , int remainCharCount , int pushCharCount )
384+ /// <param name="w">
385+ /// <see cref="ReadOnlySpan{T}"/> that contains the word. This should be sliced
386+ /// to the desired offset and length before passing in if necessary.
387+ /// </param>
388+ /// <param name="remainCharCount">
389+ /// Minimum number of characters allowed before the hyphenation point.
390+ /// </param>
391+ /// <param name="pushCharCount">
392+ /// Minimum number of characters allowed after the hyphenation point.
393+ /// </param>
394+ /// <returns>
395+ /// a <see cref="Hyphenation"/> object representing the hyphenated word or null if word is not hyphenated.
396+ /// </returns>
397+ public virtual Hyphenation Hyphenate ( ReadOnlySpan < char > w , int remainCharCount , int pushCharCount )
412398 {
413- int i ;
399+ int i , len = w . Length ;
414400 // LUCENENET: optimized method for Span and stackalloc
415401 Span < char > word = ( len + 3 ) * sizeof ( char ) > Constants . MaxStackByteLimit ? new char [ len + 3 ] : stackalloc char [ len + 3 ] ;
416402
@@ -421,7 +407,7 @@ public virtual Hyphenation Hyphenate(ReadOnlySpan<char> w, int offset, int len,
421407 bool bEndOfLetters = false ;
422408 for ( i = 1 ; i <= len ; i ++ )
423409 {
424- c [ 0 ] = w [ offset + i - 1 ] ;
410+ c [ 0 ] = w [ i - 1 ] ;
425411 int nc = m_classmap . Find ( c , 0 ) ;
426412 if ( nc < 0 ) // found a non-letter character ...
427413 {
0 commit comments