Clover coverage report -
Coverage timestamp: Sun Nov 1 2009 23:08:24 UTC
file stats: LOC: 86   Methods: 6
NCLOC: 43   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
NodeTermEnum.java 66.7% 68.8% 83.3% 71.4%
coverage coverage
 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: NodeTermEnum.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.TermEnum;
 23    import org.apache.lucene.index.Term;
 24   
 25    import java.util.Iterator;
 26    import java.util.SortedMap;
 27    import java.util.HashSet;
 28    import java.util.List;
 29   
 30    /**
 31    * Ordered set of terms used by NodeReader.
 32    *
 33    * @version $Revision: 584476 $, $Date: 2007-10-14 02:41:50 +0000 (Sun, 14 Oct 2007) $
 34    */
 35    public class NodeTermEnum extends TermEnum {
 36    // map that backs this enumeration
 37    private SortedMap termMap;
 38   
 39    private Iterator iterator;
 40   
 41    // value of the current term
 42    private String curTerm;
 43   
 44  11 public NodeTermEnum(SortedMap termMap) {
 45  11 this.termMap = termMap;
 46  11 iterator = this.termMap.keySet().iterator();
 47  11 if (iterator.hasNext()) {
 48  11 curTerm = (String) iterator.next();
 49    }
 50    }
 51   
 52  11 public NodeTermEnum(SortedMap termMap, Term t) {
 53  11 this(termMap.tailMap(t.text()));
 54    }
 55   
 56  84 public boolean next() {
 57  84 if (iterator.hasNext()) {
 58  83 curTerm = (String) iterator.next();
 59  83 return true;
 60    }
 61   
 62  1 return false;
 63    }
 64   
 65  94 public Term term() {
 66  94 if (curTerm != null) {
 67  94 return new Term("", curTerm);
 68    }
 69   
 70  0 return null;
 71    }
 72   
 73  0 public int docFreq() {
 74  0 List docs = (List) termMap.get(curTerm);
 75   
 76  0 HashSet set = new HashSet();
 77  0 set.addAll(docs);
 78  0 return set.size();
 79    }
 80   
 81    /**
 82    * Not applicable
 83    */
 84  11 public void close() {
 85    }
 86    }