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) { } }
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; }
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: char charAt(int) Method name: char charAt(int)
Number of AST nodes: 19 Number of AST nodes: 19
1
if (index >= end) {
1
if (index >= end) {
2
	    return OUT_OF_BOUNDS;
2
	    return OUT_OF_BOUNDS;
3
	} else if (index == -1) {
3
	
4
	    return lookBehind[0];
5
	} else if (index == -2) {
6
	    return lookBehind[1];
7
	} else if (index < -2) {
8
	    return OUT_OF_BOUNDS;
9
	} else if (index >= bufsize) {
4
} else if (index >= bufsize) {
10
	    // Allocate more space in the buffer.
5
	    // Allocate more space in the buffer.
11
	    try {
6
	    try {
12
		while (bufsize <= index) bufsize += BUFFER_INCREMENT;
7
		while (bufsize <= index) bufsize += BUFFER_INCREMENT;
13
		br.reset();
8
		br.reset();
14
		br.mark(bufsize);
9
		br.mark(bufsize);
15
		br.skip(index-1);
10
		br.skip(index-1);
16
	    } catch (IOException e) { }
11
	    } catch (IOException e) { }
17
	} else if (this.index != index) {
12
	} else if (this.index != index) {
18
	    try {
13
	    try {
19
		br.reset();
14
		br.reset();
20
		br.skip(index-1);
15
		br.skip(index-1);
21
	    } catch (IOException e) { }
16
	    } catch (IOException e) { }
22
	}
17
	} else if (index == -1) {
18
	    return lookBehind[0];
19
	} else if (index == -2) {
20
	    return lookBehind[1];
21
	} else if (index < -2) {
22
	    return OUT_OF_BOUNDS;
23
	}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)2.8
Clones locationClones are in different classes
Number of node comparisons95
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements19
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    else if (index >= end)
    3
    else if (index >= end)
    4
    return OUT_OF_BOUNDS;
    4
    return OUT_OF_BOUNDS;
    5
    else if (index == -1)
    16
    else if (index == -1)
    6
    return lookBehind[0];
    17
    return lookBehind[0];
    7
    else if (index == -2)
    18
    else if (index == -2)
    8
    return lookBehind[1];
    19
    return lookBehind[1];
    9
    else if (index < -2)
    20
    else if (index < -2)
    10
    return OUT_OF_BOUNDS;
    21
    return OUT_OF_BOUNDS;
    11
    else if (index >= bufsize)
    5
    else if (index >= bufsize)
    12
    try
    6
    try
    13
    while (bufsize <= index)
    7
    while (bufsize <= index)
    14
    bufsize += BUFFER_INCREMENT;
    8
    bufsize += BUFFER_INCREMENT;
    15
    br.reset();
    15
    br.reset();
    9
    br.reset();
    Differences
    Expression1Expression2Difference
    java.io.BufferedInputStreamjava.io.BufferedReaderVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.BufferedInputStream of variable br does not match with type java.io.BufferedReader of variable br
    • Make classes java.io.BufferedInputStream and java.io.BufferedReader extend a common superclass
    9
    br.reset();
    16
    br.mark(bufsize);
    16
    br.mark(bufsize);
    10
    br.mark(bufsize);
    Differences
    Expression1Expression2Difference
    java.io.BufferedInputStreamjava.io.BufferedReaderVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.BufferedInputStream of variable br does not match with type java.io.BufferedReader of variable br
    • Make classes java.io.BufferedInputStream and java.io.BufferedReader extend a common superclass
    10
    br.mark(bufsize);
    17
    br.skip(index - 1);
    17
    br.skip(index - 1);
    11
    br.skip(index - 1);
    Differences
    Expression1Expression2Difference
    java.io.BufferedInputStreamjava.io.BufferedReaderVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.BufferedInputStream of variable br does not match with type java.io.BufferedReader of variable br
    • Make classes java.io.BufferedInputStream and java.io.BufferedReader extend a common superclass
    11
    br.skip(index - 1);
    18
    else if (this.index != index)
    12
    else if (this.index != index)
    19
    try
    13
    try
    20
    br.reset();
    20
    br.reset();
    14
    br.reset();
    Differences
    Expression1Expression2Difference
    java.io.BufferedInputStreamjava.io.BufferedReaderVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.BufferedInputStream of variable br does not match with type java.io.BufferedReader of variable br
    • Make classes java.io.BufferedInputStream and java.io.BufferedReader extend a common superclass
    14
    br.reset();
    21
    br.skip(index - 1);
    21
    br.skip(index - 1);
    15
    br.skip(index - 1);
    Differences
    Expression1Expression2Difference
    java.io.BufferedInputStreamjava.io.BufferedReaderVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.BufferedInputStream of variable br does not match with type java.io.BufferedReader of variable br
    • Make classes java.io.BufferedInputStream and java.io.BufferedReader extend a common superclass
    15
    br.skip(index - 1);
    Precondition Violations (5)
    Row Violation
    1Type java.io.BufferedInputStream of variable br does not match with type java.io.BufferedReader of variable br
    2Type java.io.BufferedInputStream of variable br does not match with type java.io.BufferedReader of variable br
    3Type java.io.BufferedInputStream of variable br does not match with type java.io.BufferedReader of variable br
    4Type java.io.BufferedInputStream of variable br does not match with type java.io.BufferedReader of variable br
    5Type java.io.BufferedInputStream of variable br does not match with type java.io.BufferedReader of variable br