MtasTerms.java.html 6.96 KB
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>MtasTerms.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">MTAS</a> &gt; <a href="index.source.html" class="el_package">mtas.codec</a> &gt; <span class="el_source">MtasTerms.java</span></div><h1>MtasTerms.java</h1><pre class="source lang-java linenums">package mtas.codec;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map.Entry;

import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.store.IndexInput;

/**
 * The Class MtasTerms.
 */
public class MtasTerms extends Terms {

  /** The index input list. */
  HashMap&lt;String, IndexInput&gt; indexInputList;

  /** The index input offset list. */
  HashMap&lt;String, Long&gt; indexInputOffsetList;

  /** The version. */
  int version;

  /** The delegate terms. */
  Terms delegateTerms;

  /**
   * Instantiates a new mtas terms.
   *
   * @param terms the terms
   * @param indexInputList the index input list
   * @param indexInputOffsetList the index input offset list
   * @param version the version
   */
  public MtasTerms(Terms terms, HashMap&lt;String, IndexInput&gt; indexInputList,
<span class="fc" id="L37">      HashMap&lt;String, Long&gt; indexInputOffsetList, int version) {</span>
<span class="fc" id="L38">    delegateTerms = terms;</span>
<span class="fc" id="L39">    this.indexInputList = indexInputList;</span>
<span class="fc" id="L40">    this.indexInputOffsetList = indexInputOffsetList;</span>
<span class="fc" id="L41">    this.version = version;</span>
<span class="fc" id="L42">  }</span>

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.lucene.index.Terms#iterator()
   */
  @Override
  public TermsEnum iterator() throws IOException {
<span class="pc bpc" id="L51" title="1 of 2 branches missed.">    if (delegateTerms != null) {</span>
<span class="fc" id="L52">      return delegateTerms.iterator();</span>
    } else {
<span class="nc" id="L54">      return TermsEnum.EMPTY;</span>
    }
  }

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.lucene.index.Terms#size()
   */
  @Override
  public long size() throws IOException {
<span class="pc bpc" id="L65" title="1 of 2 branches missed.">    if (delegateTerms != null) {</span>
<span class="fc" id="L66">      return delegateTerms.size();</span>
    } else {
<span class="nc" id="L68">      return -1;</span>
    }
  }

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.lucene.index.Terms#getSumTotalTermFreq()
   */
  @Override
  public long getSumTotalTermFreq() throws IOException {
<span class="pc bpc" id="L79" title="1 of 2 branches missed.">    if (delegateTerms != null) {</span>
<span class="fc" id="L80">      return delegateTerms.getSumTotalTermFreq();</span>
    } else {
<span class="nc" id="L82">      return -1;</span>
    }
  }

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.lucene.index.Terms#getSumDocFreq()
   */
  @Override
  public long getSumDocFreq() throws IOException {
<span class="pc bpc" id="L93" title="1 of 2 branches missed.">    if (delegateTerms != null) {</span>
<span class="fc" id="L94">      return delegateTerms.getSumDocFreq();</span>
    } else {
<span class="nc" id="L96">      return -1;</span>
    }
  }

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.lucene.index.Terms#getDocCount()
   */
  @Override
  public int getDocCount() throws IOException {
<span class="pc bpc" id="L107" title="1 of 2 branches missed.">    if (delegateTerms != null) {</span>
<span class="fc" id="L108">      return delegateTerms.getDocCount();</span>
    } else {
<span class="nc" id="L110">      return -1;</span>
    }
  }

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.lucene.index.Terms#hasFreqs()
   */
  @Override
  public boolean hasFreqs() {
<span class="pc bpc" id="L121" title="1 of 2 branches missed.">    if (delegateTerms != null) {</span>
<span class="fc" id="L122">      return delegateTerms.hasFreqs();</span>
    } else {
<span class="nc" id="L124">      return false;</span>
    }
  }

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.lucene.index.Terms#hasOffsets()
   */
  @Override
  public boolean hasOffsets() {
<span class="pc bpc" id="L135" title="1 of 2 branches missed.">    if (delegateTerms != null) {</span>
<span class="fc" id="L136">      return delegateTerms.hasOffsets();</span>
    } else {
<span class="nc" id="L138">      return false;</span>
    }
  }

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.lucene.index.Terms#hasPositions()
   */
  @Override
  public boolean hasPositions() {
<span class="pc bpc" id="L149" title="1 of 2 branches missed.">    if (delegateTerms != null) {</span>
<span class="fc" id="L150">      return delegateTerms.hasPositions();</span>
    } else {
<span class="nc" id="L152">      return false;</span>
    }
  }

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.lucene.index.Terms#hasPayloads()
   */
  @Override
  public boolean hasPayloads() {
<span class="pc bpc" id="L163" title="1 of 2 branches missed.">    if (delegateTerms != null) {</span>
<span class="fc" id="L164">      return delegateTerms.hasPayloads();</span>
    } else {
<span class="nc" id="L166">      return false;</span>
    }
  }

  /**
   * Gets the version.
   *
   * @return the version
   */
  public int getVersion() {
<span class="fc" id="L176">    return version;</span>
  }

  /**
   * Gets the index input list.
   *
   * @return the index input list
   */
  public HashMap&lt;String, IndexInput&gt; getIndexInputList() {
<span class="fc" id="L185">    HashMap&lt;String, IndexInput&gt; clonedIndexInputList = new HashMap&lt;String, IndexInput&gt;();</span>
<span class="fc bfc" id="L186" title="All 2 branches covered.">    for (Entry&lt;String, IndexInput&gt; entry : indexInputList.entrySet()) {</span>
<span class="fc" id="L187">      clonedIndexInputList.put(entry.getKey(), entry.getValue().clone());</span>
<span class="fc" id="L188">    }</span>
<span class="fc" id="L189">    return clonedIndexInputList;</span>
  }

  /**
   * Gets the index input offset list.
   *
   * @return the index input offset list
   */
  public HashMap&lt;String, Long&gt; getIndexInputOffsetList() {
<span class="fc" id="L198">    return indexInputOffsetList;</span>
  }

}
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.7.9.201702052155</span></div></body></html>