MtasCQLParserWordCondition.java.html 23.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482
<?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>MtasCQLParserWordCondition.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.cql.util</a> &gt; <span class="el_source">MtasCQLParserWordCondition.java</span></div><h1>MtasCQLParserWordCondition.java</h1><pre class="source lang-java linenums">package mtas.parser.cql.util;

import java.util.ArrayList;
import java.util.List;

import mtas.search.spans.MtasSpanAndQuery;
import mtas.search.spans.MtasSpanNotQuery;
import mtas.search.spans.MtasSpanOrQuery;
import mtas.search.spans.util.MtasSpanQuery;


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

  /** The Constant TYPE_AND. */
  public static final String TYPE_AND = &quot;and&quot;;

  /** The Constant TYPE_OR. */
  public static final String TYPE_OR = &quot;or&quot;;

  /** The positive query list. */
  private List&lt;MtasSpanQuery&gt; positiveQueryList;
  
  /** The negative query list. */
  private List&lt;MtasSpanQuery&gt; negativeQueryList;

  /** The condition list. */
  private List&lt;MtasCQLParserWordCondition&gt; conditionList;

  /** The simplified. */
  private boolean simplified;

  /** The not. */
  private boolean not;

  /** The type. */
  private String type;

  /** The field. */
  private String field;

  /**
   * Instantiates a new mtas CQL parser word condition.
   *
   * @param field the field
   * @param type the type
   */
<span class="fc" id="L50">  public MtasCQLParserWordCondition(String field, String type) {</span>
<span class="fc" id="L51">    this.field = field;</span>
<span class="fc" id="L52">    this.type = type;</span>
<span class="fc" id="L53">    not = false;</span>
<span class="fc" id="L54">    simplified = true;</span>
<span class="fc" id="L55">    positiveQueryList = new ArrayList&lt;MtasSpanQuery&gt;();</span>
<span class="fc" id="L56">    negativeQueryList = new ArrayList&lt;MtasSpanQuery&gt;();</span>
<span class="fc" id="L57">    conditionList = new ArrayList&lt;MtasCQLParserWordCondition&gt;();</span>
<span class="fc" id="L58">  }</span>

  /**
   * Type.
   *
   * @return the string
   */
  public String type() {
<span class="fc" id="L66">    return type;</span>
  }

  /**
   * Field.
   *
   * @return the string
   */
  public String field() {
<span class="fc" id="L75">    return field;</span>
  }

  /**
   * Swap not.
   */
  public void swapNot() {
<span class="pc bpc" id="L82" title="1 of 2 branches missed.">    not = not ? false : true;</span>
<span class="fc" id="L83">    simplified = false;</span>
<span class="fc" id="L84">  }</span>

  /**
   * Not.
   *
   * @return true, if successful
   */
  public boolean not() {
<span class="fc" id="L92">    return not;</span>
  }

  /**
   * Adds the positive query.
   *
   * @param q the q
   */
  public void addPositiveQuery(MtasSpanQuery q) {
<span class="fc" id="L101">    positiveQueryList.add(q);</span>
<span class="fc" id="L102">  }</span>

  /**
   * Adds the negative query.
   *
   * @param q the q
   */
  public void addNegativeQuery(MtasSpanQuery q) {
<span class="nc" id="L110">    negativeQueryList.add(q);</span>
<span class="nc" id="L111">  }</span>

  /**
   * Gets the positive query.
   *
   * @return the positive query
   */
  public List&lt;MtasSpanQuery&gt; getPositiveQuery() {
<span class="fc" id="L119">    return positiveQueryList;</span>
  }

  /**
   * Gets the positive query.
   *
   * @param index the index
   * @return the positive query
   */
  public MtasSpanQuery getPositiveQuery(int index) {
<span class="pc bpc" id="L129" title="2 of 4 branches missed.">    if ((index &gt;= 0) &amp;&amp; (index &lt; positiveQueryList.size())) {</span>
<span class="fc" id="L130">      return positiveQueryList.get(index);</span>
    } else {
<span class="nc" id="L132">      return null;</span>
    }
  }

  /**
   * Gets the negative query.
   *
   * @return the negative query
   */
  public List&lt;MtasSpanQuery&gt; getNegativeQuery() {
<span class="fc" id="L142">    return negativeQueryList;</span>
  }

  /**
   * Gets the negative query.
   *
   * @param index the index
   * @return the negative query
   */
  public MtasSpanQuery getNegativeQuery(int index) {
<span class="pc bpc" id="L152" title="2 of 4 branches missed.">    if ((index &gt;= 0) &amp;&amp; (index &lt; negativeQueryList.size())) {</span>
<span class="fc" id="L153">      return negativeQueryList.get(index);</span>
    } else {
<span class="nc" id="L155">      return null;</span>
    }
  }

  /**
   * Adds the condition.
   *
   * @param c the c
   */
  public void addCondition(MtasCQLParserWordCondition c) {
<span class="fc" id="L165">    conditionList.add(c);</span>
<span class="fc" id="L166">    simplified = false;</span>
<span class="fc" id="L167">  }</span>

  /**
   * Checks if is single.
   *
   * @return true, if is single
   */
  public boolean isSingle() {
    // assume simplified
<span class="pc bpc" id="L176" title="1 of 4 branches missed.">    if ((positiveQueryList.size() == 1) &amp;&amp; (negativeQueryList.size() == 0)) {</span>
<span class="fc" id="L177">      return true;</span>
<span class="fc bfc" id="L178" title="All 2 branches covered.">    } else if ((positiveQueryList.size() == 0)</span>
<span class="pc bpc" id="L179" title="1 of 2 branches missed.">        &amp;&amp; (negativeQueryList.size() == 1)) {</span>
<span class="nc" id="L180">      return true;</span>
    }
<span class="fc" id="L182">    return false;</span>
  }

  /**
   * Checks if is simple positive.
   *
   * @return true, if is simple positive
   */
  public boolean isSimplePositive() {
    // assume simplified
<span class="fc bfc" id="L192" title="All 4 branches covered.">    if ((positiveQueryList.size() &gt; 0) &amp;&amp; (negativeQueryList.size() == 0)) {</span>
<span class="fc" id="L193">      return true;</span>
    }
<span class="fc" id="L195">    return false;</span>
  }

  /**
   * Checks if is simple negative.
   *
   * @return true, if is simple negative
   */
  public boolean isSimpleNegative() {
    // assume simplified
<span class="fc bfc" id="L205" title="All 4 branches covered.">    if ((negativeQueryList.size() &gt; 0) &amp;&amp; (positiveQueryList.size() == 0)) {</span>
<span class="fc" id="L206">      return true;</span>
    }
<span class="fc" id="L208">    return false;</span>
  }

  /**
   * Checks if is empty.
   *
   * @return true, if is empty
   */
  public boolean isEmpty() {
<span class="pc bpc" id="L217" title="1 of 4 branches missed.">    if ((positiveQueryList.size() == 0) &amp;&amp; (negativeQueryList.size() == 0)</span>
<span class="pc bpc" id="L218" title="1 of 2 branches missed.">        &amp;&amp; (conditionList.size() == 0)) {</span>
<span class="fc" id="L219">      return true;</span>
    }
<span class="fc" id="L221">    return false;</span>
  }

  /**
   * Swap type.
   */
  public void swapType() {
<span class="pc bpc" id="L228" title="1 of 2 branches missed.">    if (type.equals(TYPE_AND)) {</span>
<span class="fc" id="L229">      type = TYPE_OR;</span>
<span class="nc bnc" id="L230" title="All 2 branches missed.">    } else if (type.equals(TYPE_OR)) {</span>
<span class="nc" id="L231">      type = TYPE_AND;</span>
    } else {
<span class="nc" id="L233">      throw new Error(&quot;unknown type&quot;);</span>
    }
<span class="fc" id="L235">    swapNot();</span>
<span class="fc" id="L236">    List&lt;MtasSpanQuery&gt; queryList = positiveQueryList;</span>
<span class="fc" id="L237">    positiveQueryList = negativeQueryList;</span>
<span class="fc" id="L238">    negativeQueryList = queryList;</span>
<span class="pc bpc" id="L239" title="1 of 2 branches missed.">    for (MtasCQLParserWordCondition c : conditionList) {</span>
<span class="nc" id="L240">      c.swapNot();</span>
<span class="nc" id="L241">    }</span>
<span class="fc" id="L242">    simplified = false;</span>
<span class="fc" id="L243">  }</span>

  /**
   * Simplified.
   *
   * @return the boolean
   */
  public Boolean simplified() {
<span class="nc" id="L251">    return simplified;</span>
  }

  /**
   * Simplify.
   */
  public void simplify() {
<span class="fc bfc" id="L258" title="All 2 branches covered.">    if (!simplified) {</span>
<span class="fc bfc" id="L259" title="All 2 branches covered.">      if (conditionList.size() &gt; 0) {</span>
<span class="fc bfc" id="L260" title="All 2 branches covered.">        for (MtasCQLParserWordCondition c : conditionList) {</span>
<span class="fc" id="L261">          c.simplify();</span>
          // A &amp; B &amp; ( C &amp; !D )
<span class="fc bfc" id="L263" title="All 4 branches covered.">          if (c.type().equals(type) &amp;&amp; !c.not()) {</span>
<span class="fc" id="L264">            positiveQueryList.addAll(c.positiveQueryList);</span>
<span class="fc" id="L265">            negativeQueryList.addAll(c.negativeQueryList);</span>
            // A &amp; B &amp; !( C | !D )
<span class="fc bfc" id="L267" title="All 4 branches covered.">          } else if (!c.type().equals(type) &amp;&amp; c.not()) {</span>
<span class="fc" id="L268">            positiveQueryList.addAll(c.negativeQueryList);</span>
<span class="fc" id="L269">            negativeQueryList.addAll(c.positiveQueryList);</span>
            // A &amp; B &amp; ( C )
<span class="fc bfc" id="L271" title="All 4 branches covered.">          } else if (c.isSingle() &amp;&amp; !c.not()) {</span>
<span class="fc" id="L272">            positiveQueryList.addAll(c.positiveQueryList);</span>
<span class="fc" id="L273">            negativeQueryList.addAll(c.negativeQueryList);</span>
            // A &amp; B &amp; !( C )
<span class="pc bpc" id="L275" title="1 of 4 branches missed.">          } else if (c.isSingle() &amp;&amp; c.not()) {</span>
<span class="fc" id="L276">            positiveQueryList.addAll(c.negativeQueryList);</span>
<span class="fc" id="L277">            negativeQueryList.addAll(c.positiveQueryList);</span>
<span class="pc bpc" id="L278" title="1 of 2 branches missed.">          } else if (c.isSimplePositive()) {</span>
            // A | B | ( C &amp; D )
<span class="fc bfc" id="L280" title="All 2 branches covered.">            if (c.type().equals(TYPE_AND)) {</span>
<span class="fc" id="L281">              MtasSpanQuery q = new MtasSpanAndQuery(c.positiveQueryList</span>
<span class="fc" id="L282">                  .toArray(new MtasSpanQuery[c.positiveQueryList.size()]));</span>
<span class="pc bpc" id="L283" title="1 of 2 branches missed.">              if (c.not()) {</span>
<span class="nc" id="L284">                negativeQueryList.add(q);</span>
              } else {
<span class="fc" id="L286">                positiveQueryList.add(q);</span>
              }
              // A &amp; B &amp; ( C | D )
<span class="fc" id="L289">            } else {</span>
<span class="fc" id="L290">              MtasSpanQuery q = new MtasSpanOrQuery(c.positiveQueryList</span>
<span class="fc" id="L291">                  .toArray(new MtasSpanQuery[c.positiveQueryList.size()]));</span>
<span class="pc bpc" id="L292" title="1 of 2 branches missed.">              if (c.not()) {</span>
<span class="nc" id="L293">                negativeQueryList.add(q);</span>
              } else {
<span class="fc" id="L295">                positiveQueryList.add(q);</span>
              }
<span class="fc" id="L297">            }</span>
<span class="nc bnc" id="L298" title="All 2 branches missed.">          } else if (c.isSimpleNegative()) {</span>
            // A | B | ( !C | !D )
<span class="nc bnc" id="L300" title="All 2 branches missed.">            if (c.type().equals(TYPE_OR)) {</span>
<span class="nc" id="L301">              MtasSpanQuery q = new MtasSpanAndQuery(c.negativeQueryList</span>
<span class="nc" id="L302">                  .toArray(new MtasSpanQuery[c.negativeQueryList.size()]));</span>
<span class="nc bnc" id="L303" title="All 2 branches missed.">              if (c.not()) {</span>
<span class="nc" id="L304">                positiveQueryList.add(q);</span>
              } else {
<span class="nc" id="L306">                negativeQueryList.add(q);</span>
              }
              // A | B | ( !C &amp; !D )
<span class="nc" id="L309">            } else {</span>
<span class="nc" id="L310">              MtasSpanQuery q = new MtasSpanOrQuery(c.negativeQueryList</span>
<span class="nc" id="L311">                  .toArray(new MtasSpanQuery[c.negativeQueryList.size()]));</span>
<span class="nc bnc" id="L312" title="All 2 branches missed.">              if (c.not()) {</span>
<span class="nc" id="L313">                positiveQueryList.add(q);</span>
              } else {
<span class="nc" id="L315">                negativeQueryList.add(q);</span>
              }
<span class="nc" id="L317">            }</span>
          } else {
            // swap if necessary
<span class="nc bnc" id="L320" title="All 4 branches missed.">            if (this.isSimplePositive() &amp;&amp; c.not()) {</span>
<span class="nc" id="L321">              c.swapType();</span>
<span class="nc bnc" id="L322" title="All 4 branches missed.">            } else if (this.isSimpleNegative() &amp;&amp; !c.not()) {</span>
<span class="nc" id="L323">              c.swapType();</span>
            }
            // A | B | ( C &amp; !D )
<span class="nc bnc" id="L326" title="All 2 branches missed.">            if (c.type().equals(TYPE_AND)) {</span>
<span class="nc" id="L327">              MtasSpanQuery positiveQuery = new MtasSpanAndQuery(c.positiveQueryList</span>
<span class="nc" id="L328">                  .toArray(new MtasSpanQuery[c.positiveQueryList.size()]));</span>
<span class="nc" id="L329">              MtasSpanQuery negativeQuery = new MtasSpanAndQuery(c.negativeQueryList</span>
<span class="nc" id="L330">                  .toArray(new MtasSpanQuery[c.negativeQueryList.size()]));</span>
<span class="nc" id="L331">              MtasSpanQuery q = new MtasSpanNotQuery(positiveQuery, negativeQuery);</span>
<span class="nc bnc" id="L332" title="All 2 branches missed.">              if (c.not()) {</span>
<span class="nc" id="L333">                negativeQueryList.add(q);</span>
              } else {
<span class="nc" id="L335">                positiveQueryList.add(q);</span>
              }
              // A &amp; B &amp; ( C | !D )
<span class="nc" id="L338">            } else {</span>
<span class="nc" id="L339">              MtasSpanQuery positiveQuery = new MtasSpanOrQuery(c.positiveQueryList</span>
<span class="nc" id="L340">                  .toArray(new MtasSpanQuery[c.positiveQueryList.size()]));</span>
<span class="nc" id="L341">              MtasSpanQuery negativeQuery = new MtasSpanOrQuery(c.negativeQueryList</span>
<span class="nc" id="L342">                  .toArray(new MtasSpanQuery[c.negativeQueryList.size()]));</span>
<span class="nc" id="L343">              MtasSpanQuery q = new MtasSpanNotQuery(positiveQuery, negativeQuery);</span>
<span class="nc bnc" id="L344" title="All 2 branches missed.">              if (c.not()) {</span>
<span class="nc" id="L345">                negativeQueryList.add(q);</span>
              } else {
<span class="nc" id="L347">                positiveQueryList.add(q);</span>
              }
            }
          }
<span class="fc" id="L351">        }</span>
<span class="fc" id="L352">        conditionList.clear();</span>
      }
<span class="fc bfc" id="L354" title="All 2 branches covered.">      if (isSimpleNegative()) {</span>
<span class="fc" id="L355">        swapType();</span>
      }
<span class="fc" id="L357">      simplified = true;</span>
    }
<span class="fc" id="L359">  }</span>

  /*
   * (non-Javadoc)
   * 
   * @see java.lang.Object#toString()
   */
  @Override
  public String toString() {
<span class="nc" id="L368">    return toString(&quot;&quot;, &quot;&quot;);</span>
  }

  /**
   * To string.
   *
   * @param firstIndent the first indent
   * @param indent the indent
   * @return the string
   */
  public String toString(String firstIndent, String indent) {
<span class="nc" id="L379">    StringBuilder text = new StringBuilder();</span>
<span class="nc bnc" id="L380" title="All 2 branches missed.">    if (isEmpty()) {</span>
<span class="nc" id="L381">      text.append(firstIndent + &quot;Type: any word&quot;);</span>
<span class="nc bnc" id="L382" title="All 2 branches missed.">      text.append(not ? &quot; (not)\n&quot; : &quot;\n&quot;);</span>
    } else {
<span class="nc" id="L384">      text.append(firstIndent + &quot;Type: &quot; + type);</span>
<span class="nc bnc" id="L385" title="All 2 branches missed.">      text.append(not ? &quot; (not)\n&quot; : &quot;\n&quot;);</span>
<span class="nc bnc" id="L386" title="All 2 branches missed.">      if (positiveQueryList.size() &gt; 0) {</span>
<span class="nc bnc" id="L387" title="All 2 branches missed.">        for (MtasSpanQuery q : positiveQueryList) {</span>
<span class="nc" id="L388">          text.append(indent + &quot;List Positive Subqueries: &quot; + q.toString(field)</span>
              + &quot;\n&quot;);
<span class="nc" id="L390">        }</span>
      }
<span class="nc bnc" id="L392" title="All 2 branches missed.">      if (negativeQueryList.size() &gt; 0) {</span>
<span class="nc bnc" id="L393" title="All 2 branches missed.">        for (MtasSpanQuery q : negativeQueryList) {</span>
<span class="nc" id="L394">          text.append(indent + &quot;List Negative Queries: &quot; + q.toString(field) + &quot;\n&quot;);</span>
<span class="nc" id="L395">        }</span>
      }
<span class="nc bnc" id="L397" title="All 2 branches missed.">      if (conditionList.size() &gt; 0) {</span>
<span class="nc" id="L398">        text.append(indent + &quot;List Conditions\n&quot;);</span>
<span class="nc bnc" id="L399" title="All 2 branches missed.">        for (MtasCQLParserWordCondition c : conditionList) {</span>
<span class="nc" id="L400">          text.append(c.toString(indent + &quot;- &quot;, indent + &quot;  &quot;) + &quot;\n&quot;);</span>
<span class="nc" id="L401">        }</span>
      }
    }
<span class="nc" id="L404">    return text.toString();</span>
  }

  /*
   * (non-Javadoc)
   * 
   * @see java.lang.Object#equals(java.lang.Object)
   */
  @Override
  public boolean equals(Object object) {
<span class="pc bpc" id="L414" title="1 of 2 branches missed.">    if (object == null) {</span>
<span class="nc" id="L415">      return false;</span>
<span class="pc bpc" id="L416" title="1 of 2 branches missed.">    } else if (object instanceof MtasCQLParserWordCondition) {</span>
<span class="fc" id="L417">      MtasCQLParserWordCondition condition = (MtasCQLParserWordCondition) object;</span>
      // basic checks
<span class="pc bpc" id="L419" title="2 of 4 branches missed.">      if (!field.equals(condition.field) || not ^ condition.not</span>
<span class="pc bpc" id="L420" title="1 of 4 branches missed.">          || !type.equals(condition.type) || isSingle() ^ condition.isSingle()</span>
<span class="pc bpc" id="L421" title="1 of 2 branches missed.">          || isSimplePositive() ^ condition.isSimplePositive()</span>
<span class="pc bpc" id="L422" title="1 of 2 branches missed.">          || isSimpleNegative() ^ condition.isSimpleNegative()</span>
<span class="pc bpc" id="L423" title="1 of 2 branches missed.">          || isEmpty() ^ condition.isEmpty()) {</span>
<span class="fc" id="L424">        return false;</span>
<span class="fc bfc" id="L425" title="All 2 branches covered.">      } else if (isEmpty()) {</span>
<span class="fc" id="L426">        return true;</span>
      } else {
<span class="fc bfc" id="L428" title="All 2 branches covered.">        if (!positiveQueryList.equals(condition.positiveQueryList)) {</span>
<span class="fc" id="L429">          return false;</span>
        } else {
<span class="fc bfc" id="L431" title="All 2 branches covered.">          for (int i = 0; i &lt; positiveQueryList.size(); i++) {</span>
<span class="pc bpc" id="L432" title="1 of 2 branches missed.">            if (positiveQueryList.get(i) instanceof MtasCQLParserWordQuery) {</span>
<span class="fc" id="L433">              if (!(condition.positiveQueryList</span>
<span class="pc bpc" id="L434" title="1 of 2 branches missed.">                  .get(i) instanceof MtasCQLParserWordQuery)) {</span>
<span class="nc" id="L435">                return false;</span>
<span class="fc" id="L436">              } else if (!((MtasCQLParserWordQuery) positiveQueryList.get(i))</span>
<span class="pc bpc" id="L437" title="1 of 2 branches missed.">                  .equals(condition.positiveQueryList.get(i))) {</span>
<span class="nc" id="L438">                return false;</span>
              }
            }
          }
        }
<span class="pc bpc" id="L443" title="1 of 2 branches missed.">        if (!negativeQueryList.equals(condition.negativeQueryList)) {</span>
<span class="nc" id="L444">          return false;</span>
        } else {
<span class="pc bpc" id="L446" title="1 of 2 branches missed.">          for (int i = 0; i &lt; negativeQueryList.size(); i++) {</span>
<span class="nc bnc" id="L447" title="All 2 branches missed.">            if (negativeQueryList.get(i) instanceof MtasCQLParserWordQuery) {</span>
<span class="nc" id="L448">              if (!(condition.negativeQueryList</span>
<span class="nc bnc" id="L449" title="All 2 branches missed.">                  .get(i) instanceof MtasCQLParserWordQuery)) {</span>
<span class="nc" id="L450">                return false;</span>
<span class="nc" id="L451">              } else if (!((MtasCQLParserWordQuery) negativeQueryList.get(i))</span>
<span class="nc bnc" id="L452" title="All 2 branches missed.">                  .equals(condition.negativeQueryList.get(i))) {</span>
<span class="nc" id="L453">                return false;</span>
              }
            }
          }
        }
<span class="fc" id="L458">        return true;</span>
      }
    } else {
<span class="nc" id="L461">      return false;</span>
    }
  }
  
  /* (non-Javadoc)
   * @see java.lang.Object#hashCode()
   */
  @Override
  public int hashCode() {
<span class="nc" id="L470">    int h = this.getClass().getSimpleName().hashCode();</span>
<span class="nc" id="L471">    h = (h * 3) ^ field.hashCode();</span>
<span class="nc" id="L472">    h = (h * 5) ^ type.hashCode();</span>
<span class="nc bnc" id="L473" title="All 2 branches missed.">    h += (h * 7) ^ (not ? 3 : 5);</span>
<span class="nc bnc" id="L474" title="All 2 branches missed.">    h += (h * 11) ^ (simplified ? 7 : 13);</span>
<span class="nc" id="L475">    h = (h * 17) ^ conditionList.hashCode();</span>
<span class="nc" id="L476">    h = (h * 19) ^ positiveQueryList.hashCode();</span>
<span class="nc" id="L477">    h = (h * 23) ^ negativeQueryList.hashCode();</span>
<span class="nc" id="L478">    return h;</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>