Clover Coverage Report
Coverage timestamp: Fri May 9 2008 10:54:27 EST
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
15   64   9   5
8   30   0.6   3
3     3  
1    
 
  SegmentTermPositionVector       Line # 19 15 9 92.3% 0.9230769
 
  (10)
 
1    package org.apache.lucene.index;
2   
3    /**
4    * Copyright 2004 The Apache Software Foundation
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10    * http://www.apache.org/licenses/LICENSE-2.0
11    *
12    * Unless required by applicable law or agreed to in writing, software
13    * distributed under the License is distributed on an "AS IS" BASIS,
14    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    * See the License for the specific language governing permissions and
16    * limitations under the License.
17    */
18   
 
19    public class SegmentTermPositionVector extends SegmentTermVector implements TermPositionVector {
20    protected int[][] positions;
21    protected TermVectorOffsetInfo[][] offsets;
22    public static final int[] EMPTY_TERM_POS = new int[0];
23   
 
24  10304 toggle public SegmentTermPositionVector(String field, String terms[], int termFreqs[], int[][] positions, TermVectorOffsetInfo[][] offsets) {
25  10304 super(field, terms, termFreqs);
26  10304 this.offsets = offsets;
27  10304 this.positions = positions;
28    }
29   
30    /**
31    * Returns an array of TermVectorOffsetInfo in which the term is found.
32    *
33    * @param index The position in the array to get the offsets from
34    * @return An array of TermVectorOffsetInfo objects or the empty list
35    * @see org.apache.lucene.analysis.Token
36    */
 
37  44253 toggle public TermVectorOffsetInfo[] getOffsets(int index) {
38  44253 TermVectorOffsetInfo[] result = TermVectorOffsetInfo.EMPTY_OFFSET_INFO;
39  44253 if(offsets == null)
40  21850 return null;
41  22403 if (index >=0 && index < offsets.length)
42    {
43  22403 result = offsets[index];
44    }
45  22403 return result;
46    }
47   
48    /**
49    * Returns an array of positions in which the term is found.
50    * Terms are identified by the index at which its number appears in the
51    * term String array obtained from the <code>indexOf</code> method.
52    */
 
53  44253 toggle public int[] getTermPositions(int index) {
54  44253 int[] result = EMPTY_TERM_POS;
55  44253 if(positions == null)
56  11395 return null;
57  32858 if (index >=0 && index < positions.length)
58    {
59  32858 result = positions[index];
60    }
61   
62  32858 return result;
63    }
64    }