SimpleCharStream.java

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. : Replaced integer subtraction with addition → NO_COVERAGE
		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. : negated conditional → NO_COVERAGE
		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
Location : getTabSize
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

74

1.1
Location : ExpandBuff
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

75

1.1
Location : ExpandBuff
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

76

1.1
Location : ExpandBuff
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

79

1.1
Location : ExpandBuff
Killed by : none
negated conditional → NO_COVERAGE

80

1.1
Location : ExpandBuff
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

81

1.1
Location : ExpandBuff
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

82

1.1
Location : ExpandBuff
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : ExpandBuff
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

86

1.1
Location : ExpandBuff
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

87

1.1
Location : ExpandBuff
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

88

1.1
Location : ExpandBuff
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : ExpandBuff
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

92

1.1
Location : ExpandBuff
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

93

1.1
Location : ExpandBuff
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

94

1.1
Location : ExpandBuff
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

95

1.1
Location : ExpandBuff
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

98

1.1
Location : ExpandBuff
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : ExpandBuff
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

100

1.1
Location : ExpandBuff
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

101

1.1
Location : ExpandBuff
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

104

1.1
Location : ExpandBuff
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

105

1.1
Location : ExpandBuff
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

108

1.1
Location : ExpandBuff
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

109

1.1
Location : ExpandBuff
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

112

1.1
Location : ExpandBuff
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

118

1.1
Location : ExpandBuff
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

124

1.1
Location : FillBuff
Killed by : none
negated conditional → NO_COVERAGE

125

1.1
Location : FillBuff
Killed by : none
negated conditional → NO_COVERAGE

126

1.1
Location : FillBuff
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : FillBuff
Killed by : none
negated conditional → NO_COVERAGE

129

1.1
Location : FillBuff
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : FillBuff
Killed by : none
negated conditional → NO_COVERAGE

132

1.1
Location : FillBuff
Killed by : none
removed call to org/graphstream/util/parser/SimpleCharStream::ExpandBuff → NO_COVERAGE

133

1.1
Location : FillBuff
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : FillBuff
Killed by : none
negated conditional → NO_COVERAGE

135

1.1
Location : FillBuff
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : FillBuff
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

3.3
Location : FillBuff
Killed by : none
negated conditional → NO_COVERAGE

136

1.1
Location : FillBuff
Killed by : none
removed call to org/graphstream/util/parser/SimpleCharStream::ExpandBuff → NO_COVERAGE

143

1.1
Location : FillBuff
Killed by : none
negated conditional → NO_COVERAGE

144

1.1
Location : FillBuff
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

145

1.1
Location : FillBuff
Killed by : none
removed call to java/io/Reader::close → NO_COVERAGE

148

1.1
Location : FillBuff
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

151

1.1
Location : FillBuff
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

152

1.1
Location : FillBuff
Killed by : none
removed call to org/graphstream/util/parser/SimpleCharStream::backup → NO_COVERAGE

153

1.1
Location : FillBuff
Killed by : none
negated conditional → NO_COVERAGE

165

1.1
Location : BeginToken
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

169

1.1
Location : UpdateLineColumn
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

171

1.1
Location : UpdateLineColumn
Killed by : none
negated conditional → NO_COVERAGE

173

1.1
Location : UpdateLineColumn
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

174

1.1
Location : UpdateLineColumn
Killed by : none
negated conditional → NO_COVERAGE

176

1.1
Location : UpdateLineColumn
Killed by : none
negated conditional → NO_COVERAGE

179

1.1
Location : UpdateLineColumn
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

190

1.1
Location : UpdateLineColumn
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

191

1.1
Location : UpdateLineColumn
Killed by : none
Replaced integer modulus with multiplication → NO_COVERAGE

2.2
Location : UpdateLineColumn
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

3.3
Location : UpdateLineColumn
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

203

1.1
Location : readChar
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : readChar
Killed by : none
negated conditional → NO_COVERAGE

204

1.1
Location : readChar
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

206

1.1
Location : readChar
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : readChar
Killed by : none
negated conditional → NO_COVERAGE

209

1.1
Location : readChar
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

212

1.1
Location : readChar
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : readChar
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : readChar
Killed by : none
negated conditional → NO_COVERAGE

213

1.1
Location : readChar
Killed by : none
removed call to org/graphstream/util/parser/SimpleCharStream::FillBuff → NO_COVERAGE

217

1.1
Location : readChar
Killed by : none
removed call to org/graphstream/util/parser/SimpleCharStream::UpdateLineColumn → NO_COVERAGE

218

1.1
Location : readChar
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

227

1.1
Location : getColumn
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

236

1.1
Location : getLine
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

241

1.1
Location : getEndColumn
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

246

1.1
Location : getEndLine
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

251

1.1
Location : getBeginColumn
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

256

1.1
Location : getBeginLine
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

262

1.1
Location : backup
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

263

1.1
Location : backup
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : backup
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

3.3
Location : backup
Killed by : none
negated conditional → NO_COVERAGE

264

1.1
Location : backup
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

272

1.1
Location :
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

296

1.1
Location : ReInit
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

298

1.1
Location : ReInit
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : ReInit
Killed by : none
negated conditional → NO_COVERAGE

311

1.1
Location : ReInit
Killed by : none
removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE

316

1.1
Location : ReInit
Killed by : none
removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE

323

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

363

1.1
Location : ReInit
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : ReInit
Killed by : none
removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE

371

1.1
Location : ReInit
Killed by : none
removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE

378

1.1
Location : ReInit
Killed by : none
removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE

383

1.1
Location : ReInit
Killed by : none
removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE

390

1.1
Location : ReInit
Killed by : none
removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE

396

1.1
Location : ReInit
Killed by : none
removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE

401

1.1
Location : GetImage
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : GetImage
Killed by : none
negated conditional → NO_COVERAGE

402

1.1
Location : GetImage
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : GetImage
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : GetImage
Killed by : none
mutated return of Object value for org/graphstream/util/parser/SimpleCharStream::GetImage to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

404

1.1
Location : GetImage
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : GetImage
Killed by : none
mutated return of Object value for org/graphstream/util/parser/SimpleCharStream::GetImage to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

405

1.1
Location : GetImage
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

412

1.1
Location : GetSuffix
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : GetSuffix
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : GetSuffix
Killed by : none
negated conditional → NO_COVERAGE

413

1.1
Location : GetSuffix
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : GetSuffix
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : GetSuffix
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

415

1.1
Location : GetSuffix
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : GetSuffix
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

3.3
Location : GetSuffix
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

4.4
Location : GetSuffix
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

416

1.1
Location : GetSuffix
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : GetSuffix
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

417

1.1
Location : GetSuffix
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : GetSuffix
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

3.3
Location : GetSuffix
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

4.4
Location : GetSuffix
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

420

1.1
Location : GetSuffix
Killed by : none
mutated return of Object value for org/graphstream/util/parser/SimpleCharStream::GetSuffix to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

431

1.1
Location : close
Killed by : none
removed call to java/io/Reader::close → NO_COVERAGE

441

1.1
Location : adjustBeginLineColumn
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : adjustBeginLineColumn
Killed by : none
negated conditional → NO_COVERAGE

442

1.1
Location : adjustBeginLineColumn
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : adjustBeginLineColumn
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : adjustBeginLineColumn
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

444

1.1
Location : adjustBeginLineColumn
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : adjustBeginLineColumn
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : adjustBeginLineColumn
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

4.4
Location : adjustBeginLineColumn
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

450

1.1
Location : adjustBeginLineColumn
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : adjustBeginLineColumn
Killed by : none
negated conditional → NO_COVERAGE

451

1.1
Location : adjustBeginLineColumn
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

2.2
Location : adjustBeginLineColumn
Killed by : none
Replaced integer modulus with multiplication → NO_COVERAGE

3.3
Location : adjustBeginLineColumn
Killed by : none
negated conditional → NO_COVERAGE

452

1.1
Location : adjustBeginLineColumn
Killed by : none
Replaced integer modulus with multiplication → NO_COVERAGE

454

1.1
Location : adjustBeginLineColumn
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : adjustBeginLineColumn
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

455

1.1
Location : adjustBeginLineColumn
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

457

1.1
Location : adjustBeginLineColumn
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

460

1.1
Location : adjustBeginLineColumn
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : adjustBeginLineColumn
Killed by : none
negated conditional → NO_COVERAGE

461

1.1
Location : adjustBeginLineColumn
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

462

1.1
Location : adjustBeginLineColumn
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

464

1.1
Location : adjustBeginLineColumn
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : adjustBeginLineColumn
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

3.3
Location : adjustBeginLineColumn
Killed by : none
negated conditional → NO_COVERAGE

465

1.1
Location : adjustBeginLineColumn
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

2.2
Location : adjustBeginLineColumn
Killed by : none
Replaced integer modulus with multiplication → NO_COVERAGE

3.3
Location : adjustBeginLineColumn
Killed by : none
Replaced integer modulus with multiplication → NO_COVERAGE

4.4
Location : adjustBeginLineColumn
Killed by : none
negated conditional → NO_COVERAGE

466

1.1
Location : adjustBeginLineColumn
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 0.33