commandLine = new Commandline(); // If we find a "file" attribute then act on a file otherwise act on a project if (getFilename() != null) { // add -command CheckInFile to the commandline commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND); commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKIN_FILE); // add -file xxxxx to the commandline commandLine.createArgument().setValue(SOSCmd.FLAG_FILE); commandLine.createArgument().setValue(getFilename()); } else { // add -command CheckInProject to the commandline commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND); commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKIN_PROJECT); // look for a recursive option commandLine.createArgument().setValue(getRecursive()); } getRequiredAttributes(); getOptionalAttributes(); // Look for a comment if (getComment() != null) { commandLine.createArgument().setValue(SOSCmd.FLAG_COMMENT); commandLine.createArgument().setValue(getComment()); } return commandLine;
commandLine = new Commandline(); // If we find a "file" attribute then act on a file otherwise act on a project if (getFilename() != null) { // add -command CheckOutFile to the commandline commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND); commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKOUT_FILE); // add -file xxxxx to the commandline commandLine.createArgument().setValue(SOSCmd.FLAG_FILE); commandLine.createArgument().setValue(getFilename()); } else { // add -command CheckOutProject to the commandline commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND); commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKOUT_PROJECT); // look for a recursive option commandLine.createArgument().setValue(getRecursive()); } getRequiredAttributes(); getOptionalAttributes(); return commandLine;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/sos/SOSCheckin.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/sos/SOSCheckout.java
Method name: Commandline buildCmdLine() Method name: Commandline buildCmdLine()
Number of AST nodes: 15 Number of AST nodes: 12
1
commandLine = new Commandline();
1
commandLine = new Commandline();
2
        // If we find a "file" attribute then act on a file otherwise act on a project
2
        // If we find a "file" attribute then act on a file otherwise act on a project
3
        if (getFilename() != null) {
3
        if (getFilename() != null) {
4
            // add -command CheckInFile to the commandline
4
            // add -command CheckOutFile to the commandline
5
            commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
5
            commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
6
            commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKIN_FILE);
6
            commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKOUT_FILE);
7
            // add -file xxxxx to the commandline
7
            // add -file xxxxx to the commandline
8
            commandLine.createArgument().setValue(SOSCmd.FLAG_FILE);
8
            commandLine.createArgument().setValue(SOSCmd.FLAG_FILE);
9
            commandLine.createArgument().setValue(getFilename());
9
            commandLine.createArgument().setValue(getFilename());
10
        } else {
10
        } else {
11
            // add -command CheckInProject to the commandline
11
            // add -command CheckOutProject to the commandline
12
            commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
12
            commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
13
            commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKIN_PROJECT);
13
            commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKOUT_PROJECT);
14
            // look for a recursive option
14
            // look for a recursive option
15
            commandLine.createArgument().setValue(getRecursive());
15
            commandLine.createArgument().setValue(getRecursive());
16
        }
16
        }
17
        getRequiredAttributes();
17
        getRequiredAttributes();
18
        getOptionalAttributes();
18
        getOptionalAttributes();
19
        // Look for a comment
20
        if (getComment() != null) {
21
            commandLine.createArgument().setValue(SOSCmd.FLAG_COMMENT);
22
            commandLine.createArgument().setValue(getComment());
23
        }
24
        return commandLine;
19
        return commandLine;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are in different classes having the same super class
Number of node comparisons75
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)12.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    commandLine = new Commandline();
    1
    commandLine = new Commandline();
    2
    if (getFilename() != null)
    2
    if (getFilename() != null)
    3
    commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
    3
    commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
    4
    commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKIN_FILE);
    4
    commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKIN_FILE);
    4
    commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKOUT_FILE);
    Differences
    Expression1Expression2Difference
    COMMAND_CHECKIN_FILECOMMAND_CHECKOUT_FILEVARIABLE_NAME_MISMATCH
    4
    commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKOUT_FILE);
    5
    commandLine.createArgument().setValue(SOSCmd.FLAG_FILE);
    5
    commandLine.createArgument().setValue(SOSCmd.FLAG_FILE);
    6
    commandLine.createArgument().setValue(getFilename());
    6
    commandLine.createArgument().setValue(getFilename());
    else
    else
    7
    commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
    7
    commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
    8
    commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKIN_PROJECT);
    8
    commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKIN_PROJECT);
    8
    commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKOUT_PROJECT);
    Differences
    Expression1Expression2Difference
    COMMAND_CHECKIN_PROJECTCOMMAND_CHECKOUT_PROJECTVARIABLE_NAME_MISMATCH
    8
    commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKOUT_PROJECT);
    9
    commandLine.createArgument().setValue(getRecursive());
    9
    commandLine.createArgument().setValue(getRecursive());
    10
    getRequiredAttributes();
    10
    getRequiredAttributes();
    11
    getOptionalAttributes();
    11
    getOptionalAttributes();
    12
    if (getComment() != null)
                                                            
    13
    commandLine.createArgument().setValue(SOSCmd.FLAG_COMMENT);
                                                                                                                                  
    14
    commandLine.createArgument().setValue(getComment());
                                                                                                                    
    15
    return commandLine;
    12
    return commandLine;
    Precondition Violations (0)
    Row Violation