MtasTerms.java.html 6.99 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="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>MtasTerms.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.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="L41">      HashMap&lt;String, Long&gt; indexInputOffsetList, int version) {</span>
<span class="fc" id="L42">    delegateTerms = terms;</span>
<span class="fc" id="L43">    this.indexInputList = indexInputList;</span>
<span class="fc" id="L44">    this.indexInputOffsetList = indexInputOffsetList;</span>
<span class="fc" id="L45">    this.version = version;</span>
<span class="fc" id="L46">  }</span>

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

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

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

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

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

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

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

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

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

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

  /**
   * Gets the index input list.
   *
   * @return the index input list
   */
  public HashMap&lt;String, IndexInput&gt; getIndexInputList() {
<span class="fc" id="L189">    HashMap&lt;String, IndexInput&gt; clonedIndexInputList = new HashMap&lt;String, IndexInput&gt;();</span>
<span class="fc bfc" id="L190" title="All 2 branches covered.">    for (Entry&lt;String, IndexInput&gt; entry : indexInputList.entrySet()) {</span>
<span class="fc" id="L191">      clonedIndexInputList.put(entry.getKey(), entry.getValue().clone());</span>
<span class="fc" id="L192">    }</span>
<span class="fc" id="L193">    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="L202">    return indexInputOffsetList;</span>
  }

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