|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
NodeTermPositions.java | 83.3% | 73.3% | 57.1% | 71.4% |
|
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
3 | * contributor license agreements. See the NOTICE file distributed with | |
4 | * this work for additional information regarding copyright ownership. | |
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
6 | * (the "License"); you may not use this file except in compliance with | |
7 | * the License. You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | * | |
17 | * $Id: NodeTermPositions.java 584476 2007-10-14 02:41:50Z natalia $ | |
18 | */ | |
19 | ||
20 | package org.apache.xindice.core.query.ftsearch; | |
21 | ||
22 | import org.apache.lucene.index.TermPositions; | |
23 | import org.apache.lucene.index.Term; | |
24 | ||
25 | import java.io.IOException; | |
26 | ||
27 | /** | |
28 | * TermPositions for searching over DOM nodes in memory | |
29 | * | |
30 | * @version $Revision: 584476 $, $Date: 2007-10-14 02:41:50 +0000 (Sun, 14 Oct 2007) $ | |
31 | */ | |
32 | public class NodeTermPositions extends NodeTermDocs implements TermPositions { | |
33 | private int pos; | |
34 | private String term; | |
35 | ||
36 | 4 | public NodeTermPositions(NodeReader reader) { |
37 | 4 | super(reader); |
38 | } | |
39 | ||
40 | 4 | public void seek(Term term) { |
41 | 4 | this.term = term.text(); |
42 | 4 | super.seek(term); |
43 | } | |
44 | ||
45 | 13 | public int nextPosition() throws IOException { |
46 | 96 | while (pos < nodes[num].size()) { |
47 | 96 | if ((nodes[num].get(pos)).equals(term)) { |
48 | 13 | return pos; |
49 | } | |
50 | 83 | pos++; |
51 | } | |
52 | ||
53 | 0 | return 0; |
54 | } | |
55 | ||
56 | 8 | public boolean next() { |
57 | 8 | if (super.next()) { |
58 | 6 | pos = 0; |
59 | 6 | return true; |
60 | } | |
61 | ||
62 | 2 | return false; |
63 | } | |
64 | ||
65 | 0 | public int getPayloadLength() { |
66 | 0 | throw new UnsupportedOperationException(); |
67 | } | |
68 | ||
69 | 0 | public byte[] getPayload(byte[] data, int offset) throws IOException { |
70 | 0 | throw new UnsupportedOperationException(); |
71 | } | |
72 | ||
73 | 0 | public boolean isPayloadAvailable() { |
74 | 0 | return false; |
75 | } | |
76 | } |
|