本文整理匯總了Java中org.apache.lucene.util.BytesRef.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java BytesRef.equals方法的具體用法?Java BytesRef.equals怎麽用?Java BytesRef.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.lucene.util.BytesRef
的用法示例。
在下文中一共展示了BytesRef.equals方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: accept
import org.apache.lucene.util.BytesRef; //導入方法依賴的package包/類
@Override
protected AcceptStatus accept(BytesRef term) {
if (!this.includeLower && term.equals(lowerBytesRef))
return AcceptStatus.NO;
// Use this field's default sort ordering
if (upperBytesRef != null) {
final int cmp = termComp.compare(upperBytesRef, term);
/*
* if beyond the upper term, or is exclusive and this is equal to
* the upper term, break out
*/
if ((cmp < 0) ||
(!includeUpper && cmp==0)) {
return AcceptStatus.END;
}
}
return AcceptStatus.YES;
}
示例2: parseTimeZone
import org.apache.lucene.util.BytesRef; //導入方法依賴的package包/類
public static DateTimeZone parseTimeZone(BytesRef timezone) throws IllegalArgumentException {
if (timezone == null) {
throw new IllegalArgumentException("invalid time zone value NULL");
}
if (timezone.equals(DEFAULT_TZ_BYTES_REF)) {
return DEFAULT_TZ;
}
DateTimeZone tz = TIME_ZONE_MAP.get(timezone);
if (tz == null) {
try {
String text = timezone.utf8ToString();
int index = text.indexOf(':');
if (index != -1) {
int beginIndex = text.charAt(0) == '+' ? 1 : 0;
// format like -02:30
tz = DateTimeZone.forOffsetHoursMinutes(
Integer.parseInt(text.substring(beginIndex, index)),
Integer.parseInt(text.substring(index + 1))
);
} else {
// id, listed here: http://joda-time.sourceforge.net/timezones.html
// or here: http://www.joda.org/joda-time/timezones.html
tz = DateTimeZone.forID(text);
}
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException(String.format(Locale.ENGLISH,
"invalid time zone value '%s'", timezone.utf8ToString()));
}
TIME_ZONE_MAP.putIfAbsent(timezone, tz);
}
return tz;
}
示例3: toLong
import org.apache.lucene.util.BytesRef; //導入方法依賴的package包/類
@Override
public long toLong(BytesRef indexForm) {
if (indexForm.equals(BooleanFieldMapper.Values.FALSE)) {
return 0;
} else if (indexForm.equals(BooleanFieldMapper.Values.TRUE)) {
return 1;
} else {
throw new IllegalArgumentException("Cannot convert " + indexForm + " to a boolean");
}
}
示例4: matches
import org.apache.lucene.util.BytesRef; //導入方法依賴的package包/類
/** returns true if term is within k edits of the query term */
final boolean matches(BytesRef term, int k) {
return k == 0 ? term.equals(termRef) : matchers[k].run(term.bytes, term.offset, term.length);
}
示例5: accept
import org.apache.lucene.util.BytesRef; //導入方法依賴的package包/類
@Override
protected AcceptStatus accept(BytesRef term) {
return term.equals(singleRef) ? AcceptStatus.YES : AcceptStatus.END;
}