1 | /* | |
2 | * Copyright 2006 - 2013 | |
3 | * Stefan Balev <stefan.balev@graphstream-project.org> | |
4 | * Julien Baudry <julien.baudry@graphstream-project.org> | |
5 | * Antoine Dutot <antoine.dutot@graphstream-project.org> | |
6 | * Yoann Pign�� <yoann.pigne@graphstream-project.org> | |
7 | * Guilhelm Savin <guilhelm.savin@graphstream-project.org> | |
8 | * | |
9 | * This file is part of GraphStream <http://graphstream-project.org>. | |
10 | * | |
11 | * GraphStream is a library whose purpose is to handle static or dynamic | |
12 | * graph, create them from scratch, file or any source and display them. | |
13 | * | |
14 | * This program is free software distributed under the terms of two licenses, the | |
15 | * CeCILL-C license that fits European law, and the GNU Lesser General Public | |
16 | * License. You can use, modify and/ or redistribute the software under the terms | |
17 | * of the CeCILL-C license as circulated by CEA, CNRS and INRIA at the following | |
18 | * URL <http://www.cecill.info> or under the terms of the GNU LGPL as published by | |
19 | * the Free Software Foundation, either version 3 of the License, or (at your | |
20 | * option) any later version. | |
21 | * | |
22 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY | |
23 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
24 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | |
25 | * | |
26 | * You should have received a copy of the GNU Lesser General Public License | |
27 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
28 | * | |
29 | * The fact that you are presently reading this means that you have had | |
30 | * knowledge of the CeCILL-C and LGPL licenses and that you accept their terms. | |
31 | */ | |
32 | package org.graphstream.util.parser; | |
33 | ||
34 | import java.io.IOException; | |
35 | ||
36 | /** | |
37 | * An implementation of interface CharStream, where the stream is assumed to | |
38 | * contain only ASCII characters (without unicode processing). | |
39 | */ | |
40 | ||
41 | public class SimpleCharStream { | |
42 | /** Whether parser is static. */ | |
43 | public static final boolean staticFlag = false; | |
44 | int bufsize; | |
45 | int available; | |
46 | int tokenBegin; | |
47 | /** Position in buffer. */ | |
48 | public int bufpos = -1; | |
49 | protected int bufline[]; | |
50 | protected int bufcolumn[]; | |
51 | ||
52 | protected int column = 0; | |
53 | protected int line = 1; | |
54 | ||
55 | protected boolean prevCharIsCR = false; | |
56 | protected boolean prevCharIsLF = false; | |
57 | ||
58 | protected java.io.Reader inputStream; | |
59 | ||
60 | protected char[] buffer; | |
61 | protected int maxNextCharInd = 0; | |
62 | protected int inBuf = 0; | |
63 | protected int tabSize = 8; | |
64 | ||
65 | protected void setTabSize(int i) { | |
66 | tabSize = i; | |
67 | } | |
68 | ||
69 | protected int getTabSize(int i) { | |
70 |
1
1. getTabSize : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return tabSize; |
71 | } | |
72 | ||
73 | protected void ExpandBuff(boolean wrapAround) { | |
74 |
1
1. ExpandBuff : Replaced integer addition with subtraction → NO_COVERAGE |
char[] newbuffer = new char[bufsize + 2048]; |
75 |
1
1. ExpandBuff : Replaced integer addition with subtraction → NO_COVERAGE |
int newbufline[] = new int[bufsize + 2048]; |
76 |
1
1. ExpandBuff : Replaced integer addition with subtraction → NO_COVERAGE |
int newbufcolumn[] = new int[bufsize + 2048]; |
77 | ||
78 | try { | |
79 |
1
1. ExpandBuff : negated conditional → NO_COVERAGE |
if (wrapAround) { |
80 |
1
1. ExpandBuff : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize |
81 |
1
1. ExpandBuff : Replaced integer subtraction with addition → NO_COVERAGE |
- tokenBegin); |
82 |
2
1. ExpandBuff : Replaced integer subtraction with addition → NO_COVERAGE 2. ExpandBuff : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, |
83 | bufpos); | |
84 | buffer = newbuffer; | |
85 | ||
86 |
1
1. ExpandBuff : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize |
87 |
1
1. ExpandBuff : Replaced integer subtraction with addition → NO_COVERAGE |
- tokenBegin); |
88 |
2
1. ExpandBuff : Replaced integer subtraction with addition → NO_COVERAGE 2. ExpandBuff : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, |
89 | bufpos); | |
90 | bufline = newbufline; | |
91 | ||
92 |
1
1. ExpandBuff : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, |
93 |
1
1. ExpandBuff : Replaced integer subtraction with addition → NO_COVERAGE |
bufsize - tokenBegin); |
94 |
1
1. ExpandBuff : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize |
95 |
1
1. ExpandBuff : Replaced integer subtraction with addition → NO_COVERAGE |
- tokenBegin, bufpos); |
96 | bufcolumn = newbufcolumn; | |
97 | ||
98 |
2
1. ExpandBuff : Replaced integer subtraction with addition → NO_COVERAGE 2. ExpandBuff : Replaced integer addition with subtraction → NO_COVERAGE |
maxNextCharInd = (bufpos += (bufsize - tokenBegin)); |
99 | } else { | |
100 |
1
1. ExpandBuff : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize |
101 |
1
1. ExpandBuff : Replaced integer subtraction with addition → NO_COVERAGE |
- tokenBegin); |
102 | buffer = newbuffer; | |
103 | ||
104 |
1
1. ExpandBuff : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize |
105 |
1
1. ExpandBuff : Replaced integer subtraction with addition → NO_COVERAGE |
- tokenBegin); |
106 | bufline = newbufline; | |
107 | ||
108 |
1
1. ExpandBuff : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, |
109 |
1
1. ExpandBuff : Replaced integer subtraction with addition → NO_COVERAGE |
bufsize - tokenBegin); |
110 | bufcolumn = newbufcolumn; | |
111 | ||
112 |
1
1. ExpandBuff : Replaced integer subtraction with addition → NO_COVERAGE |
maxNextCharInd = (bufpos -= tokenBegin); |
113 | } | |
114 | } catch (Throwable t) { | |
115 | throw new Error(t.getMessage()); | |
116 | } | |
117 | ||
118 |
1
1. ExpandBuff : Replaced integer addition with subtraction → NO_COVERAGE |
bufsize += 2048; |
119 | available = bufsize; | |
120 | tokenBegin = 0; | |
121 | } | |
122 | ||
123 | protected void FillBuff() throws java.io.IOException { | |
124 |
1
1. FillBuff : negated conditional → NO_COVERAGE |
if (maxNextCharInd == available) { |
125 |
1
1. FillBuff : negated conditional → NO_COVERAGE |
if (available == bufsize) { |
126 |
2
1. FillBuff : changed conditional boundary → NO_COVERAGE 2. FillBuff : negated conditional → NO_COVERAGE |
if (tokenBegin > 2048) { |
127 | bufpos = maxNextCharInd = 0; | |
128 | available = tokenBegin; | |
129 |
2
1. FillBuff : changed conditional boundary → NO_COVERAGE 2. FillBuff : negated conditional → NO_COVERAGE |
} else if (tokenBegin < 0) |
130 | bufpos = maxNextCharInd = 0; | |
131 | else | |
132 |
1
1. FillBuff : removed call to org/graphstream/util/parser/SimpleCharStream::ExpandBuff → NO_COVERAGE |
ExpandBuff(false); |
133 |
2
1. FillBuff : changed conditional boundary → NO_COVERAGE 2. FillBuff : negated conditional → NO_COVERAGE |
} else if (available > tokenBegin) |
134 | available = bufsize; | |
135 |
3
1. FillBuff : changed conditional boundary → NO_COVERAGE 2. FillBuff : Replaced integer subtraction with addition → NO_COVERAGE 3. FillBuff : negated conditional → NO_COVERAGE |
else if ((tokenBegin - available) < 2048) |
136 |
1
1. FillBuff : removed call to org/graphstream/util/parser/SimpleCharStream::ExpandBuff → NO_COVERAGE |
ExpandBuff(true); |
137 | else | |
138 | available = tokenBegin; | |
139 | } | |
140 | ||
141 | int i; | |
142 | try { | |
143 |
1
1. FillBuff : negated conditional → NO_COVERAGE |
if ((i = inputStream.read(buffer, maxNextCharInd, available |
144 |
1
1. FillBuff : Replaced integer subtraction with addition → NO_COVERAGE |
- maxNextCharInd)) == -1) { |
145 |
1
1. FillBuff : removed call to java/io/Reader::close → NO_COVERAGE |
inputStream.close(); |
146 | throw new java.io.IOException(); | |
147 | } else | |
148 |
1
1. FillBuff : Replaced integer addition with subtraction → NO_COVERAGE |
maxNextCharInd += i; |
149 | return; | |
150 | } catch (java.io.IOException e) { | |
151 |
1
1. FillBuff : Replaced integer subtraction with addition → NO_COVERAGE |
--bufpos; |
152 |
1
1. FillBuff : removed call to org/graphstream/util/parser/SimpleCharStream::backup → NO_COVERAGE |
backup(0); |
153 |
1
1. FillBuff : negated conditional → NO_COVERAGE |
if (tokenBegin == -1) |
154 | tokenBegin = bufpos; | |
155 | throw e; | |
156 | } | |
157 | } | |
158 | ||
159 | /** Start. */ | |
160 | public char BeginToken() throws java.io.IOException { | |
161 | tokenBegin = -1; | |
162 | char c = readChar(); | |
163 | tokenBegin = bufpos; | |
164 | ||
165 |
1
1. BeginToken : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return c; |
166 | } | |
167 | ||
168 | protected void UpdateLineColumn(char c) { | |
169 |
1
1. UpdateLineColumn : Replaced integer addition with subtraction → NO_COVERAGE |
column++; |
170 | ||
171 |
1
1. UpdateLineColumn : negated conditional → NO_COVERAGE |
if (prevCharIsLF) { |
172 | prevCharIsLF = false; | |
173 |
1
1. UpdateLineColumn : Replaced integer addition with subtraction → NO_COVERAGE |
line += (column = 1); |
174 |
1
1. UpdateLineColumn : negated conditional → NO_COVERAGE |
} else if (prevCharIsCR) { |
175 | prevCharIsCR = false; | |
176 |
1
1. UpdateLineColumn : negated conditional → NO_COVERAGE |
if (c == '\n') { |
177 | prevCharIsLF = true; | |
178 | } else | |
179 |
1
1. UpdateLineColumn : Replaced integer addition with subtraction → NO_COVERAGE |
line += (column = 1); |
180 | } | |
181 | ||
182 | switch (c) { | |
183 | case '\r': | |
184 | prevCharIsCR = true; | |
185 | break; | |
186 | case '\n': | |
187 | prevCharIsLF = true; | |
188 | break; | |
189 | case '\t': | |
190 |
1
1. UpdateLineColumn : Replaced integer subtraction with addition → NO_COVERAGE |
column--; |
191 |
3
1. UpdateLineColumn : Replaced integer modulus with multiplication → NO_COVERAGE 2. UpdateLineColumn : Replaced integer subtraction with addition → NO_COVERAGE 3. UpdateLineColumn : Replaced integer addition with subtraction → NO_COVERAGE |
column += (tabSize - (column % tabSize)); |
192 | break; | |
193 | default: | |
194 | break; | |
195 | } | |
196 | ||
197 | bufline[bufpos] = line; | |
198 | bufcolumn[bufpos] = column; | |
199 | } | |
200 | ||
201 | /** Read a character. */ | |
202 | public char readChar() throws java.io.IOException { | |
203 |
2
1. readChar : changed conditional boundary → NO_COVERAGE 2. readChar : negated conditional → NO_COVERAGE |
if (inBuf > 0) { |
204 |
1
1. readChar : Replaced integer subtraction with addition → NO_COVERAGE |
--inBuf; |
205 | ||
206 |
2
1. readChar : Replaced integer addition with subtraction → NO_COVERAGE 2. readChar : negated conditional → NO_COVERAGE |
if (++bufpos == bufsize) |
207 | bufpos = 0; | |
208 | ||
209 |
1
1. readChar : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return buffer[bufpos]; |
210 | } | |
211 | ||
212 |
3
1. readChar : changed conditional boundary → NO_COVERAGE 2. readChar : Replaced integer addition with subtraction → NO_COVERAGE 3. readChar : negated conditional → NO_COVERAGE |
if (++bufpos >= maxNextCharInd) |
213 |
1
1. readChar : removed call to org/graphstream/util/parser/SimpleCharStream::FillBuff → NO_COVERAGE |
FillBuff(); |
214 | ||
215 | char c = buffer[bufpos]; | |
216 | ||
217 |
1
1. readChar : removed call to org/graphstream/util/parser/SimpleCharStream::UpdateLineColumn → NO_COVERAGE |
UpdateLineColumn(c); |
218 |
1
1. readChar : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return c; |
219 | } | |
220 | ||
221 | @Deprecated | |
222 | /** | |
223 | * @deprecated | |
224 | * @see #getEndColumn | |
225 | */ | |
226 | public int getColumn() { | |
227 |
1
1. getColumn : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return bufcolumn[bufpos]; |
228 | } | |
229 | ||
230 | @Deprecated | |
231 | /** | |
232 | * @deprecated | |
233 | * @see #getEndLine | |
234 | */ | |
235 | public int getLine() { | |
236 |
1
1. getLine : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return bufline[bufpos]; |
237 | } | |
238 | ||
239 | /** Get token end column number. */ | |
240 | public int getEndColumn() { | |
241 |
1
1. getEndColumn : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return bufcolumn[bufpos]; |
242 | } | |
243 | ||
244 | /** Get token end line number. */ | |
245 | public int getEndLine() { | |
246 |
1
1. getEndLine : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return bufline[bufpos]; |
247 | } | |
248 | ||
249 | /** Get token beginning column number. */ | |
250 | public int getBeginColumn() { | |
251 |
1
1. getBeginColumn : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return bufcolumn[tokenBegin]; |
252 | } | |
253 | ||
254 | /** Get token beginning line number. */ | |
255 | public int getBeginLine() { | |
256 |
1
1. getBeginLine : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return bufline[tokenBegin]; |
257 | } | |
258 | ||
259 | /** Backup a number of characters. */ | |
260 | public void backup(int amount) { | |
261 | ||
262 |
1
1. backup : Replaced integer addition with subtraction → NO_COVERAGE |
inBuf += amount; |
263 |
3
1. backup : changed conditional boundary → NO_COVERAGE 2. backup : Replaced integer subtraction with addition → NO_COVERAGE 3. backup : negated conditional → NO_COVERAGE |
if ((bufpos -= amount) < 0) |
264 |
1
1. backup : Replaced integer addition with subtraction → NO_COVERAGE |
bufpos += bufsize; |
265 | } | |
266 | ||
267 | /** Constructor. */ | |
268 | public SimpleCharStream(java.io.Reader dstream, int startline, | |
269 | int startcolumn, int buffersize) { | |
270 | inputStream = dstream; | |
271 | line = startline; | |
272 |
1
1. |
column = startcolumn - 1; |
273 | ||
274 | available = bufsize = buffersize; | |
275 | buffer = new char[buffersize]; | |
276 | bufline = new int[buffersize]; | |
277 | bufcolumn = new int[buffersize]; | |
278 | } | |
279 | ||
280 | /** Constructor. */ | |
281 | public SimpleCharStream(java.io.Reader dstream, int startline, | |
282 | int startcolumn) { | |
283 | this(dstream, startline, startcolumn, 4096); | |
284 | } | |
285 | ||
286 | /** Constructor. */ | |
287 | public SimpleCharStream(java.io.Reader dstream) { | |
288 | this(dstream, 1, 1, 4096); | |
289 | } | |
290 | ||
291 | /** Reinitialise. */ | |
292 | public void ReInit(java.io.Reader dstream, int startline, int startcolumn, | |
293 | int buffersize) { | |
294 | inputStream = dstream; | |
295 | line = startline; | |
296 |
1
1. ReInit : Replaced integer subtraction with addition → NO_COVERAGE |
column = startcolumn - 1; |
297 | ||
298 |
2
1. ReInit : negated conditional → NO_COVERAGE 2. ReInit : negated conditional → NO_COVERAGE |
if (buffer == null || buffersize != buffer.length) { |
299 | available = bufsize = buffersize; | |
300 | buffer = new char[buffersize]; | |
301 | bufline = new int[buffersize]; | |
302 | bufcolumn = new int[buffersize]; | |
303 | } | |
304 | prevCharIsLF = prevCharIsCR = false; | |
305 | tokenBegin = inBuf = maxNextCharInd = 0; | |
306 | bufpos = -1; | |
307 | } | |
308 | ||
309 | /** Reinitialise. */ | |
310 | public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { | |
311 |
1
1. ReInit : removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE |
ReInit(dstream, startline, startcolumn, 4096); |
312 | } | |
313 | ||
314 | /** Reinitialise. */ | |
315 | public void ReInit(java.io.Reader dstream) { | |
316 |
1
1. ReInit : removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE |
ReInit(dstream, 1, 1, 4096); |
317 | } | |
318 | ||
319 | /** Constructor. */ | |
320 | public SimpleCharStream(java.io.InputStream dstream, String encoding, | |
321 | int startline, int startcolumn, int buffersize) | |
322 | throws java.io.UnsupportedEncodingException { | |
323 |
1
1. |
this(encoding == null ? new java.io.InputStreamReader(dstream) |
324 | : new java.io.InputStreamReader(dstream, encoding), startline, | |
325 | startcolumn, buffersize); | |
326 | } | |
327 | ||
328 | /** Constructor. */ | |
329 | public SimpleCharStream(java.io.InputStream dstream, int startline, | |
330 | int startcolumn, int buffersize) { | |
331 | this(new java.io.InputStreamReader(dstream), startline, startcolumn, | |
332 | buffersize); | |
333 | } | |
334 | ||
335 | /** Constructor. */ | |
336 | public SimpleCharStream(java.io.InputStream dstream, String encoding, | |
337 | int startline, int startcolumn) | |
338 | throws java.io.UnsupportedEncodingException { | |
339 | this(dstream, encoding, startline, startcolumn, 4096); | |
340 | } | |
341 | ||
342 | /** Constructor. */ | |
343 | public SimpleCharStream(java.io.InputStream dstream, int startline, | |
344 | int startcolumn) { | |
345 | this(dstream, startline, startcolumn, 4096); | |
346 | } | |
347 | ||
348 | /** Constructor. */ | |
349 | public SimpleCharStream(java.io.InputStream dstream, String encoding) | |
350 | throws java.io.UnsupportedEncodingException { | |
351 | this(dstream, encoding, 1, 1, 4096); | |
352 | } | |
353 | ||
354 | /** Constructor. */ | |
355 | public SimpleCharStream(java.io.InputStream dstream) { | |
356 | this(dstream, 1, 1, 4096); | |
357 | } | |
358 | ||
359 | /** Reinitialise. */ | |
360 | public void ReInit(java.io.InputStream dstream, String encoding, | |
361 | int startline, int startcolumn, int buffersize) | |
362 | throws java.io.UnsupportedEncodingException { | |
363 |
2
1. ReInit : negated conditional → NO_COVERAGE 2. ReInit : removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE |
ReInit(encoding == null ? new java.io.InputStreamReader(dstream) |
364 | : new java.io.InputStreamReader(dstream, encoding), startline, | |
365 | startcolumn, buffersize); | |
366 | } | |
367 | ||
368 | /** Reinitialise. */ | |
369 | public void ReInit(java.io.InputStream dstream, int startline, | |
370 | int startcolumn, int buffersize) { | |
371 |
1
1. ReInit : removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE |
ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, |
372 | buffersize); | |
373 | } | |
374 | ||
375 | /** Reinitialise. */ | |
376 | public void ReInit(java.io.InputStream dstream, String encoding) | |
377 | throws java.io.UnsupportedEncodingException { | |
378 |
1
1. ReInit : removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE |
ReInit(dstream, encoding, 1, 1, 4096); |
379 | } | |
380 | ||
381 | /** Reinitialise. */ | |
382 | public void ReInit(java.io.InputStream dstream) { | |
383 |
1
1. ReInit : removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE |
ReInit(dstream, 1, 1, 4096); |
384 | } | |
385 | ||
386 | /** Reinitialise. */ | |
387 | public void ReInit(java.io.InputStream dstream, String encoding, | |
388 | int startline, int startcolumn) | |
389 | throws java.io.UnsupportedEncodingException { | |
390 |
1
1. ReInit : removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE |
ReInit(dstream, encoding, startline, startcolumn, 4096); |
391 | } | |
392 | ||
393 | /** Reinitialise. */ | |
394 | public void ReInit(java.io.InputStream dstream, int startline, | |
395 | int startcolumn) { | |
396 |
1
1. ReInit : removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE |
ReInit(dstream, startline, startcolumn, 4096); |
397 | } | |
398 | ||
399 | /** Get token literal value. */ | |
400 | public String GetImage() { | |
401 |
2
1. GetImage : changed conditional boundary → NO_COVERAGE 2. GetImage : negated conditional → NO_COVERAGE |
if (bufpos >= tokenBegin) |
402 |
3
1. GetImage : Replaced integer subtraction with addition → NO_COVERAGE 2. GetImage : Replaced integer addition with subtraction → NO_COVERAGE 3. GetImage : mutated return of Object value for org/graphstream/util/parser/SimpleCharStream::GetImage to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); |
403 | else | |
404 |
2
1. GetImage : Replaced integer subtraction with addition → NO_COVERAGE 2. GetImage : mutated return of Object value for org/graphstream/util/parser/SimpleCharStream::GetImage to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new String(buffer, tokenBegin, bufsize - tokenBegin) |
405 |
1
1. GetImage : Replaced integer addition with subtraction → NO_COVERAGE |
+ new String(buffer, 0, bufpos + 1); |
406 | } | |
407 | ||
408 | /** Get the suffix. */ | |
409 | public char[] GetSuffix(int len) { | |
410 | char[] ret = new char[len]; | |
411 | ||
412 |
3
1. GetSuffix : changed conditional boundary → NO_COVERAGE 2. GetSuffix : Replaced integer addition with subtraction → NO_COVERAGE 3. GetSuffix : negated conditional → NO_COVERAGE |
if ((bufpos + 1) >= len) |
413 |
3
1. GetSuffix : Replaced integer subtraction with addition → NO_COVERAGE 2. GetSuffix : Replaced integer addition with subtraction → NO_COVERAGE 3. GetSuffix : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); |
414 | else { | |
415 |
4
1. GetSuffix : Replaced integer subtraction with addition → NO_COVERAGE 2. GetSuffix : Replaced integer subtraction with addition → NO_COVERAGE 3. GetSuffix : Replaced integer subtraction with addition → NO_COVERAGE 4. GetSuffix : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len |
416 |
2
1. GetSuffix : Replaced integer subtraction with addition → NO_COVERAGE 2. GetSuffix : Replaced integer subtraction with addition → NO_COVERAGE |
- bufpos - 1); |
417 |
4
1. GetSuffix : Replaced integer subtraction with addition → NO_COVERAGE 2. GetSuffix : Replaced integer subtraction with addition → NO_COVERAGE 3. GetSuffix : Replaced integer addition with subtraction → NO_COVERAGE 4. GetSuffix : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); |
418 | } | |
419 | ||
420 |
1
1. GetSuffix : mutated return of Object value for org/graphstream/util/parser/SimpleCharStream::GetSuffix to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return ret; |
421 | } | |
422 | ||
423 | /** Reset buffer when finished. */ | |
424 | public void Done() { | |
425 | buffer = null; | |
426 | bufline = null; | |
427 | bufcolumn = null; | |
428 | } | |
429 | | |
430 | public void close() throws IOException { | |
431 |
1
1. close : removed call to java/io/Reader::close → NO_COVERAGE |
inputStream.close(); |
432 | } | |
433 | ||
434 | /** | |
435 | * Method to adjust line and column numbers for the start of a token. | |
436 | */ | |
437 | public void adjustBeginLineColumn(int newLine, int newCol) { | |
438 | int start = tokenBegin; | |
439 | int len; | |
440 | ||
441 |
2
1. adjustBeginLineColumn : changed conditional boundary → NO_COVERAGE 2. adjustBeginLineColumn : negated conditional → NO_COVERAGE |
if (bufpos >= tokenBegin) { |
442 |
3
1. adjustBeginLineColumn : Replaced integer subtraction with addition → NO_COVERAGE 2. adjustBeginLineColumn : Replaced integer addition with subtraction → NO_COVERAGE 3. adjustBeginLineColumn : Replaced integer addition with subtraction → NO_COVERAGE |
len = bufpos - tokenBegin + inBuf + 1; |
443 | } else { | |
444 |
4
1. adjustBeginLineColumn : Replaced integer subtraction with addition → NO_COVERAGE 2. adjustBeginLineColumn : Replaced integer addition with subtraction → NO_COVERAGE 3. adjustBeginLineColumn : Replaced integer addition with subtraction → NO_COVERAGE 4. adjustBeginLineColumn : Replaced integer addition with subtraction → NO_COVERAGE |
len = bufsize - tokenBegin + bufpos + 1 + inBuf; |
445 | } | |
446 | ||
447 | int i = 0, j = 0, k = 0; | |
448 | int nextColDiff = 0, columnDiff = 0; | |
449 | ||
450 |
2
1. adjustBeginLineColumn : changed conditional boundary → NO_COVERAGE 2. adjustBeginLineColumn : negated conditional → NO_COVERAGE |
while (i < len |
451 |
3
1. adjustBeginLineColumn : Changed increment from 1 to -1 → NO_COVERAGE 2. adjustBeginLineColumn : Replaced integer modulus with multiplication → NO_COVERAGE 3. adjustBeginLineColumn : negated conditional → NO_COVERAGE |
&& bufline[j = start % bufsize] == bufline[k = ++start |
452 |
1
1. adjustBeginLineColumn : Replaced integer modulus with multiplication → NO_COVERAGE |
% bufsize]) { |
453 | bufline[j] = newLine; | |
454 |
2
1. adjustBeginLineColumn : Replaced integer addition with subtraction → NO_COVERAGE 2. adjustBeginLineColumn : Replaced integer subtraction with addition → NO_COVERAGE |
nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; |
455 |
1
1. adjustBeginLineColumn : Replaced integer addition with subtraction → NO_COVERAGE |
bufcolumn[j] = newCol + columnDiff; |
456 | columnDiff = nextColDiff; | |
457 |
1
1. adjustBeginLineColumn : Changed increment from 1 to -1 → NO_COVERAGE |
i++; |
458 | } | |
459 | ||
460 |
2
1. adjustBeginLineColumn : changed conditional boundary → NO_COVERAGE 2. adjustBeginLineColumn : negated conditional → NO_COVERAGE |
if (i < len) { |
461 |
1
1. adjustBeginLineColumn : Changed increment from 1 to -1 → NO_COVERAGE |
bufline[j] = newLine++; |
462 |
1
1. adjustBeginLineColumn : Replaced integer addition with subtraction → NO_COVERAGE |
bufcolumn[j] = newCol + columnDiff; |
463 | ||
464 |
3
1. adjustBeginLineColumn : changed conditional boundary → NO_COVERAGE 2. adjustBeginLineColumn : Changed increment from 1 to -1 → NO_COVERAGE 3. adjustBeginLineColumn : negated conditional → NO_COVERAGE |
while (i++ < len) { |
465 |
4
1. adjustBeginLineColumn : Changed increment from 1 to -1 → NO_COVERAGE 2. adjustBeginLineColumn : Replaced integer modulus with multiplication → NO_COVERAGE 3. adjustBeginLineColumn : Replaced integer modulus with multiplication → NO_COVERAGE 4. adjustBeginLineColumn : negated conditional → NO_COVERAGE |
if (bufline[j = start % bufsize] != bufline[++start % bufsize]) |
466 |
1
1. adjustBeginLineColumn : Changed increment from 1 to -1 → NO_COVERAGE |
bufline[j] = newLine++; |
467 | else | |
468 | bufline[j] = newLine; | |
469 | } | |
470 | } | |
471 | ||
472 | line = bufline[j]; | |
473 | column = bufcolumn[j]; | |
474 | } | |
475 | ||
476 | } | |
477 | /* | |
478 | * JavaCC - OriginalChecksum=1b2e56df2b0de8bccc6f8ba3056859fb (do not edit this | |
479 | * line) | |
480 | */ | |
Mutations | ||
70 |
1.1 |
|
74 |
1.1 |
|
75 |
1.1 |
|
76 |
1.1 |
|
79 |
1.1 |
|
80 |
1.1 |
|
81 |
1.1 |
|
82 |
1.1 2.2 |
|
86 |
1.1 |
|
87 |
1.1 |
|
88 |
1.1 2.2 |
|
92 |
1.1 |
|
93 |
1.1 |
|
94 |
1.1 |
|
95 |
1.1 |
|
98 |
1.1 2.2 |
|
100 |
1.1 |
|
101 |
1.1 |
|
104 |
1.1 |
|
105 |
1.1 |
|
108 |
1.1 |
|
109 |
1.1 |
|
112 |
1.1 |
|
118 |
1.1 |
|
124 |
1.1 |
|
125 |
1.1 |
|
126 |
1.1 2.2 |
|
129 |
1.1 2.2 |
|
132 |
1.1 |
|
133 |
1.1 2.2 |
|
135 |
1.1 2.2 3.3 |
|
136 |
1.1 |
|
143 |
1.1 |
|
144 |
1.1 |
|
145 |
1.1 |
|
148 |
1.1 |
|
151 |
1.1 |
|
152 |
1.1 |
|
153 |
1.1 |
|
165 |
1.1 |
|
169 |
1.1 |
|
171 |
1.1 |
|
173 |
1.1 |
|
174 |
1.1 |
|
176 |
1.1 |
|
179 |
1.1 |
|
190 |
1.1 |
|
191 |
1.1 2.2 3.3 |
|
203 |
1.1 2.2 |
|
204 |
1.1 |
|
206 |
1.1 2.2 |
|
209 |
1.1 |
|
212 |
1.1 2.2 3.3 |
|
213 |
1.1 |
|
217 |
1.1 |
|
218 |
1.1 |
|
227 |
1.1 |
|
236 |
1.1 |
|
241 |
1.1 |
|
246 |
1.1 |
|
251 |
1.1 |
|
256 |
1.1 |
|
262 |
1.1 |
|
263 |
1.1 2.2 3.3 |
|
264 |
1.1 |
|
272 |
1.1 |
|
296 |
1.1 |
|
298 |
1.1 2.2 |
|
311 |
1.1 |
|
316 |
1.1 |
|
323 |
1.1 |
|
363 |
1.1 2.2 |
|
371 |
1.1 |
|
378 |
1.1 |
|
383 |
1.1 |
|
390 |
1.1 |
|
396 |
1.1 |
|
401 |
1.1 2.2 |
|
402 |
1.1 2.2 3.3 |
|
404 |
1.1 2.2 |
|
405 |
1.1 |
|
412 |
1.1 2.2 3.3 |
|
413 |
1.1 2.2 3.3 |
|
415 |
1.1 2.2 3.3 4.4 |
|
416 |
1.1 2.2 |
|
417 |
1.1 2.2 3.3 4.4 |
|
420 |
1.1 |
|
431 |
1.1 |
|
441 |
1.1 2.2 |
|
442 |
1.1 2.2 3.3 |
|
444 |
1.1 2.2 3.3 4.4 |
|
450 |
1.1 2.2 |
|
451 |
1.1 2.2 3.3 |
|
452 |
1.1 |
|
454 |
1.1 2.2 |
|
455 |
1.1 |
|
457 |
1.1 |
|
460 |
1.1 2.2 |
|
461 |
1.1 |
|
462 |
1.1 |
|
464 |
1.1 2.2 3.3 |
|
465 |
1.1 2.2 3.3 4.4 |
|
466 |
1.1 |