MtasParser.java.html 4.05 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>MtasParser.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.analysis.parser</a> &gt; <span class="el_source">MtasParser.java</span></div><h1>MtasParser.java</h1><pre class="source lang-java linenums">package mtas.analysis.parser;

import java.io.Reader;
import mtas.analysis.token.MtasTokenCollection;
import mtas.analysis.util.MtasConfigException;
import mtas.analysis.util.MtasConfiguration;
import mtas.analysis.util.MtasParserException;

/**
 * The Class MtasParser.
 */
abstract public class MtasParser {

  /** The token collection. */
  protected MtasTokenCollection tokenCollection;

  /** The config. */
  protected MtasConfiguration config;

  /** The autorepair. */
<span class="pc" id="L21">  protected Boolean autorepair = false;</span>

  /** The makeunique. */
<span class="pc" id="L24">  protected Boolean makeunique = false;</span>

  /** The Constant TOKEN_OFFSET. */
  protected static final String TOKEN_OFFSET = &quot;offset&quot;;

  /** The Constant TOKEN_REALOFFSET. */
  protected static final String TOKEN_REALOFFSET = &quot;realoffset&quot;;

  /** The Constant TOKEN_PARENT. */
  protected static final String TOKEN_PARENT = &quot;parent&quot;;

  /**
   * Instantiates a new mtas parser.
   */
<span class="nc" id="L38">  public MtasParser() {</span>
<span class="nc" id="L39">  }</span>

  /**
   * Instantiates a new mtas parser.
   *
   * @param config the config
   */
<span class="fc" id="L46">  public MtasParser(MtasConfiguration config) {</span>
<span class="fc" id="L47">    this.config = config;</span>
<span class="fc" id="L48">  }</span>

  /**
   * Inits the parser.
   *
   * @throws MtasConfigException the mtas config exception
   */
  protected void initParser() throws MtasConfigException {
<span class="pc bpc" id="L56" title="1 of 2 branches missed.">    if (config != null) {</span>
      // find namespaceURI
<span class="fc bfc" id="L58" title="All 2 branches covered.">      for (int i = 0; i &lt; config.children.size(); i++) {</span>
<span class="fc" id="L59">        MtasConfiguration current = config.children.get(i);</span>
<span class="fc bfc" id="L60" title="All 2 branches covered.">        if (current.name.equals(&quot;autorepair&quot;)) {</span>
<span class="fc" id="L61">          autorepair = current.attributes.get(&quot;value&quot;).equals(&quot;true&quot;);</span>
        }
<span class="fc bfc" id="L63" title="All 2 branches covered.">        if (current.name.equals(&quot;makeunique&quot;)) {</span>
<span class="fc" id="L64">          makeunique = current.attributes.get(&quot;value&quot;).equals(&quot;true&quot;);</span>
        }
      }
    }
<span class="fc" id="L68">  }</span>

  /**
   * Creates the token collection.
   *
   * @param reader the reader
   * @return the mtas token collection
   * @throws MtasParserException the mtas parser exception
   * @throws MtasConfigException the mtas config exception
   */
  public abstract MtasTokenCollection createTokenCollection(Reader reader)
      throws MtasParserException, MtasConfigException;

  /**
   * Prints the config.
   *
   * @return the string
   */
  public abstract String printConfig();

}
</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>