MtasCQLParserWordCondition.java.html 23.5 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 483 484 485 486 487 488 489 490
<?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="L49">  public MtasCQLParserWordCondition(String field, String type) {</span>
<span class="fc" id="L50">    this.field = field;</span>
<span class="fc" id="L51">    this.type = type;</span>
<span class="fc" id="L52">    not = false;</span>
<span class="fc" id="L53">    simplified = true;</span>
<span class="fc" id="L54">    positiveQueryList = new ArrayList&lt;MtasSpanQuery&gt;();</span>
<span class="fc" id="L55">    negativeQueryList = new ArrayList&lt;MtasSpanQuery&gt;();</span>
<span class="fc" id="L56">    conditionList = new ArrayList&lt;MtasCQLParserWordCondition&gt;();</span>
<span class="fc" id="L57">  }</span>

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

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

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

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

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

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

  /**
   * Gets the positive query.
   *
   * @return the positive query
   */
  public List&lt;MtasSpanQuery&gt; getPositiveQuery() {
<span class="fc" id="L118">    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="L128" title="2 of 4 branches missed.">    if ((index &gt;= 0) &amp;&amp; (index &lt; positiveQueryList.size())) {</span>
<span class="fc" id="L129">      return positiveQueryList.get(index);</span>
    } else {
<span class="nc" id="L131">      return null;</span>
    }
  }

  /**
   * Gets the negative query.
   *
   * @return the negative query
   */
  public List&lt;MtasSpanQuery&gt; getNegativeQuery() {
<span class="fc" id="L141">    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="L151" title="2 of 4 branches missed.">    if ((index &gt;= 0) &amp;&amp; (index &lt; negativeQueryList.size())) {</span>
<span class="fc" id="L152">      return negativeQueryList.get(index);</span>
    } else {
<span class="nc" id="L154">      return null;</span>
    }
  }

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

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

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

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

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

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

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

  /**
   * Simplify.
   */
  public void simplify() {
<span class="fc bfc" id="L257" title="All 2 branches covered.">    if (!simplified) {</span>
<span class="fc bfc" id="L258" title="All 2 branches covered.">      if (conditionList.size() &gt; 0) {</span>
<span class="fc bfc" id="L259" title="All 2 branches covered.">        for (MtasCQLParserWordCondition c : conditionList) {</span>
<span class="fc" id="L260">          c.simplify();</span>
          // A &amp; B &amp; ( C &amp; !D )
<span class="fc bfc" id="L262" title="All 4 branches covered.">          if (c.type().equals(type) &amp;&amp; !c.not()) {</span>
<span class="fc" id="L263">            positiveQueryList.addAll(c.positiveQueryList);</span>
<span class="fc" id="L264">            negativeQueryList.addAll(c.negativeQueryList);</span>
            // A &amp; B &amp; !( C | !D )
<span class="fc bfc" id="L266" title="All 4 branches covered.">          } else if (!c.type().equals(type) &amp;&amp; c.not()) {</span>
<span class="fc" id="L267">            positiveQueryList.addAll(c.negativeQueryList);</span>
<span class="fc" id="L268">            negativeQueryList.addAll(c.positiveQueryList);</span>
            // A &amp; B &amp; ( C )
<span class="fc bfc" id="L270" title="All 4 branches covered.">          } else if (c.isSingle() &amp;&amp; !c.not()) {</span>
<span class="fc" id="L271">            positiveQueryList.addAll(c.positiveQueryList);</span>
<span class="fc" id="L272">            negativeQueryList.addAll(c.negativeQueryList);</span>
            // A &amp; B &amp; !( C )
<span class="pc bpc" id="L274" title="1 of 4 branches missed.">          } else if (c.isSingle() &amp;&amp; c.not()) {</span>
<span class="fc" id="L275">            positiveQueryList.addAll(c.negativeQueryList);</span>
<span class="fc" id="L276">            negativeQueryList.addAll(c.positiveQueryList);</span>
<span class="pc bpc" id="L277" title="1 of 2 branches missed.">          } else if (c.isSimplePositive()) {</span>
            // A | B | ( C &amp; D )
<span class="fc bfc" id="L279" title="All 2 branches covered.">            if (c.type().equals(TYPE_AND)) {</span>
<span class="fc" id="L280">              MtasSpanQuery q = new MtasSpanAndQuery(c.positiveQueryList</span>
<span class="fc" id="L281">                  .toArray(new MtasSpanQuery[c.positiveQueryList.size()]));</span>
<span class="pc bpc" id="L282" title="1 of 2 branches missed.">              if (c.not()) {</span>
<span class="nc" id="L283">                negativeQueryList.add(q);</span>
              } else {
<span class="fc" id="L285">                positiveQueryList.add(q);</span>
              }
              // A &amp; B &amp; ( C | D )
<span class="fc" id="L288">            } else {</span>
<span class="fc" id="L289">              MtasSpanQuery q = new MtasSpanOrQuery(c.positiveQueryList</span>
<span class="fc" id="L290">                  .toArray(new MtasSpanQuery[c.positiveQueryList.size()]));</span>
<span class="pc bpc" id="L291" title="1 of 2 branches missed.">              if (c.not()) {</span>
<span class="nc" id="L292">                negativeQueryList.add(q);</span>
              } else {
<span class="fc" id="L294">                positiveQueryList.add(q);</span>
              }
<span class="fc" id="L296">            }</span>
<span class="nc bnc" id="L297" title="All 2 branches missed.">          } else if (c.isSimpleNegative()) {</span>
            // A | B | ( !C | !D )
<span class="nc bnc" id="L299" title="All 2 branches missed.">            if (c.type().equals(TYPE_OR)) {</span>
<span class="nc" id="L300">              MtasSpanQuery q = new MtasSpanAndQuery(c.negativeQueryList</span>
<span class="nc" id="L301">                  .toArray(new MtasSpanQuery[c.negativeQueryList.size()]));</span>
<span class="nc bnc" id="L302" title="All 2 branches missed.">              if (c.not()) {</span>
<span class="nc" id="L303">                positiveQueryList.add(q);</span>
              } else {
<span class="nc" id="L305">                negativeQueryList.add(q);</span>
              }
              // A | B | ( !C &amp; !D )
<span class="nc" id="L308">            } else {</span>
<span class="nc" id="L309">              MtasSpanQuery q = new MtasSpanOrQuery(c.negativeQueryList</span>
<span class="nc" id="L310">                  .toArray(new MtasSpanQuery[c.negativeQueryList.size()]));</span>
<span class="nc bnc" id="L311" title="All 2 branches missed.">              if (c.not()) {</span>
<span class="nc" id="L312">                positiveQueryList.add(q);</span>
              } else {
<span class="nc" id="L314">                negativeQueryList.add(q);</span>
              }
<span class="nc" id="L316">            }</span>
          } else {
            // swap if necessary
<span class="nc bnc" id="L319" title="All 4 branches missed.">            if (this.isSimplePositive() &amp;&amp; c.not()) {</span>
<span class="nc" id="L320">              c.swapType();</span>
<span class="nc bnc" id="L321" title="All 4 branches missed.">            } else if (this.isSimpleNegative() &amp;&amp; !c.not()) {</span>
<span class="nc" id="L322">              c.swapType();</span>
            }
            // A | B | ( C &amp; !D )
<span class="nc bnc" id="L325" title="All 2 branches missed.">            if (c.type().equals(TYPE_AND)) {</span>
<span class="nc" id="L326">              MtasSpanQuery positiveQuery = new MtasSpanAndQuery(</span>
                  c.positiveQueryList
<span class="nc" id="L328">                      .toArray(new MtasSpanQuery[c.positiveQueryList.size()]));</span>
<span class="nc" id="L329">              MtasSpanQuery negativeQuery = new MtasSpanAndQuery(</span>
                  c.negativeQueryList
<span class="nc" id="L331">                      .toArray(new MtasSpanQuery[c.negativeQueryList.size()]));</span>
<span class="nc" id="L332">              MtasSpanQuery q = new MtasSpanNotQuery(positiveQuery,</span>
                  negativeQuery);
<span class="nc bnc" id="L334" title="All 2 branches missed.">              if (c.not()) {</span>
<span class="nc" id="L335">                negativeQueryList.add(q);</span>
              } else {
<span class="nc" id="L337">                positiveQueryList.add(q);</span>
              }
              // A &amp; B &amp; ( C | !D )
<span class="nc" id="L340">            } else {</span>
<span class="nc" id="L341">              MtasSpanQuery positiveQuery = new MtasSpanOrQuery(</span>
                  c.positiveQueryList
<span class="nc" id="L343">                      .toArray(new MtasSpanQuery[c.positiveQueryList.size()]));</span>
<span class="nc" id="L344">              MtasSpanQuery negativeQuery = new MtasSpanOrQuery(</span>
                  c.negativeQueryList
<span class="nc" id="L346">                      .toArray(new MtasSpanQuery[c.negativeQueryList.size()]));</span>
<span class="nc" id="L347">              MtasSpanQuery q = new MtasSpanNotQuery(positiveQuery,</span>
                  negativeQuery);
<span class="nc bnc" id="L349" title="All 2 branches missed.">              if (c.not()) {</span>
<span class="nc" id="L350">                negativeQueryList.add(q);</span>
              } else {
<span class="nc" id="L352">                positiveQueryList.add(q);</span>
              }
            }
          }
<span class="fc" id="L356">        }</span>
<span class="fc" id="L357">        conditionList.clear();</span>
      }
<span class="fc bfc" id="L359" title="All 2 branches covered.">      if (isSimpleNegative()) {</span>
<span class="fc" id="L360">        swapType();</span>
      }
<span class="fc" id="L362">      simplified = true;</span>
    }
<span class="fc" id="L364">  }</span>

  /*
   * (non-Javadoc)
   * 
   * @see java.lang.Object#toString()
   */
  @Override
  public String toString() {
<span class="nc" id="L373">    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="L384">    StringBuilder text = new StringBuilder();</span>
<span class="nc bnc" id="L385" title="All 2 branches missed.">    if (isEmpty()) {</span>
<span class="nc" id="L386">      text.append(firstIndent + &quot;Type: any word&quot;);</span>
<span class="nc bnc" id="L387" title="All 2 branches missed.">      text.append(not ? &quot; (not)\n&quot; : &quot;\n&quot;);</span>
    } else {
<span class="nc" id="L389">      text.append(firstIndent + &quot;Type: &quot; + type);</span>
<span class="nc bnc" id="L390" title="All 2 branches missed.">      text.append(not ? &quot; (not)\n&quot; : &quot;\n&quot;);</span>
<span class="nc bnc" id="L391" title="All 2 branches missed.">      if (positiveQueryList.size() &gt; 0) {</span>
<span class="nc bnc" id="L392" title="All 2 branches missed.">        for (MtasSpanQuery q : positiveQueryList) {</span>
<span class="nc" id="L393">          text.append(</span>
<span class="nc" id="L394">              indent + &quot;List Positive Subqueries: &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 (negativeQueryList.size() &gt; 0) {</span>
<span class="nc bnc" id="L398" title="All 2 branches missed.">        for (MtasSpanQuery q : negativeQueryList) {</span>
<span class="nc" id="L399">          text.append(</span>
<span class="nc" id="L400">              indent + &quot;List Negative Queries: &quot; + q.toString(field) + &quot;\n&quot;);</span>
<span class="nc" id="L401">        }</span>
      }
<span class="nc bnc" id="L403" title="All 2 branches missed.">      if (conditionList.size() &gt; 0) {</span>
<span class="nc" id="L404">        text.append(indent + &quot;List Conditions\n&quot;);</span>
<span class="nc bnc" id="L405" title="All 2 branches missed.">        for (MtasCQLParserWordCondition c : conditionList) {</span>
<span class="nc" id="L406">          text.append(c.toString(indent + &quot;- &quot;, indent + &quot;  &quot;) + &quot;\n&quot;);</span>
<span class="nc" id="L407">        }</span>
      }
    }
<span class="nc" id="L410">    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="L420" title="1 of 2 branches missed.">    if (object == null) {</span>
<span class="nc" id="L421">      return false;</span>
<span class="pc bpc" id="L422" title="1 of 2 branches missed.">    } else if (object instanceof MtasCQLParserWordCondition) {</span>
<span class="fc" id="L423">      MtasCQLParserWordCondition condition = (MtasCQLParserWordCondition) object;</span>
      // basic checks
<span class="pc bpc" id="L425" title="2 of 4 branches missed.">      if (!field.equals(condition.field) || not ^ condition.not</span>
<span class="pc bpc" id="L426" title="1 of 4 branches missed.">          || !type.equals(condition.type) || isSingle() ^ condition.isSingle()</span>
<span class="pc bpc" id="L427" title="1 of 2 branches missed.">          || isSimplePositive() ^ condition.isSimplePositive()</span>
<span class="pc bpc" id="L428" title="1 of 2 branches missed.">          || isSimpleNegative() ^ condition.isSimpleNegative()</span>
<span class="pc bpc" id="L429" title="1 of 2 branches missed.">          || isEmpty() ^ condition.isEmpty()) {</span>
<span class="fc" id="L430">        return false;</span>
<span class="fc bfc" id="L431" title="All 2 branches covered.">      } else if (isEmpty()) {</span>
<span class="fc" id="L432">        return true;</span>
      } else {
<span class="fc bfc" id="L434" title="All 2 branches covered.">        if (!positiveQueryList.equals(condition.positiveQueryList)) {</span>
<span class="fc" id="L435">          return false;</span>
        } else {
<span class="fc bfc" id="L437" title="All 2 branches covered.">          for (int i = 0; i &lt; positiveQueryList.size(); i++) {</span>
<span class="pc bpc" id="L438" title="1 of 2 branches missed.">            if (positiveQueryList.get(i) instanceof MtasCQLParserWordQuery) {</span>
<span class="fc" id="L439">              if (!(condition.positiveQueryList</span>
<span class="pc bpc" id="L440" title="1 of 2 branches missed.">                  .get(i) instanceof MtasCQLParserWordQuery)) {</span>
<span class="nc" id="L441">                return false;</span>
<span class="fc" id="L442">              } else if (!((MtasCQLParserWordQuery) positiveQueryList.get(i))</span>
<span class="pc bpc" id="L443" title="1 of 2 branches missed.">                  .equals(condition.positiveQueryList.get(i))) {</span>
<span class="nc" id="L444">                return false;</span>
              }
            }
          }
        }
<span class="pc bpc" id="L449" title="1 of 2 branches missed.">        if (!negativeQueryList.equals(condition.negativeQueryList)) {</span>
<span class="nc" id="L450">          return false;</span>
        } else {
<span class="pc bpc" id="L452" title="1 of 2 branches missed.">          for (int i = 0; i &lt; negativeQueryList.size(); i++) {</span>
<span class="nc bnc" id="L453" title="All 2 branches missed.">            if (negativeQueryList.get(i) instanceof MtasCQLParserWordQuery) {</span>
<span class="nc" id="L454">              if (!(condition.negativeQueryList</span>
<span class="nc bnc" id="L455" title="All 2 branches missed.">                  .get(i) instanceof MtasCQLParserWordQuery)) {</span>
<span class="nc" id="L456">                return false;</span>
<span class="nc" id="L457">              } else if (!((MtasCQLParserWordQuery) negativeQueryList.get(i))</span>
<span class="nc bnc" id="L458" title="All 2 branches missed.">                  .equals(condition.negativeQueryList.get(i))) {</span>
<span class="nc" id="L459">                return false;</span>
              }
            }
          }
        }
<span class="fc" id="L464">        return true;</span>
      }
    } else {
<span class="nc" id="L467">      return false;</span>
    }
  }

  /*
   * (non-Javadoc)
   * 
   * @see java.lang.Object#hashCode()
   */
  @Override
  public int hashCode() {
<span class="nc" id="L478">    int h = this.getClass().getSimpleName().hashCode();</span>
<span class="nc" id="L479">    h = (h * 3) ^ field.hashCode();</span>
<span class="nc" id="L480">    h = (h * 5) ^ type.hashCode();</span>
<span class="nc bnc" id="L481" title="All 2 branches missed.">    h += (h * 7) ^ (not ? 3 : 5);</span>
<span class="nc bnc" id="L482" title="All 2 branches missed.">    h += (h * 11) ^ (simplified ? 7 : 13);</span>
<span class="nc" id="L483">    h = (h * 17) ^ conditionList.hashCode();</span>
<span class="nc" id="L484">    h = (h * 19) ^ positiveQueryList.hashCode();</span>
<span class="nc" id="L485">    h = (h * 23) ^ negativeQueryList.hashCode();</span>
<span class="nc" id="L486">    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>