24 |
import java.util.*; |
import java.util.*; |
25 |
import java.text.*; |
import java.text.*; |
26 |
import java.io.File; |
import java.io.File; |
27 |
|
import javax.swing.text.Segment; |
28 |
|
|
29 |
/** |
/** |
30 |
* Represents the least common denominator of all Javadoc |
* Represents the least common denominator of all Javadoc |
191 |
private static int findEndOfSentence(char[] text, int startIndex, |
private static int findEndOfSentence(char[] text, int startIndex, |
192 |
int endIndex) |
int endIndex) |
193 |
{ |
{ |
194 |
while (startIndex < endIndex) |
if (Main.getInstance().isUseBreakIterator()) { |
195 |
{ |
Segment segment = new Segment(text, startIndex, endIndex - startIndex); |
196 |
if (text[startIndex] == '.' |
BreakIterator breakIterator = BreakIterator.getSentenceInstance(Main.getInstance().getLocale()); |
197 |
&& (startIndex+1 == endIndex |
breakIterator.setText(segment); |
198 |
|| Character.isWhitespace(text[startIndex+1]) |
int result = breakIterator.next(); |
199 |
|| isHTMLBreakTag(text, startIndex+1, endIndex))) |
if (BreakIterator.DONE == result) { |
200 |
return startIndex; |
return endIndex; |
201 |
|
} |
202 |
|
else { |
203 |
|
return result; |
204 |
|
} |
205 |
|
} |
206 |
|
else { |
207 |
|
while (startIndex < endIndex) { |
208 |
|
if (text[startIndex] == '.' |
209 |
|
&& (startIndex+1 == endIndex |
210 |
|
|| Character.isWhitespace(text[startIndex+1]) |
211 |
|
|| isHTMLBreakTag(text, startIndex+1, endIndex))) |
212 |
|
return startIndex; |
213 |
|
|
214 |
startIndex++; |
startIndex++; |
215 |
} |
} |
216 |
return endIndex; |
return endIndex; |
217 |
|
} |
218 |
} |
} |
219 |
|
|
220 |
/** |
/** |