mirror of https://github.com/apache/lucene.git
LUCENE-2000: remove redundant casts
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1307012 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e49b69d459
commit
49f43806a8
|
@ -39,7 +39,7 @@
|
|||
<classpathentry kind="src" path="modules/analysis/uima/src/test"/>
|
||||
<classpathentry kind="src" path="modules/benchmark/src/java"/>
|
||||
<classpathentry kind="src" path="modules/benchmark/src/test"/>
|
||||
<classpathentry excluding="src" including="conf/**" kind="src" path="modules/benchmark"/>
|
||||
<classpathentry kind="src" path="modules/benchmark/conf"/>
|
||||
<classpathentry kind="src" path="modules/facet/src/java"/>
|
||||
<classpathentry kind="src" path="modules/facet/src/examples"/>
|
||||
<classpathentry kind="src" path="modules/facet/src/test"/>
|
||||
|
|
|
@ -370,7 +370,7 @@ public class Token extends CharTermAttributeImpl
|
|||
Token t = (Token)super.clone();
|
||||
// Do a deep clone
|
||||
if (payload != null) {
|
||||
t.payload = (Payload) payload.clone();
|
||||
t.payload = payload.clone();
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ public class Token extends CharTermAttributeImpl
|
|||
t.flags = flags;
|
||||
t.type = type;
|
||||
if (payload != null)
|
||||
t.payload = (Payload) payload.clone();
|
||||
t.payload = payload.clone();
|
||||
return t;
|
||||
}
|
||||
|
||||
|
@ -577,13 +577,13 @@ public class Token extends CharTermAttributeImpl
|
|||
to.reinit(this);
|
||||
// reinit shares the payload, so clone it:
|
||||
if (payload !=null) {
|
||||
to.payload = (Payload) payload.clone();
|
||||
to.payload = payload.clone();
|
||||
}
|
||||
} else {
|
||||
super.copyTo(target);
|
||||
((OffsetAttribute) target).setOffset(startOffset, endOffset);
|
||||
((PositionIncrementAttribute) target).setPositionIncrement(positionIncrement);
|
||||
((PayloadAttribute) target).setPayload((payload == null) ? null : (Payload) payload.clone());
|
||||
((PayloadAttribute) target).setPayload((payload == null) ? null : payload.clone());
|
||||
((FlagsAttribute) target).setFlags(flags);
|
||||
((TypeAttribute) target).setType(type);
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class PayloadAttributeImpl extends AttributeImpl implements PayloadAttrib
|
|||
public PayloadAttributeImpl clone() {
|
||||
PayloadAttributeImpl clone = (PayloadAttributeImpl) super.clone();
|
||||
if (payload != null) {
|
||||
clone.payload = (Payload) payload.clone();
|
||||
clone.payload = payload.clone();
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class PayloadAttributeImpl extends AttributeImpl implements PayloadAttrib
|
|||
@Override
|
||||
public void copyTo(AttributeImpl target) {
|
||||
PayloadAttribute t = (PayloadAttribute) target;
|
||||
t.setPayload((payload == null) ? null : (Payload) payload.clone());
|
||||
t.setPayload((payload == null) ? null : payload.clone());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -729,7 +729,7 @@ public class BlockTermsReader extends FieldsProducer {
|
|||
public TermState termState() throws IOException {
|
||||
//System.out.println("BTR.termState this=" + this);
|
||||
decodeMetaData();
|
||||
TermState ts = (TermState) state.clone();
|
||||
TermState ts = state.clone();
|
||||
//System.out.println(" return ts=" + ts);
|
||||
return ts;
|
||||
}
|
||||
|
|
|
@ -803,7 +803,7 @@ public class BlockTreeTermsReader extends FieldsProducer {
|
|||
@Override
|
||||
public TermState termState() throws IOException {
|
||||
currentFrame.decodeMetaData();
|
||||
return (TermState) currentFrame.termState.clone();
|
||||
return currentFrame.termState.clone();
|
||||
}
|
||||
|
||||
private Frame getFrame(int ord) throws IOException {
|
||||
|
@ -2166,7 +2166,7 @@ public class BlockTreeTermsReader extends FieldsProducer {
|
|||
public TermState termState() throws IOException {
|
||||
assert !eof;
|
||||
currentFrame.decodeMetaData();
|
||||
TermState ts = (TermState) currentFrame.state.clone();
|
||||
TermState ts = currentFrame.state.clone();
|
||||
//if (DEBUG) System.out.println("BTTR.termState seg=" + segment + " state=" + ts);
|
||||
return ts;
|
||||
}
|
||||
|
|
|
@ -109,8 +109,8 @@ final class SegmentTermEnum implements Cloneable {
|
|||
clone.input = (IndexInput) input.clone();
|
||||
clone.termInfo = new TermInfo(termInfo);
|
||||
|
||||
clone.termBuffer = (TermBuffer)termBuffer.clone();
|
||||
clone.prevBuffer = (TermBuffer)prevBuffer.clone();
|
||||
clone.termBuffer = termBuffer.clone();
|
||||
clone.prevBuffer = prevBuffer.clone();
|
||||
clone.scanBuffer = new TermBuffer();
|
||||
|
||||
return clone;
|
||||
|
|
|
@ -340,12 +340,12 @@ final class TermInfosReader {
|
|||
|
||||
/** Returns an enumeration of all the Terms and TermInfos in the set. */
|
||||
public SegmentTermEnum terms() {
|
||||
return (SegmentTermEnum)origEnum.clone();
|
||||
return origEnum.clone();
|
||||
}
|
||||
|
||||
/** Returns an enumeration of terms starting at or after the named term. */
|
||||
public SegmentTermEnum terms(Term term) throws IOException {
|
||||
get(term, true);
|
||||
return (SegmentTermEnum)getThreadResources().termEnum.clone();
|
||||
return getThreadResources().termEnum.clone();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ class TermInfosReaderIndex {
|
|||
}
|
||||
|
||||
void seekEnum(SegmentTermEnum enumerator, int indexOffset) throws IOException {
|
||||
PagedBytesDataInput input = (PagedBytesDataInput) dataInput.clone();
|
||||
PagedBytesDataInput input = dataInput.clone();
|
||||
|
||||
input.setPosition(indexToDataOffset.get(indexOffset));
|
||||
|
||||
|
@ -152,7 +152,7 @@ class TermInfosReaderIndex {
|
|||
int getIndexOffset(Term term) throws IOException {
|
||||
int lo = 0;
|
||||
int hi = indexSize - 1;
|
||||
PagedBytesDataInput input = (PagedBytesDataInput) dataInput.clone();
|
||||
PagedBytesDataInput input = dataInput.clone();
|
||||
BytesRef scratch = new BytesRef();
|
||||
while (hi >= lo) {
|
||||
int mid = (lo + hi) >>> 1;
|
||||
|
@ -176,7 +176,7 @@ class TermInfosReaderIndex {
|
|||
* @throws IOException
|
||||
*/
|
||||
Term getTerm(int termIndex) throws IOException {
|
||||
PagedBytesDataInput input = (PagedBytesDataInput) dataInput.clone();
|
||||
PagedBytesDataInput input = dataInput.clone();
|
||||
input.setPosition(indexToDataOffset.get(termIndex));
|
||||
|
||||
// read the term
|
||||
|
@ -206,7 +206,7 @@ class TermInfosReaderIndex {
|
|||
* @throws IOException
|
||||
*/
|
||||
int compareTo(Term term, int termIndex) throws IOException {
|
||||
return compareTo(term, termIndex, (PagedBytesDataInput) dataInput.clone(), new BytesRef());
|
||||
return compareTo(term, termIndex, dataInput.clone(), new BytesRef());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -172,13 +172,13 @@ public class SepPostingsReader extends PostingsReaderBase {
|
|||
super.copyFrom(_other);
|
||||
SepTermState other = (SepTermState) _other;
|
||||
if (docIndex == null) {
|
||||
docIndex = (IntIndexInput.Index) other.docIndex.clone();
|
||||
docIndex = other.docIndex.clone();
|
||||
} else {
|
||||
docIndex.set(other.docIndex);
|
||||
}
|
||||
if (other.freqIndex != null) {
|
||||
if (freqIndex == null) {
|
||||
freqIndex = (IntIndexInput.Index) other.freqIndex.clone();
|
||||
freqIndex = other.freqIndex.clone();
|
||||
} else {
|
||||
freqIndex.set(other.freqIndex);
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ public class SepPostingsReader extends PostingsReaderBase {
|
|||
}
|
||||
if (other.posIndex != null) {
|
||||
if (posIndex == null) {
|
||||
posIndex = (IntIndexInput.Index) other.posIndex.clone();
|
||||
posIndex = other.posIndex.clone();
|
||||
} else {
|
||||
posIndex.set(other.posIndex);
|
||||
}
|
||||
|
|
|
@ -475,7 +475,7 @@ public class CheckIndex {
|
|||
}
|
||||
|
||||
|
||||
result.newSegments = (SegmentInfos) sis.clone();
|
||||
result.newSegments = sis.clone();
|
||||
result.newSegments.clear();
|
||||
result.maxSegmentName = -1;
|
||||
|
||||
|
@ -642,7 +642,7 @@ public class CheckIndex {
|
|||
}
|
||||
|
||||
// Keeper
|
||||
result.newSegments.add((SegmentInfo) info.clone());
|
||||
result.newSegments.add(info.clone());
|
||||
}
|
||||
|
||||
if (0 == result.numBadSegments) {
|
||||
|
|
|
@ -169,7 +169,7 @@ public final class FieldInfos implements Iterable<FieldInfo> {
|
|||
fis.hasProx = hasProx;
|
||||
fis.hasVectors = hasVectors;
|
||||
for (FieldInfo fi : this) {
|
||||
FieldInfo clone = (FieldInfo) (fi).clone();
|
||||
FieldInfo clone = fi.clone();
|
||||
fis.putInternal(clone);
|
||||
}
|
||||
return fis;
|
||||
|
@ -444,7 +444,7 @@ public final class FieldInfos implements Iterable<FieldInfo> {
|
|||
}
|
||||
final FieldInfos roFis = new FieldInfos((FieldNumberBiMap)null);
|
||||
for (FieldInfo fieldInfo : this) {
|
||||
FieldInfo clone = (FieldInfo) (fieldInfo).clone();
|
||||
FieldInfo clone = fieldInfo.clone();
|
||||
roFis.putInternal(clone);
|
||||
roFis.hasVectors |= clone.storeTermVector;
|
||||
roFis.hasProx |= clone.isIndexed && clone.indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
|
||||
|
|
|
@ -145,7 +145,7 @@ public final class IndexUpgrader {
|
|||
}
|
||||
}
|
||||
|
||||
final IndexWriterConfig c = (IndexWriterConfig) iwc.clone();
|
||||
final IndexWriterConfig c = iwc.clone();
|
||||
c.setMergePolicy(new UpgradeIndexMergePolicy(c.getMergePolicy()));
|
||||
c.setIndexDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy());
|
||||
|
||||
|
|
|
@ -585,7 +585,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
|||
*/
|
||||
public IndexWriter(Directory d, IndexWriterConfig conf)
|
||||
throws CorruptIndexException, LockObtainFailedException, IOException {
|
||||
config = (IndexWriterConfig) conf.clone();
|
||||
config = conf.clone();
|
||||
directory = d;
|
||||
analyzer = conf.getAnalyzer();
|
||||
infoStream = conf.getInfoStream();
|
||||
|
@ -2431,7 +2431,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
|||
// no partial changes (eg a delete w/o
|
||||
// corresponding add from an updateDocument) can
|
||||
// sneak into the commit point:
|
||||
toCommit = (SegmentInfos) segmentInfos.clone();
|
||||
toCommit = segmentInfos.clone();
|
||||
|
||||
pendingCommitChangeCount = changeCount;
|
||||
|
||||
|
|
|
@ -273,7 +273,7 @@ class ReadersAndLiveDocs {
|
|||
assert liveDocs.length() == info.docCount;
|
||||
|
||||
// Save in case we need to rollback on failure:
|
||||
final SegmentInfo sav = (SegmentInfo) info.clone();
|
||||
final SegmentInfo sav = info.clone();
|
||||
info.advanceDelGen();
|
||||
info.setDelCount(info.getDelCount() + pendingDeleteCount);
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ public final class SegmentInfo implements Cloneable {
|
|||
docStoreIsCompoundFile = src.docStoreIsCompoundFile;
|
||||
hasVectors = src.hasVectors;
|
||||
hasProx = src.hasProx;
|
||||
fieldInfos = src.fieldInfos == null ? null : (FieldInfos) src.fieldInfos.clone();
|
||||
fieldInfos = src.fieldInfos == null ? null : src.fieldInfos.clone();
|
||||
if (src.normGen == null) {
|
||||
normGen = null;
|
||||
} else {
|
||||
|
@ -254,7 +254,7 @@ public final class SegmentInfo implements Cloneable {
|
|||
@Override
|
||||
public SegmentInfo clone() {
|
||||
final SegmentInfo si = new SegmentInfo(name, docCount, dir, isCompoundFile, codec,
|
||||
fieldInfos == null ? null : (FieldInfos) fieldInfos.clone());
|
||||
fieldInfos == null ? null : fieldInfos.clone());
|
||||
si.docStoreOffset = docStoreOffset;
|
||||
si.docStoreSegment = docStoreSegment;
|
||||
si.docStoreIsCompoundFile = docStoreIsCompoundFile;
|
||||
|
|
|
@ -385,7 +385,7 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentInfo> {
|
|||
for(final SegmentInfo info : this) {
|
||||
assert info.getCodec() != null;
|
||||
// dont directly access segments, use add method!!!
|
||||
sis.add((SegmentInfo) info.clone());
|
||||
sis.add(info.clone());
|
||||
}
|
||||
sis.userData = new HashMap<String,String>(userData);
|
||||
return sis;
|
||||
|
@ -957,7 +957,7 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentInfo> {
|
|||
final List<SegmentInfo> list = new ArrayList<SegmentInfo>(size());
|
||||
for(final SegmentInfo info : this) {
|
||||
assert info.getCodec() != null;
|
||||
list.add((SegmentInfo) info.clone());
|
||||
list.add(info.clone());
|
||||
}
|
||||
return list;
|
||||
} else {
|
||||
|
|
|
@ -83,7 +83,7 @@ final class StandardDirectoryReader extends DirectoryReader {
|
|||
List<SegmentReader> readers = new ArrayList<SegmentReader>();
|
||||
final Directory dir = writer.getDirectory();
|
||||
|
||||
final SegmentInfos segmentInfos = (SegmentInfos) infos.clone();
|
||||
final SegmentInfos segmentInfos = infos.clone();
|
||||
int infosUpto = 0;
|
||||
for (int i=0;i<numSegments;i++) {
|
||||
IOException prior = null;
|
||||
|
|
|
@ -433,7 +433,7 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
|
|||
|
||||
if (getBoost() != 1.0f) { // incorporate boost
|
||||
if (query == c.getQuery()) { // if rewrite was no-op
|
||||
query = (Query)query.clone(); // then clone before boost
|
||||
query = query.clone(); // then clone before boost
|
||||
}
|
||||
// Since the BooleanQuery only has 1 clause, the BooleanQuery will be
|
||||
// written out. Therefore the rewritten Query's boost must incorporate both
|
||||
|
|
|
@ -190,7 +190,7 @@ public class DisjunctionMaxQuery extends Query implements Iterable<Query> {
|
|||
Query singleton = disjuncts.get(0);
|
||||
Query result = singleton.rewrite(reader);
|
||||
if (getBoost() != 1.0f) {
|
||||
if (result == singleton) result = (Query)result.clone();
|
||||
if (result == singleton) result = result.clone();
|
||||
result.setBoost(getBoost() * result.getBoost());
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -334,7 +334,7 @@ public class AttributeSource {
|
|||
*/
|
||||
public final State captureState() {
|
||||
final State state = this.getCurrentState();
|
||||
return (state == null) ? null : (State) state.clone();
|
||||
return (state == null) ? null : state.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -466,7 +466,7 @@ public class AttributeSource {
|
|||
if (hasAttributes()) {
|
||||
// first clone the impls
|
||||
for (State state = getCurrentState(); state != null; state = state.next) {
|
||||
clone.attributeImpls.put(state.attribute.getClass(), (AttributeImpl) state.attribute.clone());
|
||||
clone.attributeImpls.put(state.attribute.getClass(), state.attribute.clone());
|
||||
}
|
||||
|
||||
// now the interfaces
|
||||
|
|
|
@ -255,7 +255,7 @@ public class TestCodecs extends LuceneTestCase {
|
|||
final FieldData[] fields = new FieldData[] {field};
|
||||
|
||||
final Directory dir = newDirectory();
|
||||
FieldInfos clonedFieldInfos = (FieldInfos) fieldInfos.clone();
|
||||
FieldInfos clonedFieldInfos = fieldInfos.clone();
|
||||
this.write(fieldInfos, dir, fields, true);
|
||||
Codec codec = Codec.getDefault();
|
||||
final SegmentInfo si = new SegmentInfo(SEGMENT, 10000, dir, false, codec, clonedFieldInfos);
|
||||
|
@ -311,7 +311,7 @@ public class TestCodecs extends LuceneTestCase {
|
|||
System.out.println("TEST: now write postings");
|
||||
}
|
||||
|
||||
FieldInfos clonedFieldInfos = (FieldInfos) fieldInfos.clone();
|
||||
FieldInfos clonedFieldInfos = fieldInfos.clone();
|
||||
this.write(fieldInfos, dir, fields, false);
|
||||
Codec codec = Codec.getDefault();
|
||||
final SegmentInfo si = new SegmentInfo(SEGMENT, 10000, dir, false, codec, clonedFieldInfos);
|
||||
|
|
|
@ -102,7 +102,7 @@ public class TestFieldInfos extends LuceneTestCase {
|
|||
FieldInfos fieldInfos = createAndWriteFieldInfos(dir, name);
|
||||
FieldInfos readOnly = readFieldInfos(dir, name);
|
||||
assertReadOnly(readOnly, fieldInfos);
|
||||
FieldInfos readOnlyClone = (FieldInfos)readOnly.clone();
|
||||
FieldInfos readOnlyClone = readOnly.clone();
|
||||
assertNotSame(readOnly, readOnlyClone);
|
||||
// clone is also read only - no global field map
|
||||
assertReadOnly(readOnlyClone, fieldInfos);
|
||||
|
|
|
@ -156,7 +156,7 @@ public class TestIndexWriterConfig extends LuceneTestCase {
|
|||
@Test
|
||||
public void testClone() throws Exception {
|
||||
IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random));
|
||||
IndexWriterConfig clone = (IndexWriterConfig) conf.clone();
|
||||
IndexWriterConfig clone = conf.clone();
|
||||
|
||||
// Clone is shallow since not all parameters are cloneable.
|
||||
assertTrue(conf.getIndexDeletionPolicy() == clone.getIndexDeletionPolicy());
|
||||
|
|
|
@ -94,7 +94,7 @@ public class TestBooleanQuery extends LuceneTestCase {
|
|||
assertEquals(score*.5F, score2, 1e-6);
|
||||
|
||||
// LUCENE-2617: make sure that a clause not in the index still contributes to the score via coord factor
|
||||
BooleanQuery qq = (BooleanQuery)q.clone();
|
||||
BooleanQuery qq = q.clone();
|
||||
PhraseQuery phrase = new PhraseQuery();
|
||||
phrase.add(new Term("field", "not_in_index"));
|
||||
phrase.add(new Term("field", "another_not_in_index"));
|
||||
|
|
|
@ -139,14 +139,14 @@ public class TestFixedBitSet extends LuceneTestCase {
|
|||
fromIndex = random.nextInt(sz/2);
|
||||
toIndex = fromIndex + random.nextInt(sz - fromIndex);
|
||||
BitSet aa = (BitSet)a.clone(); aa.flip(fromIndex,toIndex);
|
||||
FixedBitSet bb = (FixedBitSet)b.clone(); bb.flip(fromIndex,toIndex);
|
||||
FixedBitSet bb = b.clone(); bb.flip(fromIndex,toIndex);
|
||||
|
||||
doIterate(aa,bb, mode); // a problem here is from flip or doIterate
|
||||
|
||||
fromIndex = random.nextInt(sz/2);
|
||||
toIndex = fromIndex + random.nextInt(sz - fromIndex);
|
||||
aa = (BitSet)a.clone(); aa.clear(fromIndex,toIndex);
|
||||
bb = (FixedBitSet)b.clone(); bb.clear(fromIndex,toIndex);
|
||||
bb = b.clone(); bb.clear(fromIndex,toIndex);
|
||||
|
||||
doNextSetBit(aa,bb); // a problem here is from clear() or nextSetBit
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class TestFixedBitSet extends LuceneTestCase {
|
|||
fromIndex = random.nextInt(sz/2);
|
||||
toIndex = fromIndex + random.nextInt(sz - fromIndex);
|
||||
aa = (BitSet)a.clone(); aa.set(fromIndex,toIndex);
|
||||
bb = (FixedBitSet)b.clone(); bb.set(fromIndex,toIndex);
|
||||
bb = b.clone(); bb.set(fromIndex,toIndex);
|
||||
|
||||
doNextSetBit(aa,bb); // a problem here is from set() or nextSetBit
|
||||
|
||||
|
@ -168,9 +168,9 @@ public class TestFixedBitSet extends LuceneTestCase {
|
|||
BitSet a_or = (BitSet)a.clone(); a_or.or(a0);
|
||||
BitSet a_andn = (BitSet)a.clone(); a_andn.andNot(a0);
|
||||
|
||||
FixedBitSet b_and = (FixedBitSet)b.clone(); assertEquals(b,b_and); b_and.and(b0);
|
||||
FixedBitSet b_or = (FixedBitSet)b.clone(); b_or.or(b0);
|
||||
FixedBitSet b_andn = (FixedBitSet)b.clone(); b_andn.andNot(b0);
|
||||
FixedBitSet b_and = b.clone(); assertEquals(b,b_and); b_and.and(b0);
|
||||
FixedBitSet b_or = b.clone(); b_or.or(b0);
|
||||
FixedBitSet b_andn = b.clone(); b_andn.andNot(b0);
|
||||
|
||||
assertEquals(a0.cardinality(), b0.cardinality());
|
||||
assertEquals(a_or.cardinality(), b_or.cardinality());
|
||||
|
|
|
@ -354,7 +354,7 @@ public class TernaryTree implements Cloneable {
|
|||
t.hi = this.hi.clone();
|
||||
t.eq = this.eq.clone();
|
||||
t.sc = this.sc.clone();
|
||||
t.kv = (CharVector) this.kv.clone();
|
||||
t.kv = this.kv.clone();
|
||||
t.root = this.root;
|
||||
t.freenode = this.freenode;
|
||||
t.length = this.length;
|
||||
|
@ -556,11 +556,11 @@ public class TernaryTree implements Cloneable {
|
|||
case 1:
|
||||
if (sc[i.parent] != 0) {
|
||||
res = eq[i.parent];
|
||||
ns.push((Item) i.clone());
|
||||
ns.push(i.clone());
|
||||
ks.append(sc[i.parent]);
|
||||
} else {
|
||||
i.child++;
|
||||
ns.push((Item) i.clone());
|
||||
ns.push(i.clone());
|
||||
res = hi[i.parent];
|
||||
}
|
||||
climb = false;
|
||||
|
@ -568,7 +568,7 @@ public class TernaryTree implements Cloneable {
|
|||
|
||||
case 2:
|
||||
res = hi[i.parent];
|
||||
ns.push((Item) i.clone());
|
||||
ns.push(i.clone());
|
||||
if (ks.length() > 0) {
|
||||
ks.setLength(ks.length() - 1); // pop
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class PrefixAwareTokenFilter extends TokenStream {
|
|||
// Make it a deep copy
|
||||
Payload p = previousPrefixToken.getPayload();
|
||||
if (p != null) {
|
||||
previousPrefixToken.setPayload((Payload) p.clone());
|
||||
previousPrefixToken.setPayload(p.clone());
|
||||
}
|
||||
setCurrentToken(nextToken);
|
||||
return true;
|
||||
|
|
|
@ -39,7 +39,7 @@ public final class SingleTokenTokenStream extends TokenStream {
|
|||
super(Token.TOKEN_ATTRIBUTE_FACTORY);
|
||||
|
||||
assert token != null;
|
||||
this.singleToken = (Token) token.clone();
|
||||
this.singleToken = token.clone();
|
||||
|
||||
tokenAtt = (AttributeImpl) addAttribute(CharTermAttribute.class);
|
||||
assert (tokenAtt instanceof Token);
|
||||
|
@ -63,10 +63,10 @@ public final class SingleTokenTokenStream extends TokenStream {
|
|||
}
|
||||
|
||||
public Token getToken() {
|
||||
return (Token) singleToken.clone();
|
||||
return singleToken.clone();
|
||||
}
|
||||
|
||||
public void setToken(Token token) {
|
||||
this.singleToken = (Token) token.clone();
|
||||
this.singleToken = token.clone();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ public class TestCharArrayIterator extends LuceneTestCase {
|
|||
char text[] = "testing".toCharArray();
|
||||
ci.setText(text, 0, text.length);
|
||||
ci.next();
|
||||
CharArrayIterator ci2 = (CharArrayIterator) ci.clone();
|
||||
CharArrayIterator ci2 = ci.clone();
|
||||
assertEquals(ci.getIndex(), ci2.getIndex());
|
||||
assertEquals(ci.next(), ci2.next());
|
||||
assertEquals(ci.last(), ci2.last());
|
||||
|
|
|
@ -216,11 +216,11 @@ public class LaoBreakIterator extends BreakIterator {
|
|||
other.rules = (RuleBasedBreakIterator) rules.clone();
|
||||
other.verify = (RuleBasedBreakIterator) verify.clone();
|
||||
if (text != null)
|
||||
other.text = (CharArrayIterator) text.clone();
|
||||
other.text = text.clone();
|
||||
if (working != null)
|
||||
other.working = (CharArrayIterator) working.clone();
|
||||
other.working = working.clone();
|
||||
if (verifyText != null)
|
||||
other.verifyText = (CharArrayIterator) verifyText.clone();
|
||||
other.verifyText = verifyText.clone();
|
||||
return other;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ public class TestCharArrayIterator extends LuceneTestCase {
|
|||
CharArrayIterator ci = new CharArrayIterator();
|
||||
ci.setText(text, 0, text.length);
|
||||
ci.next();
|
||||
CharArrayIterator ci2 = (CharArrayIterator) ci.clone();
|
||||
CharArrayIterator ci2 = ci.clone();
|
||||
assertEquals(ci.getIndex(), ci2.getIndex());
|
||||
assertEquals(ci.next(), ci2.next());
|
||||
assertEquals(ci.last(), ci2.last());
|
||||
|
|
|
@ -464,7 +464,7 @@ private int jjMoveNfa_0(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
@ -569,7 +569,7 @@ private int jjMoveNfa_5(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
@ -670,7 +670,7 @@ private int jjMoveNfa_7(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
@ -766,7 +766,7 @@ private int jjMoveNfa_4(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
@ -892,7 +892,7 @@ private int jjMoveNfa_3(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
@ -1061,7 +1061,7 @@ private int jjMoveNfa_6(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
@ -1205,7 +1205,7 @@ private int jjMoveNfa_1(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
@ -1361,7 +1361,7 @@ private int jjMoveNfa_2(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
|
|
@ -63,7 +63,7 @@ public class RepSumByNameRoundTask extends ReportTask {
|
|||
TaskStats stat2 = p2.get(rname);
|
||||
if (stat2 == null) {
|
||||
try {
|
||||
stat2 = (TaskStats) stat1.clone();
|
||||
stat2 = stat1.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class RepSumByNameTask extends ReportTask {
|
|||
TaskStats stat2 = p2.get(name);
|
||||
if (stat2 == null) {
|
||||
try {
|
||||
stat2 = (TaskStats) stat1.clone();
|
||||
stat2 = stat1.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class RepSumByPrefRoundTask extends RepSumByPrefTask {
|
|||
TaskStats stat2 = p2.get(rname);
|
||||
if (stat2 == null) {
|
||||
try {
|
||||
stat2 = (TaskStats) stat1.clone();
|
||||
stat2 = stat1.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class RepSumByPrefTask extends ReportTask {
|
|||
TaskStats stat2 = p2.get(name);
|
||||
if (stat2 == null) {
|
||||
try {
|
||||
stat2 = (TaskStats) stat1.clone();
|
||||
stat2 = stat1.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -347,7 +347,7 @@ public class TaskSequence extends PerfTask {
|
|||
int index = 0;
|
||||
for (int k=0; k<repetitions; k++) {
|
||||
for (int i = 0; i < tasksArray.length; i++) {
|
||||
final PerfTask task = (PerfTask) tasksArray[i].clone();
|
||||
final PerfTask task = tasksArray[i].clone();
|
||||
t[index++] = new ParallelTask(task);
|
||||
}
|
||||
}
|
||||
|
@ -512,7 +512,7 @@ public class TaskSequence extends PerfTask {
|
|||
TaskSequence res = (TaskSequence) super.clone();
|
||||
res.tasks = new ArrayList<PerfTask>();
|
||||
for (int i = 0; i < tasks.size(); i++) {
|
||||
res.tasks.add((PerfTask)tasks.get(i).clone());
|
||||
res.tasks.add(tasks.get(i).clone());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public final class CategoryAttributeImpl extends AttributeImpl implements
|
|||
public CategoryAttributeImpl clone() {
|
||||
CategoryAttributeImpl ca = (CategoryAttributeImpl) super.clone();
|
||||
if (categoryPath != null) {
|
||||
ca.categoryPath = (CategoryPath) categoryPath.clone();
|
||||
ca.categoryPath = categoryPath.clone();
|
||||
}
|
||||
if (properties != null && !properties.isEmpty()) {
|
||||
ca.properties = (HashMap<Class<? extends CategoryProperty>, CategoryProperty>) properties
|
||||
|
|
|
@ -248,9 +248,9 @@ public abstract class FacetRequest implements Cloneable {
|
|||
public FacetResultsHandler createFacetResultsHandler(TaxonomyReader taxonomyReader) {
|
||||
try {
|
||||
if (resultMode == ResultMode.PER_NODE_IN_TREE) {
|
||||
return new TopKInEachNodeHandler(taxonomyReader, (FacetRequest) clone());
|
||||
return new TopKInEachNodeHandler(taxonomyReader, clone());
|
||||
}
|
||||
return new TopKFacetResultsHandler(taxonomyReader, (FacetRequest) clone());
|
||||
return new TopKFacetResultsHandler(taxonomyReader, clone());
|
||||
} catch (CloneNotSupportedException e) {
|
||||
// Shouldn't happen since we implement Cloneable. If it does happen, it is
|
||||
// probably because the class was changed to not implement Cloneable
|
||||
|
|
|
@ -56,7 +56,7 @@ public class ScoredDocIdsUtils {
|
|||
final OpenBitSet complement;
|
||||
if (docIdSet instanceof OpenBitSet) {
|
||||
// That is the most common case, if ScoredDocIdsCollector was used.
|
||||
complement = (OpenBitSet) ((OpenBitSet) docIdSet).clone();
|
||||
complement = ((OpenBitSet) docIdSet).clone();
|
||||
} else {
|
||||
complement = new OpenBitSetDISI(docIdSet.iterator(), maxDoc);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class FacetRequestTest extends LuceneTestCase {
|
|||
@Test
|
||||
public void testClone() throws Exception {
|
||||
FacetRequest fr = new CountFacetRequest(new CategoryPath("a"), 10);
|
||||
FacetRequest clone = (FacetRequest) fr.clone();
|
||||
FacetRequest clone = fr.clone();
|
||||
fr.setDepth(10);
|
||||
assertEquals("depth should not have been affected in the clone", FacetRequest.DEFAULT_DEPTH, clone.getDepth());
|
||||
}
|
||||
|
|
|
@ -336,7 +336,7 @@ public class ToChildBlockJoinQuery extends Query {
|
|||
|
||||
@Override
|
||||
public ToChildBlockJoinQuery clone() {
|
||||
return new ToChildBlockJoinQuery((Query) origParentQuery.clone(),
|
||||
return new ToChildBlockJoinQuery(origParentQuery.clone(),
|
||||
parentsFilter,
|
||||
doScores);
|
||||
}
|
||||
|
|
|
@ -451,7 +451,7 @@ public class ToParentBlockJoinQuery extends Query {
|
|||
|
||||
@Override
|
||||
public ToParentBlockJoinQuery clone() {
|
||||
return new ToParentBlockJoinQuery((Query) origChildQuery.clone(),
|
||||
return new ToParentBlockJoinQuery(origChildQuery.clone(),
|
||||
parentsFilter,
|
||||
scoreMode);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class BoostingQuery extends Query {
|
|||
|
||||
public BoostingQuery(Query match, Query context, float boost) {
|
||||
this.match = match;
|
||||
this.context = (Query) context.clone(); // clone before boost
|
||||
this.context = context.clone(); // clone before boost
|
||||
this.boost = boost;
|
||||
this.context.setBoost(0.0f); // ignore context-only matches
|
||||
}
|
||||
|
|
|
@ -88,14 +88,14 @@ public class CustomScoreQuery extends Query {
|
|||
|
||||
final Query sq = subQuery.rewrite(reader);
|
||||
if (sq != subQuery) {
|
||||
clone = (CustomScoreQuery) clone();
|
||||
clone = clone();
|
||||
clone.subQuery = sq;
|
||||
}
|
||||
|
||||
for(int i = 0; i < scoringQueries.length; i++) {
|
||||
final Query v = scoringQueries[i].rewrite(reader);
|
||||
if (v != scoringQueries[i]) {
|
||||
if (clone == null) clone = (CustomScoreQuery) clone();
|
||||
if (clone == null) clone = clone();
|
||||
clone.scoringQueries[i] = v;
|
||||
}
|
||||
}
|
||||
|
@ -116,10 +116,10 @@ public class CustomScoreQuery extends Query {
|
|||
@Override
|
||||
public CustomScoreQuery clone() {
|
||||
CustomScoreQuery clone = (CustomScoreQuery)super.clone();
|
||||
clone.subQuery = (Query) subQuery.clone();
|
||||
clone.subQuery = subQuery.clone();
|
||||
clone.scoringQueries = new Query[scoringQueries.length];
|
||||
for(int i = 0; i < scoringQueries.length; i++) {
|
||||
clone.scoringQueries[i] = (Query) scoringQueries[i].clone();
|
||||
clone.scoringQueries[i] = scoringQueries[i].clone();
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
|
|
@ -438,7 +438,7 @@ private int jjMoveNfa_2(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
@ -604,7 +604,7 @@ private int jjMoveNfa_0(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
@ -777,7 +777,7 @@ private int jjMoveNfa_1(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
|
|
@ -374,7 +374,7 @@ private int jjMoveNfa_2(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
@ -494,7 +494,7 @@ private int jjMoveNfa_0(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
@ -667,7 +667,7 @@ private int jjMoveNfa_1(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
|
|
@ -37,12 +37,11 @@ public class OpenRangeQueryNodeProcessor extends QueryNodeProcessorImpl {
|
|||
|
||||
if (node instanceof TermRangeQueryNode) {
|
||||
TermRangeQueryNode rangeNode = (TermRangeQueryNode) node;
|
||||
FieldQueryNode lowerNode = (FieldQueryNode) rangeNode.getLowerBound();
|
||||
FieldQueryNode upperNode = (FieldQueryNode) rangeNode.getUpperBound();
|
||||
FieldQueryNode lowerNode = rangeNode.getLowerBound();
|
||||
FieldQueryNode upperNode = rangeNode.getUpperBound();
|
||||
CharSequence lowerText = lowerNode.getText();
|
||||
CharSequence upperText = upperNode.getText();
|
||||
|
||||
|
||||
if (OPEN_RANGE_TOKEN.equals(upperNode.getTextAsString())
|
||||
&& (!(upperText instanceof UnescapedCharSequence) || !((UnescapedCharSequence) upperText)
|
||||
.wasEscaped(0))) {
|
||||
|
@ -57,7 +56,6 @@ public class OpenRangeQueryNodeProcessor extends QueryNodeProcessorImpl {
|
|||
|
||||
lowerNode.setText(lowerText);
|
||||
upperNode.setText(upperText);
|
||||
|
||||
}
|
||||
|
||||
return node;
|
||||
|
|
|
@ -348,7 +348,7 @@ private int jjMoveNfa_1(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
@ -468,7 +468,7 @@ private int jjMoveNfa_0(int startState, int curPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
int hiByte = (int)(curChar >> 8);
|
||||
int hiByte = (curChar >> 8);
|
||||
int i1 = hiByte >> 6;
|
||||
long l1 = 1L << (hiByte & 077);
|
||||
int i2 = (curChar & 0xff) >> 6;
|
||||
|
|
|
@ -54,7 +54,7 @@ public class FieldsQuery extends SrndQuery { /* mostly untested */
|
|||
Iterator<String> fni = getFieldNames().listIterator();
|
||||
SrndQuery qc;
|
||||
while (fni.hasNext()) {
|
||||
qc = (SrndQuery) q.clone();
|
||||
qc = q.clone();
|
||||
queries.add( new FieldsQuery( qc, fni.next(), fieldOp));
|
||||
}
|
||||
OrQuery oq = new OrQuery(queries,
|
||||
|
|
|
@ -58,7 +58,7 @@ public class CommonGramsFilterFactory extends BaseTokenFilterFactory implements
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
commonWords = (CharArraySet) StopAnalyzer.ENGLISH_STOP_WORDS_SET;
|
||||
commonWords = StopAnalyzer.ENGLISH_STOP_WORDS_SET;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public class CommonGramsQueryFilterFactory extends BaseTokenFilterFactory
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
commonWords = (CharArraySet) StopAnalyzer.ENGLISH_STOP_WORDS_SET;
|
||||
commonWords = StopAnalyzer.ENGLISH_STOP_WORDS_SET;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public final class MaxFieldValueUpdateProcessorFactory extends FieldValueSubsetU
|
|||
Collection result = values;
|
||||
try {
|
||||
result = Collections.singletonList
|
||||
(Collections.max((Collection)values));
|
||||
(Collections.max(values));
|
||||
} catch (ClassCastException e) {
|
||||
throw new SolrException
|
||||
(BAD_REQUEST,
|
||||
|
|
|
@ -60,7 +60,7 @@ public final class MinFieldValueUpdateProcessorFactory extends FieldValueSubsetU
|
|||
Collection result = values;
|
||||
try {
|
||||
result = Collections.singletonList
|
||||
(Collections.min((Collection)values));
|
||||
(Collections.min(values));
|
||||
} catch (ClassCastException e) {
|
||||
throw new SolrException
|
||||
(BAD_REQUEST,
|
||||
|
|
|
@ -321,7 +321,7 @@ public class ConcurrentLRUCache<K,V> {
|
|||
// this loop so far.
|
||||
queue.myMaxSize = sz - lowerWaterMark - numRemoved;
|
||||
while (queue.size() > queue.myMaxSize && queue.size() > 0) {
|
||||
CacheEntry otherEntry = (CacheEntry) queue.pop();
|
||||
CacheEntry otherEntry = queue.pop();
|
||||
newOldestEntry = Math.min(otherEntry.lastAccessedCopy, newOldestEntry);
|
||||
}
|
||||
if (queue.myMaxSize <= 0) break;
|
||||
|
|
|
@ -207,10 +207,10 @@ public class DateFieldTest extends LuceneTestCase {
|
|||
public void testCreateField() {
|
||||
int props = FieldProperties.INDEXED ^ FieldProperties.STORED;
|
||||
SchemaField sf = new SchemaField( "test", f, props, null );
|
||||
IndexableField out = (Field)f.createField(sf, "1995-12-31T23:59:59Z", 1.0f );
|
||||
IndexableField out = f.createField(sf, "1995-12-31T23:59:59Z", 1.0f );
|
||||
assertEquals(820454399000l, f.toObject( out ).getTime() );
|
||||
|
||||
out = (Field)f.createField(sf, new Date(820454399000l), 1.0f );
|
||||
out = f.createField(sf, new Date(820454399000l), 1.0f );
|
||||
assertEquals(820454399000l, f.toObject( out ).getTime() );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue