public char charAt(int index) { if (index == 0) { return cached; } else if (index >= end) { return OUT_OF_BOUNDS; } else if (index == -1) { return lookBehind[0]; } else if (index == -2) { return lookBehind[1]; } else if (index < -2) { return OUT_OF_BOUNDS; } else if (index >= bufsize) { // Allocate more space in the buffer. try { while (bufsize <= index) bufsize += BUFFER_INCREMENT; br.reset(); br.mark(bufsize); br.skip(index-1); } catch (IOException e) { } } else if (this.index != index) { try { br.reset(); br.skip(index-1); } catch (IOException e) { } } char ch = OUT_OF_BOUNDS; try { int i = br.read(); this.index = index+1; // this.index is index of next pos relative to charAt(0) if (i == -1) { // set flag that next should fail next time? end = index; return ch; } ch = (char) i; } catch (IOException ie) { } return ch;
public char charAt(int index) { if (index == 0) { return cached; } else if (index >= end) { return OUT_OF_BOUNDS; } else if (index >= bufsize) { // Allocate more space in the buffer. try { while (bufsize <= index) bufsize += BUFFER_INCREMENT; br.reset(); br.mark(bufsize); br.skip(index-1); } catch (IOException e) { } } else if (this.index != index) { try { br.reset(); br.skip(index-1); } catch (IOException e) { } } else if (index == -1) { return lookBehind[0]; } else if (index == -2) { return lookBehind[1]; } else if (index < -2) { return OUT_OF_BOUNDS; } char ch = OUT_OF_BOUNDS; try { int i = br.read(); this.index = index+1; // this.index is index of next pos relative to charAt(0) if (i == -1) { // set flag that next should fail next time? end = index; return ch; } ch = (char) i; } catch (IOException ie) { } return ch;
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/gnu/regexp/CharIndexedInputStream.java File path: /jEdit-4.2/src/gnu/regexp/CharIndexedReader.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public char charAt(int index) {
1
public char charAt(int index) {
2
	if (index == 0) {
2
	if (index == 0) {
3
	    return cached;
3
	    return cached;
4
	} else if (index >= end) {
4
	} else if (index >= end) {
5
	    return OUT_OF_BOUNDS;
5
	    return OUT_OF_BOUNDS;
6
	} else if (index == -1) {
6
	
7
	    return lookBehind[0];
8
	} else if (index == -2) {
9
	    return lookBehind[1];
10
	} else if (index < -2) {
11
	    return OUT_OF_BOUNDS;
12
	} else if (index >= bufsize) {
7
} else if (index >= bufsize) {
13
	    // Allocate more space in the buffer.
8
	    // Allocate more space in the buffer.
14
	    try {
9
	    try {
15
		while (bufsize <= index) bufsize += BUFFER_INCREMENT;
10
		while (bufsize <= index) bufsize += BUFFER_INCREMENT;
16
		br.reset();
11
		br.reset();
17
		br.mark(bufsize);
12
		br.mark(bufsize);
18
		br.skip(index-1);
13
		br.skip(index-1);
19
	    } catch (IOException e) { }
14
	    } catch (IOException e) { }
20
	} else if (this.index != index) {
15
	} else if (this.index != index) {
21
	    try {
16
	    try {
22
		br.reset();
17
		br.reset();
23
		br.skip(index-1);
18
		br.skip(index-1);
24
	    } catch (IOException e) { }
19
	    } catch (IOException e) { }
25
	}
20
	} else if (index == -1) {
21
	    return lookBehind[0];
22
	} else if (index == -2) {
23
	    return lookBehind[1];
24
	} else if (index < -2) {
25
	    return OUT_OF_BOUNDS;
26
	}
26
	char ch = OUT_OF_BOUNDS;
27
	char ch = OUT_OF_BOUNDS;
27
	
28
	
28
	try {
29
	try {
29
	    int i = br.read();
30
	    int i = br.read();
30
	    this.index = index+1; // this.index is index of next pos relative to charAt(0)
31
	    this.index = index+1; // this.index is index of next pos relative to charAt(0)
31
	    if (i == -1) {
32
	    if (i == -1) {
32
		// set flag that next should fail next time?
33
		// set flag that next should fail next time?
33
		end = index;
34
		end = index;
34
		return ch;
35
		return ch;
35
	    }
36
	    }
36
	    ch = (char) i;
37
	    ch = (char) i;
37
	} catch (IOException ie) { }
38
	} catch (IOException ie) { }
38
	
39
	
39
	return ch;
40
	return ch;
40
    
41
    
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0