MtasExtendedSpanAndQuery.java.html
4.28 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
<?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>MtasExtendedSpanAndQuery.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> > <a href="index.source.html" class="el_package">mtas.search.spans.util</a> > <span class="el_source">MtasExtendedSpanAndQuery.java</span></div><h1>MtasExtendedSpanAndQuery.java</h1><pre class="source lang-java linenums">package mtas.search.spans.util;
import java.util.HashSet;
import java.util.Iterator;
import org.apache.lucene.search.spans.SpanNearQuery;
import org.apache.lucene.search.spans.SpanQuery;
/**
* The Class MtasExtendedSpanAndQuery.
*/
public class MtasExtendedSpanAndQuery extends SpanNearQuery {
/** The local clauses. */
private HashSet<SpanQuery> localClauses;
/**
* Instantiates a new mtas extended span and query.
*
* @param clauses the clauses
*/
public MtasExtendedSpanAndQuery(SpanQuery... clauses) {
<span class="fc" id="L22"> super(clauses, -1 * (clauses.length - 1), false);</span>
<span class="fc" id="L23"> this.localClauses = new HashSet<>();</span>
<span class="fc bfc" id="L24" title="All 2 branches covered."> for (SpanQuery clause : clauses) {</span>
<span class="fc" id="L25"> this.localClauses.add(clause);</span>
}
<span class="fc" id="L27"> }</span>
/*
* (non-Javadoc)
*
* @see
* org.apache.lucene.search.spans.SpanNearQuery#toString(java.lang.String)
*/
@Override
public String toString(String field) {
<span class="nc" id="L37"> StringBuilder buffer = new StringBuilder();</span>
<span class="nc" id="L38"> buffer.append(this.getClass().getSimpleName() + "([");</span>
<span class="nc" id="L39"> Iterator<SpanQuery> i = localClauses.iterator();</span>
<span class="nc bnc" id="L40" title="All 2 branches missed."> while (i.hasNext()) {</span>
<span class="nc" id="L41"> SpanQuery clause = i.next();</span>
<span class="nc" id="L42"> buffer.append(clause.toString(field));</span>
<span class="nc bnc" id="L43" title="All 2 branches missed."> if (i.hasNext()) {</span>
<span class="nc" id="L44"> buffer.append(", ");</span>
}
<span class="nc" id="L46"> }</span>
<span class="nc" id="L47"> buffer.append("])");</span>
<span class="nc" id="L48"> return buffer.toString();</span>
}
/*
* (non-Javadoc)
*
* @see org.apache.lucene.search.spans.SpanNearQuery#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
<span class="pc bpc" id="L58" title="1 of 2 branches missed."> if (this == obj)</span>
<span class="nc" id="L59"> return true;</span>
<span class="pc bpc" id="L60" title="1 of 2 branches missed."> if (obj == null)</span>
<span class="nc" id="L61"> return false;</span>
<span class="pc bpc" id="L62" title="1 of 2 branches missed."> if (getClass() != obj.getClass())</span>
<span class="nc" id="L63"> return false;</span>
<span class="fc" id="L64"> final MtasExtendedSpanAndQuery that = (MtasExtendedSpanAndQuery) obj;</span>
<span class="fc" id="L65"> return localClauses.equals(that.localClauses);</span>
}
/*
* (non-Javadoc)
*
* @see org.apache.lucene.search.spans.SpanNearQuery#hashCode()
*/
@Override
public int hashCode() {
<span class="nc" id="L75"> int h = this.getClass().getSimpleName().hashCode();</span>
<span class="nc" id="L76"> h = (h * 7) ^ super.hashCode();</span>
<span class="nc" id="L77"> 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>