| Code with Finding: |
class TermRangeTermEnum {
protected boolean termCompare(Term term) {
if (collator == null) {
// Use Unicode code point ordering
boolean checkLower = false;
if (!includeLower) // make adjustments to set to exclusive
checkLower = true;
if (term != null && term.field() == field) { // interned comparison
if (!checkLower || null==lowerTermText || term.text().compareTo(lowerTermText) > 0) {
checkLower = false;
if (upperTermText != null) {
int compare = upperTermText.compareTo(term.text());
/*
* if beyond the upper term, or is exclusive and this is equal to
* the upper term, break out
*/
if ((compare < 0) ||
(!includeUpper && compare==0)) {
endEnum = true;
return false;
}
}
return true;
}
} else {
// break
endEnum = true;
return false;
}
return false;
} else {
if (term != null && term.field() == field) { // interned comparison
if ((lowerTermText == null
|| (includeLower
? collator.compare(term.text(), lowerTermText) >= 0
: collator.compare(term.text(), lowerTermText) > 0))
&& (upperTermText == null
|| (includeUpper
? collator.compare(term.text(), upperTermText) <= 0
: collator.compare(term.text(), upperTermText) < 0))) {
return true;
}
return false;
}
endEnum = true;
return false;
}
}
}
|