reg.setPattern("^Line1"); assertTrue("^Line1 in default mode", reg.matches(text)); assertTrue("^Line1 in single line mode", reg.matches(text, RegexpMatcher.MATCH_SINGLELINE)); assertTrue("^Line1 in multi line mode", reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
reg.setPattern("endtest$"); assertTrue("endtest$ in default mode", !reg.matches(text)); assertTrue("endtest$ in single line mode", !reg.matches(text, RegexpMatcher.MATCH_SINGLELINE)); assertTrue("endtest$ in multi line mode", reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
Method name: void doStartTest2(String) Method name: void doEndTest1(String)
Number of AST nodes: 4 Number of AST nodes: 4
1
reg.setPattern("^Line1");
1
reg.setPattern("endtest$");
2
        assertTrue("^Line1 in default mode", reg.matches(text));
2
        assertTrue("endtest$ in default mode", !reg.matches(text));
3
        assertTrue("^Line1 in single line mode",
3
        assertTrue("endtest$ in single line mode",
4
               reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
4
               !reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
5
        assertTrue("^Line1 in multi line mode",
5
        assertTrue("endtest$ in multi line mode",
6
               reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
6
               reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
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)0.0
Clones locationClones are declared in the same class
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    reg.setPattern("^Line1");
    1
    reg.setPattern("^Line1");
    1
    reg.setPattern("endtest$");
    Differences
    Expression1Expression2Difference
    "^Line1""endtest$"LITERAL_VALUE_MISMATCH
    1
    reg.setPattern("endtest$");
    2
    assertTrue("^Line1 in default mode", reg.matches(text));
    2
    assertTrue("^Line1 in default mode", reg.matches(text));
    2
    assertTrue("endtest$ in default mode", !reg.matches(text));
    Differences
    Expression1Expression2Difference
    "^Line1 in default mode""endtest$ in default mode"LITERAL_VALUE_MISMATCH
    reg.matches(text)!reg.matches(text)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression reg.matches(text) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression !reg.matches(text) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    assertTrue("endtest$ in default mode", !reg.matches(text));
    3
    assertTrue("^Line1 in single line mode", reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
    3
    assertTrue("^Line1 in single line mode", reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
    3
    assertTrue("endtest$ in single line mode", !reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
    Differences
    Expression1Expression2Difference
    "^Line1 in single line mode""endtest$ in single line mode"LITERAL_VALUE_MISMATCH
    reg.matches(text,RegexpMatcher.MATCH_SINGLELINE)!reg.matches(text,RegexpMatcher.MATCH_SINGLELINE)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression reg.matches(text,RegexpMatcher.MATCH_SINGLELINE) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression !reg.matches(text,RegexpMatcher.MATCH_SINGLELINE) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    assertTrue("endtest$ in single line mode", !reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
    4
    assertTrue("^Line1 in multi line mode", reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
    4
    assertTrue("^Line1 in multi line mode", reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
    4
    assertTrue("endtest$ in multi line mode", reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
    Differences
    Expression1Expression2Difference
    "^Line1 in multi line mode""endtest$ in multi line mode"LITERAL_VALUE_MISMATCH
    4
    assertTrue("endtest$ in multi line mode", reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
    Precondition Violations (4)
    Row Violation
    1Expression reg.matches(text) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression !reg.matches(text) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression reg.matches(text,RegexpMatcher.MATCH_SINGLELINE) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression !reg.matches(text,RegexpMatcher.MATCH_SINGLELINE) cannot be parameterized, because it has dependencies to/from statements that will be extracted