LUCENE-1972: Some additional FieldCache deprecations removed

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@824792 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2009-10-13 14:45:22 +00:00
parent c5af8f8fee
commit 0264adadaa
1 changed files with 9 additions and 77 deletions

View File

@ -84,8 +84,7 @@ class FieldCacheImpl implements FieldCache {
Map.Entry mapEntry = (Map.Entry) entrySetIterator.next(); Map.Entry mapEntry = (Map.Entry) entrySetIterator.next();
Entry entry = (Entry) mapEntry.getKey(); Entry entry = (Entry) mapEntry.getKey();
result.add(new CacheEntryImpl(readerKey, entry.field, result.add(new CacheEntryImpl(readerKey, entry.field,
cacheType, entry.type, cacheType, entry.custom,
entry.custom, entry.locale,
mapEntry.getValue())); mapEntry.getValue()));
} }
} }
@ -95,34 +94,19 @@ class FieldCacheImpl implements FieldCache {
} }
private static final class CacheEntryImpl extends CacheEntry { private static final class CacheEntryImpl extends CacheEntry {
/**
* @deprecated Only needed because of Entry (ab)use by
* FieldSortedHitQueue, remove when FieldSortedHitQueue
* is removed
*/
private final int sortFieldType;
/**
* @deprecated Only needed because of Entry (ab)use by
* FieldSortedHitQueue, remove when FieldSortedHitQueue
* is removed
*/
private final Locale locale;
private final Object readerKey; private final Object readerKey;
private final String fieldName; private final String fieldName;
private final Class cacheType; private final Class cacheType;
private final Object custom; private final Object custom;
private final Object value; private final Object value;
CacheEntryImpl(Object readerKey, String fieldName, CacheEntryImpl(Object readerKey, String fieldName,
Class cacheType, int sortFieldType, Class cacheType,
Object custom, Locale locale, Object custom,
Object value) { Object value) {
this.readerKey = readerKey; this.readerKey = readerKey;
this.fieldName = fieldName; this.fieldName = fieldName;
this.cacheType = cacheType; this.cacheType = cacheType;
this.sortFieldType = sortFieldType;
this.custom = custom; this.custom = custom;
this.locale = locale;
this.value = value; this.value = value;
// :HACK: for testing. // :HACK: for testing.
@ -136,22 +120,6 @@ class FieldCacheImpl implements FieldCache {
public Class getCacheType() { return cacheType; } public Class getCacheType() { return cacheType; }
public Object getCustom() { return custom; } public Object getCustom() { return custom; }
public Object getValue() { return value; } public Object getValue() { return value; }
/**
* Adds warning to super.toString if Local or sortFieldType were specified
* @deprecated Only needed because of Entry (ab)use by
* FieldSortedHitQueue, remove when FieldSortedHitQueue
* is removed
*/
public String toString() {
String r = super.toString();
if (null != locale) {
r = r + "...!!!Locale:" + locale + "???";
}
if (SortField.CUSTOM != sortFieldType) {
r = r + "...!!!SortType:" + sortFieldType + "???";
}
return r;
}
} }
/** /**
@ -243,59 +211,23 @@ class FieldCacheImpl implements FieldCache {
/** Expert: Every composite-key in the internal cache is of this type. */ /** Expert: Every composite-key in the internal cache is of this type. */
static class Entry { static class Entry {
final String field; // which Fieldable final String field; // which Fieldable
/**
* @deprecated Only (ab)used by FieldSortedHitQueue,
* remove when FieldSortedHitQueue is removed
*/
final int type; // which SortField type
final Object custom; // which custom comparator or parser final Object custom; // which custom comparator or parser
/**
* @deprecated Only (ab)used by FieldSortedHitQueue,
* remove when FieldSortedHitQueue is removed
*/
final Locale locale; // the locale we're sorting (if string)
/**
* @deprecated Only (ab)used by FieldSortedHitQueue,
* remove when FieldSortedHitQueue is removed
*/
Entry (String field, int type, Locale locale) {
this.field = StringHelper.intern(field);
this.type = type;
this.custom = null;
this.locale = locale;
}
/** Creates one of these objects for a custom comparator/parser. */ /** Creates one of these objects for a custom comparator/parser. */
Entry (String field, Object custom) { Entry (String field, Object custom) {
this.field = StringHelper.intern(field); this.field = StringHelper.intern(field);
this.type = SortField.CUSTOM;
this.custom = custom; this.custom = custom;
this.locale = null;
}
/**
* @deprecated Only (ab)used by FieldSortedHitQueue,
* remove when FieldSortedHitQueue is removed
*/
Entry (String field, int type, Parser parser) {
this.field = StringHelper.intern(field);
this.type = type;
this.custom = parser;
this.locale = null;
} }
/** Two of these are equal iff they reference the same field and type. */ /** Two of these are equal iff they reference the same field and type. */
public boolean equals (Object o) { public boolean equals (Object o) {
if (o instanceof Entry) { if (o instanceof Entry) {
Entry other = (Entry) o; Entry other = (Entry) o;
if (other.field == field && other.type == type) { if (other.field == field) {
if (other.locale == null ? locale == null : other.locale.equals(locale)) { if (other.custom == null) {
if (other.custom == null) { if (custom == null) return true;
if (custom == null) return true; } else if (other.custom.equals (custom)) {
} else if (other.custom.equals (custom)) { return true;
return true;
}
} }
} }
} }
@ -304,7 +236,7 @@ class FieldCacheImpl implements FieldCache {
/** Composes a hashcode based on the field and type. */ /** Composes a hashcode based on the field and type. */
public int hashCode() { public int hashCode() {
return field.hashCode() ^ type ^ (custom==null ? 0 : custom.hashCode()) ^ (locale==null ? 0 : locale.hashCode()); return field.hashCode() ^ (custom==null ? 0 : custom.hashCode());
} }
} }