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

import mtas.parser.function.ParseException;

/**
 * The Class MtasFunctionParserItem.
 */
public class MtasFunctionParserItem {

  /** The type. */
<span class="fc" id="L11">  private String type = null;</span>

  /** The id. */
<span class="fc" id="L14">  private Integer id = null;</span>

  /** The value long. */
<span class="fc" id="L17">  private Long valueLong = null;</span>

  /** The value double. */
<span class="fc" id="L20">  private Double valueDouble = null;</span>

  /** The degree. */
<span class="fc" id="L23">  private Integer degree = null;</span>

  /** The parser. */
<span class="fc" id="L26">  private MtasFunctionParserFunction parser = null;</span>

  /** The Constant TYPE_CONSTANT_LONG. */
  public static final String TYPE_CONSTANT_LONG = &quot;constantLong&quot;;

  /** The Constant TYPE_CONSTANT_DOUBLE. */
  public static final String TYPE_CONSTANT_DOUBLE = &quot;constantDouble&quot;;

  /** The Constant TYPE_PARSER_LONG. */
  public static final String TYPE_PARSER_LONG = &quot;parserLong&quot;;

  /** The Constant TYPE_PARSER_DOUBLE. */
  public static final String TYPE_PARSER_DOUBLE = &quot;parserDouble&quot;;

  /** The Constant TYPE_ARGUMENT. */
  public static final String TYPE_ARGUMENT = &quot;argument&quot;;

  /** The Constant TYPE_N. */
  public static final String TYPE_N = &quot;n&quot;;

  /**
   * Instantiates a new mtas function parser item.
   *
   * @param t the t
   * @throws ParseException the parse exception
   */
<span class="fc" id="L52">  public MtasFunctionParserItem(String t) throws ParseException {</span>
<span class="pc bpc" id="L53" title="1 of 2 branches missed.">    if (t.equals(TYPE_N)) {</span>
<span class="fc" id="L54">      type = t;</span>
<span class="fc" id="L55">      degree = 0;</span>
    } else {
<span class="nc" id="L57">      throw new ParseException(&quot;unknown type &quot; + t);</span>
    }
<span class="fc" id="L59">  }</span>

  /**
   * Instantiates a new mtas function parser item.
   *
   * @param t the t
   * @param i the i
   * @throws ParseException the parse exception
   */
<span class="fc" id="L68">  public MtasFunctionParserItem(String t, int i) throws ParseException {</span>
<span class="pc bpc" id="L69" title="1 of 2 branches missed.">    if (t.equals(TYPE_ARGUMENT)) {</span>
<span class="fc" id="L70">      type = t;</span>
<span class="fc" id="L71">      id = i;</span>
<span class="fc" id="L72">      degree = 1;</span>
    } else {
<span class="nc" id="L74">      throw new ParseException(&quot;unknown type &quot; + t);</span>
    }
<span class="fc" id="L76">  }</span>

  /**
   * Instantiates a new mtas function parser item.
   *
   * @param t the t
   * @param l the l
   * @throws ParseException the parse exception
   */
<span class="fc" id="L85">  public MtasFunctionParserItem(String t, long l) throws ParseException {</span>
<span class="pc bpc" id="L86" title="1 of 2 branches missed.">    if (t.equals(TYPE_CONSTANT_LONG)) {</span>
<span class="fc" id="L87">      type = t;</span>
<span class="fc" id="L88">      valueLong = l;</span>
<span class="fc" id="L89">      degree = 0;</span>
    } else {
<span class="nc" id="L91">      throw new ParseException(&quot;unknown type &quot; + t);</span>
    }
<span class="fc" id="L93">  }</span>

  /**
   * Instantiates a new mtas function parser item.
   *
   * @param t the t
   * @param d the d
   * @throws ParseException the parse exception
   */
<span class="fc" id="L102">  public MtasFunctionParserItem(String t, double d) throws ParseException {</span>
<span class="pc bpc" id="L103" title="1 of 2 branches missed.">    if (t.equals(TYPE_CONSTANT_DOUBLE)) {</span>
<span class="fc" id="L104">      type = t;</span>
<span class="fc" id="L105">      valueDouble = d;</span>
<span class="fc" id="L106">      degree = 0;</span>
    } else {
<span class="nc" id="L108">      throw new ParseException(&quot;unknown type &quot; + t);</span>
    }
<span class="fc" id="L110">  }</span>

  /**
   * Instantiates a new mtas function parser item.
   *
   * @param t the t
   * @param p the p
   * @throws ParseException the parse exception
   */
  public MtasFunctionParserItem(String t, MtasFunctionParserFunction p)
<span class="fc" id="L120">      throws ParseException {</span>
<span class="fc bfc" id="L121" title="All 2 branches covered.">    if (t.equals(TYPE_PARSER_LONG)) {</span>
<span class="fc" id="L122">      type = t;</span>
<span class="fc" id="L123">      parser = p;</span>
<span class="fc" id="L124">      degree = parser.degree;</span>
<span class="pc bpc" id="L125" title="1 of 2 branches missed.">    } else if (t.equals(TYPE_PARSER_DOUBLE)) {</span>
<span class="fc" id="L126">      type = t;</span>
<span class="fc" id="L127">      parser = p;</span>
<span class="fc" id="L128">      degree = parser.degree;</span>
    } else {
<span class="nc" id="L130">      throw new ParseException(&quot;unknown type &quot; + t);</span>
    }
<span class="fc" id="L132">  }</span>

  /**
   * Gets the type.
   *
   * @return the type
   */
  public String getType() {
<span class="fc" id="L140">    return type;</span>
  }

  /**
   * Gets the id.
   *
   * @return the id
   */
  public int getId() {
<span class="fc" id="L149">    return id.intValue();</span>
  }

  /**
   * Gets the degree.
   *
   * @return the degree
   */
  public Integer getDegree() {
<span class="fc" id="L158">    return degree;</span>
  }

  /**
   * Gets the value long.
   *
   * @return the value long
   */
  public long getValueLong() {
<span class="fc" id="L167">    return valueLong.longValue();</span>
  }

  /**
   * Gets the value double.
   *
   * @return the value double
   */
  public double getValueDouble() {
<span class="fc" id="L176">    return valueDouble.doubleValue();</span>
  }

  /**
   * Gets the parser.
   *
   * @return the parser
   */
  public MtasFunctionParserFunction getParser() {
<span class="fc" id="L185">    return parser;</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>