add --shared
[pylucene.git] / lucene-java-3.4.0 / lucene / src / java / org / apache / lucene / search / SimilarityDelegator.java
1 package org.apache.lucene.search;
2
3 import org.apache.lucene.index.FieldInvertState;
4
5 /**
6  * Licensed to the Apache Software Foundation (ASF) under one or more
7  * contributor license agreements.  See the NOTICE file distributed with
8  * this work for additional information regarding copyright ownership.
9  * The ASF licenses this file to You under the Apache License, Version 2.0
10  * (the "License"); you may not use this file except in compliance with
11  * the License.  You may obtain a copy of the License at
12  *
13  *     http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21
22 /** Expert: Delegating scoring implementation.  Useful in {@link
23  * Query#getSimilarity(Searcher)} implementations, to override only certain
24  * methods of a Searcher's Similarity implementation..
25  * @deprecated this class will be removed in 4.0.  Please
26  * subclass {@link Similarity} or {@link DefaultSimilarity} instead. */
27 @Deprecated
28 public class SimilarityDelegator extends Similarity {
29
30   private Similarity delegee;
31
32   /** Construct a {@link Similarity} that delegates all methods to another.
33    *
34    * @param delegee the Similarity implementation to delegate to
35    */
36   public SimilarityDelegator(Similarity delegee) {
37     this.delegee = delegee;
38   }
39
40   @Override
41   public float computeNorm(String fieldName, FieldInvertState state) {
42     return delegee.computeNorm(fieldName, state);
43   }
44
45   @Override
46   public float queryNorm(float sumOfSquaredWeights) {
47     return delegee.queryNorm(sumOfSquaredWeights);
48   }
49
50   @Override
51   public float tf(float freq) {
52     return delegee.tf(freq);
53   }
54     
55   @Override
56   public float sloppyFreq(int distance) {
57     return delegee.sloppyFreq(distance);
58   }
59     
60   @Override
61   public float idf(int docFreq, int numDocs) {
62     return delegee.idf(docFreq, numDocs);
63   }
64     
65   @Override
66   public float coord(int overlap, int maxOverlap) {
67     return delegee.coord(overlap, maxOverlap);
68   }
69
70   @Override
71   public float scorePayload(int docId, String fieldName, int start, int end, byte [] payload, int offset, int length) {
72     return delegee.scorePayload(docId, fieldName, start, end, payload, offset, length);
73   }
74 }