@@ -227,31 +227,32 @@ public static String locateOriginalText(String fullLicenseText, int startToken,
227
227
/**
228
228
* Check whether the given text contains only a single token
229
229
* <p>
230
- * A single token string is a string that contains zero or one
231
- * non-whitspace token as identified by the
232
- * {@link LicenseTextHelper#TOKEN_SPLIT_PATTERN}.
230
+ * A single token string is a string that contains zero or one token,
231
+ * as identified by the {@link LicenseTextHelper#TOKEN_SPLIT_PATTERN}.
232
+ * Whitespace and punctuation such as dots, commas, question marks,
233
+ * and quotation marks are ignored.
233
234
* </p>
234
235
*
235
236
* @param text The text to test.
236
- * @return {@code true} if the text contains zero one token,
237
+ * @return {@code true} if the text contains zero or one token,
237
238
* {@code false} otherwise.
238
239
*/
239
240
public static boolean isSingleTokenString (@ Nullable String text ) {
240
241
if (text == null || text .isEmpty ()) {
241
- return true ; // zero tokens is considered a single token string
242
+ return true ; // Zero tokens is considered a single token string
242
243
}
243
244
Matcher m = LicenseTextHelper .TOKEN_SPLIT_PATTERN .matcher (text );
244
245
boolean found = false ;
245
246
while (m .find ()) {
246
247
if (!m .group (1 ).trim ().isEmpty ()) {
247
248
if (found ) {
248
- return false ; // more than one token found
249
+ return false ; // More than one eligible token found
249
250
} else {
250
- found = true ; // first token found
251
+ found = true ; // First eligible token found
251
252
}
252
253
}
253
254
}
254
- return true ; // either no tokens or only one token found
255
+ return true ; // Zero or one eligible token found
255
256
}
256
257
257
258
/**
0 commit comments