MtasCodec.java.html
6.88 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
<?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>MtasCodec.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.codec</a> > <span class="el_source">MtasCodec.java</span></div><h1>MtasCodec.java</h1><pre class="source lang-java linenums">package mtas.codec;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.CompoundFormat;
import org.apache.lucene.codecs.DocValuesFormat;
import org.apache.lucene.codecs.FieldInfosFormat;
import org.apache.lucene.codecs.LiveDocsFormat;
import org.apache.lucene.codecs.NormsFormat;
import org.apache.lucene.codecs.PointsFormat;
import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.codecs.SegmentInfoFormat;
import org.apache.lucene.codecs.StoredFieldsFormat;
import org.apache.lucene.codecs.TermVectorsFormat;
import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat;
/**
* The Class MtasCodec.
*/
public class MtasCodec extends Codec {
/** The Constant MTAS_CODEC_NAME. */
public static final String MTAS_CODEC_NAME = "MtasCodec";
/** The delegate. */
Codec delegate;
/**
* Instantiates a new mtas codec.
*/
public MtasCodec() {
<span class="fc" id="L31"> super(MTAS_CODEC_NAME);</span>
<span class="fc" id="L32"> delegate = null;</span>
<span class="fc" id="L33"> }</span>
/**
* Instantiates a new mtas codec.
*
* @param name the name
* @param delegate the delegate
*/
protected MtasCodec(String name, Codec delegate) {
<span class="fc" id="L42"> super(name);</span>
<span class="fc" id="L43"> this.delegate = delegate;</span>
<span class="fc" id="L44"> }</span>
/**
* Inits the delegate.
*/
private void initDelegate() {
<span class="fc bfc" id="L50" title="All 2 branches covered."> if (delegate == null) {</span>
<span class="fc" id="L51"> delegate = Codec.getDefault();</span>
}
<span class="fc" id="L53"> }</span>
/*
* (non-Javadoc)
*
* @see org.apache.lucene.codecs.Codec#postingsFormat()
*/
@Override
public PostingsFormat postingsFormat() {
<span class="fc" id="L62"> initDelegate();</span>
<span class="pc bpc" id="L63" title="1 of 2 branches missed."> if (delegate.postingsFormat() instanceof PerFieldPostingsFormat) {</span>
<span class="fc" id="L64"> Codec defaultCodec = Codec.getDefault();</span>
<span class="fc" id="L65"> PostingsFormat defaultPostingsFormat = defaultCodec.postingsFormat();</span>
<span class="pc bpc" id="L66" title="1 of 2 branches missed."> if (defaultPostingsFormat instanceof PerFieldPostingsFormat) {</span>
<span class="fc" id="L67"> defaultPostingsFormat = ((PerFieldPostingsFormat) defaultPostingsFormat)</span>
<span class="fc" id="L68"> .getPostingsFormatForField(null);</span>
<span class="pc bpc" id="L69" title="2 of 4 branches missed."> if ((defaultPostingsFormat == null)</span>
|| (defaultPostingsFormat instanceof PerFieldPostingsFormat)) {
// fallback option
<span class="nc" id="L72"> return new MtasCodecPostingsFormat(</span>
<span class="nc" id="L73"> PostingsFormat.forName("Lucene62"));</span>
} else {
<span class="fc" id="L75"> return new MtasCodecPostingsFormat(defaultPostingsFormat);</span>
}
} else {
<span class="nc" id="L78"> return new MtasCodecPostingsFormat(defaultPostingsFormat);</span>
}
} else {
<span class="nc" id="L81"> return new MtasCodecPostingsFormat(delegate.postingsFormat());</span>
}
}
/*
* (non-Javadoc)
*
* @see org.apache.lucene.codecs.Codec#docValuesFormat()
*/
@Override
public DocValuesFormat docValuesFormat() {
<span class="nc" id="L92"> initDelegate();</span>
<span class="nc" id="L93"> return delegate.docValuesFormat();</span>
}
/*
* (non-Javadoc)
*
* @see org.apache.lucene.codecs.Codec#storedFieldsFormat()
*/
@Override
public StoredFieldsFormat storedFieldsFormat() {
<span class="fc" id="L103"> initDelegate();</span>
<span class="fc" id="L104"> return delegate.storedFieldsFormat();</span>
}
/*
* (non-Javadoc)
*
* @see org.apache.lucene.codecs.Codec#termVectorsFormat()
*/
@Override
public TermVectorsFormat termVectorsFormat() {
<span class="nc" id="L114"> initDelegate();</span>
<span class="nc" id="L115"> return delegate.termVectorsFormat();</span>
}
/*
* (non-Javadoc)
*
* @see org.apache.lucene.codecs.Codec#fieldInfosFormat()
*/
@Override
public FieldInfosFormat fieldInfosFormat() {
<span class="fc" id="L125"> initDelegate();</span>
<span class="fc" id="L126"> return delegate.fieldInfosFormat();</span>
}
/*
* (non-Javadoc)
*
* @see org.apache.lucene.codecs.Codec#segmentInfoFormat()
*/
@Override
public SegmentInfoFormat segmentInfoFormat() {
<span class="fc" id="L136"> initDelegate();</span>
<span class="fc" id="L137"> return delegate.segmentInfoFormat();</span>
}
/*
* (non-Javadoc)
*
* @see org.apache.lucene.codecs.Codec#normsFormat()
*/
@Override
public NormsFormat normsFormat() {
<span class="fc" id="L147"> initDelegate();</span>
<span class="fc" id="L148"> return delegate.normsFormat();</span>
}
/*
* (non-Javadoc)
*
* @see org.apache.lucene.codecs.Codec#liveDocsFormat()
*/
@Override
public LiveDocsFormat liveDocsFormat() {
<span class="fc" id="L158"> initDelegate();</span>
<span class="fc" id="L159"> return delegate.liveDocsFormat();</span>
}
/*
* (non-Javadoc)
*
* @see org.apache.lucene.codecs.Codec#compoundFormat()
*/
@Override
public CompoundFormat compoundFormat() {
<span class="nc" id="L169"> initDelegate();</span>
<span class="nc" id="L170"> return delegate.compoundFormat();</span>
}
/*
* (non-Javadoc)
*
* @see org.apache.lucene.codecs.Codec#pointsFormat()
*/
@Override
public PointsFormat pointsFormat() {
<span class="nc" id="L180"> initDelegate();</span>
<span class="nc" id="L181"> return delegate.pointsFormat();</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>