MtasFunctionParserItem.java.html 7.23 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>MtasFunctionParserItem.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.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 final static String TYPE_CONSTANT_LONG = &quot;constantLong&quot;;

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

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

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

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

  /** The Constant TYPE_N. */
  public final static 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="L54">  public MtasFunctionParserItem(String t) throws ParseException {</span>
<span class="pc bpc" id="L55" title="1 of 2 branches missed.">    if (t.equals(TYPE_N)) {</span>
<span class="fc" id="L56">      type = t;</span>
<span class="fc" id="L57">      degree = 0;</span>
    } else {
<span class="nc" id="L59">      throw new ParseException(&quot;unknown type &quot; + t);</span>
    }
<span class="fc" id="L61">  }</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="L73">  public MtasFunctionParserItem(String t, int i) throws ParseException {</span>
<span class="pc bpc" id="L74" title="1 of 2 branches missed.">    if (t.equals(TYPE_ARGUMENT)) {</span>
<span class="fc" id="L75">      type = t;</span>
<span class="fc" id="L76">      id = i;</span>
<span class="fc" id="L77">      degree = 1;</span>
    } else {
<span class="nc" id="L79">      throw new ParseException(&quot;unknown type &quot; + t);</span>
    }
<span class="fc" id="L81">  }</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="L93">  public MtasFunctionParserItem(String t, long l) throws ParseException {</span>
<span class="pc bpc" id="L94" title="1 of 2 branches missed.">    if (t.equals(TYPE_CONSTANT_LONG)) {</span>
<span class="fc" id="L95">      type = t;</span>
<span class="fc" id="L96">      valueLong = l;</span>
<span class="fc" id="L97">      degree = 0;</span>
    } else {
<span class="nc" id="L99">      throw new ParseException(&quot;unknown type &quot; + t);</span>
    }
<span class="fc" id="L101">  }</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="L113">  public MtasFunctionParserItem(String t, double d) throws ParseException {</span>
<span class="pc bpc" id="L114" title="1 of 2 branches missed.">    if (t.equals(TYPE_CONSTANT_DOUBLE)) {</span>
<span class="fc" id="L115">      type = t;</span>
<span class="fc" id="L116">      valueDouble = d;</span>
<span class="fc" id="L117">      degree = 0;</span>
    } else {
<span class="nc" id="L119">      throw new ParseException(&quot;unknown type &quot; + t);</span>
    }
<span class="fc" id="L121">  }</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="L134">      throws ParseException {</span>
<span class="fc bfc" id="L135" title="All 2 branches covered.">    if (t.equals(TYPE_PARSER_LONG)) {</span>
<span class="fc" id="L136">      type = t;</span>
<span class="fc" id="L137">      parser = p;</span>
<span class="fc" id="L138">      degree = parser.degree;</span>
<span class="pc bpc" id="L139" title="1 of 2 branches missed.">    } else if (t.equals(TYPE_PARSER_DOUBLE)) {</span>
<span class="fc" id="L140">      type = t;</span>
<span class="fc" id="L141">      parser = p;</span>
<span class="fc" id="L142">      degree = parser.degree;</span>
    } else {
<span class="nc" id="L144">      throw new ParseException(&quot;unknown type &quot; + t);</span>
    }
<span class="fc" id="L146">  }</span>

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

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

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

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

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

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