pylucene 3.5.0-3
[pylucene.git] / lucene-java-3.5.0 / lucene / backwards / src / test / org / apache / lucene / search / spans / JustCompileSearchSpans.java
1 package org.apache.lucene.search.spans;
2
3 /**
4  * Licensed to the Apache Software Foundation (ASF) under one or more
5  * contributor license agreements.  See the NOTICE file distributed with
6  * this work for additional information regarding copyright ownership.
7  * The ASF licenses this file to You under the Apache License, Version 2.0
8  * (the "License"); you may not use this file except in compliance with
9  * the License.  You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 import java.io.IOException;
21 import java.util.Collection;
22
23 import org.apache.lucene.index.IndexReader;
24 import org.apache.lucene.search.Weight;
25 import org.apache.lucene.search.Similarity;
26
27 /**
28  * Holds all implementations of classes in the o.a.l.s.spans package as a
29  * back-compatibility test. It does not run any tests per-se, however if
30  * someone adds a method to an interface or abstract method to an abstract
31  * class, one of the implementations here will fail to compile and so we know
32  * back-compat policy was violated.
33  */
34 final class JustCompileSearchSpans {
35
36   private static final String UNSUPPORTED_MSG = "unsupported: used for back-compat testing only !";
37
38   static final class JustCompileSpans extends Spans {
39
40     @Override
41     public int doc() {
42       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
43     }
44
45     @Override
46     public int end() {
47       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
48     }
49
50     @Override
51     public boolean next() throws IOException {
52       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
53     }
54
55     @Override
56     public boolean skipTo(int target) throws IOException {
57       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
58     }
59
60     @Override
61     public int start() {
62       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
63     }
64
65     @Override
66     public Collection<byte[]> getPayload() throws IOException {
67       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
68     }
69
70     @Override
71     public boolean isPayloadAvailable() {
72       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
73     }
74     
75   }
76
77   static final class JustCompileSpanQuery extends SpanQuery {
78
79     @Override
80     public String getField() {
81       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
82     }
83
84     @Override
85     public Spans getSpans(IndexReader reader) throws IOException {
86       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
87     }
88
89     @Override
90     public String toString(String field) {
91       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
92     }
93     
94   }
95
96   static final class JustCompilePayloadSpans extends Spans {
97
98     @Override
99     public Collection<byte[]> getPayload() throws IOException {
100       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
101     }
102
103     @Override
104     public boolean isPayloadAvailable() {
105       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
106     }
107
108     @Override
109     public int doc() {
110       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
111     }
112
113     @Override
114     public int end() {
115       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
116     }
117
118     @Override
119     public boolean next() throws IOException {
120       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
121     }
122
123     @Override
124     public boolean skipTo(int target) throws IOException {
125       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
126     }
127
128     @Override
129     public int start() {
130       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
131     }
132     
133   }
134   
135   static final class JustCompileSpanScorer extends SpanScorer {
136
137     protected JustCompileSpanScorer(Spans spans, Weight weight,
138         Similarity similarity, byte[] norms) throws IOException {
139       super(spans, weight, similarity, norms);
140     }
141
142     @Override
143     protected boolean setFreqCurrentDoc() throws IOException {
144       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
145     }
146   }
147 }