MtasParser.java.html
4.05 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
<?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>MtasParser.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.analysis.parser</a> > <span class="el_source">MtasParser.java</span></div><h1>MtasParser.java</h1><pre class="source lang-java linenums">package mtas.analysis.parser;
import java.io.Reader;
import mtas.analysis.token.MtasTokenCollection;
import mtas.analysis.util.MtasConfigException;
import mtas.analysis.util.MtasConfiguration;
import mtas.analysis.util.MtasParserException;
/**
* The Class MtasParser.
*/
abstract public class MtasParser {
/** The token collection. */
protected MtasTokenCollection tokenCollection;
/** The config. */
protected MtasConfiguration config;
/** The autorepair. */
<span class="pc" id="L21"> protected Boolean autorepair = false;</span>
/** The makeunique. */
<span class="pc" id="L24"> protected Boolean makeunique = false;</span>
/** The Constant TOKEN_OFFSET. */
protected static final String TOKEN_OFFSET = "offset";
/** The Constant TOKEN_REALOFFSET. */
protected static final String TOKEN_REALOFFSET = "realoffset";
/** The Constant TOKEN_PARENT. */
protected static final String TOKEN_PARENT = "parent";
/**
* Instantiates a new mtas parser.
*/
<span class="nc" id="L38"> public MtasParser() {</span>
<span class="nc" id="L39"> }</span>
/**
* Instantiates a new mtas parser.
*
* @param config the config
*/
<span class="fc" id="L46"> public MtasParser(MtasConfiguration config) {</span>
<span class="fc" id="L47"> this.config = config;</span>
<span class="fc" id="L48"> }</span>
/**
* Inits the parser.
*
* @throws MtasConfigException the mtas config exception
*/
protected void initParser() throws MtasConfigException {
<span class="pc bpc" id="L56" title="1 of 2 branches missed."> if (config != null) {</span>
// find namespaceURI
<span class="fc bfc" id="L58" title="All 2 branches covered."> for (int i = 0; i < config.children.size(); i++) {</span>
<span class="fc" id="L59"> MtasConfiguration current = config.children.get(i);</span>
<span class="fc bfc" id="L60" title="All 2 branches covered."> if (current.name.equals("autorepair")) {</span>
<span class="fc" id="L61"> autorepair = current.attributes.get("value").equals("true");</span>
}
<span class="fc bfc" id="L63" title="All 2 branches covered."> if (current.name.equals("makeunique")) {</span>
<span class="fc" id="L64"> makeunique = current.attributes.get("value").equals("true");</span>
}
}
}
<span class="fc" id="L68"> }</span>
/**
* Creates the token collection.
*
* @param reader the reader
* @return the mtas token collection
* @throws MtasParserException the mtas parser exception
* @throws MtasConfigException the mtas config exception
*/
public abstract MtasTokenCollection createTokenCollection(Reader reader)
throws MtasParserException, MtasConfigException;
/**
* Prints the config.
*
* @return the string
*/
public abstract String printConfig();
}
</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>