for (int index = start; index <= end; index++) { TimePeriodValue item = (TimePeriodValue) this.data.get(index); TimePeriodValue clone = (TimePeriodValue) item.clone(); try { copy.add(clone); } catch (SeriesException e) { System.err.println("Failed to add cloned item."); } }
for (int index = start; index <= end; index++) { XYDataItem item = (XYDataItem) this.data.get(index); XYDataItem clone = (XYDataItem) item.clone(); try { copy.add(clone); } catch (SeriesException e) { System.err.println("Unable to add cloned data item."); } }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/time/TimePeriodValues.java File path: /jfreechart-1.0.10/src/org/jfree/data/xy/XYSeries.java
Method name: TimePeriodValues createCopy(int, int) Method name: XYSeries createCopy(int, int)
Number of AST nodes: 5 Number of AST nodes: 5
1
for (int index = start; index <= end; index++) {
1
for (int index = start; index <= end; index++) {
2
                TimePeriodValue item = (TimePeriodValue) this.data.get(index);
2
                XYDataItem item = (XYDataItem) this.data.get(index);
3
                TimePeriodValue clone = (TimePeriodValue) item.clone();
3
                XYDataItem clone = (XYDataItem) item.clone();
4
                try {
4
                try {
5
                    copy.add(clone);
5
                    copy.add(clone);
6
                }
6
                }
7
                catch (SeriesException e) {
7
                catch (SeriesException e) {
8
                    System.err.println("Failed to add cloned item.");
8
                    System.err.println("Unable to add cloned data item.");
9
                }
9
                }
10
            }
10
            }
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.5
Clones locationClones are in different classes having the same super class
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    for (int index = start; index <= end; index++)
    4
    for (int index = start; index <= end; index++)
                                                                                                            
    5
    XYDataItem item = (XYDataItem)this.data.get(index);
    Preondition Violations
    Unmatched statement XYDataItem item=(XYDataItem)this.data.get(index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    XYDataItem item = (XYDataItem)this.data.get(index);
    5
    TimePeriodValue item = (TimePeriodValue)this.data.get(index);
    5
    TimePeriodValue item = (TimePeriodValue)this.data.get(index);
    Preondition Violations
    Unmatched statement TimePeriodValue item=(TimePeriodValue)this.data.get(index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                
                                                                                              
    6
    XYDataItem clone = (XYDataItem)item.clone();
    Preondition Violations
    Unmatched statement XYDataItem clone=(XYDataItem)item.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    XYDataItem clone = (XYDataItem)item.clone();
    6
    TimePeriodValue clone = (TimePeriodValue)item.clone();
    6
    TimePeriodValue clone = (TimePeriodValue)item.clone();
    Preondition Violations
    Unmatched statement TimePeriodValue clone=(TimePeriodValue)item.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                  
    7
    try
    7
    try
    7
    try
    Differences
    Expression1Expression2Difference
    "Failed to add cloned item.""Unable to add cloned data item."LITERAL_VALUE_MISMATCH
    7
    try
                                          
    8
    copy.add(clone);
    Preondition Violations
    Unmatched statement copy.add(clone); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    copy.add(clone);
    8
    copy.add(clone);
    8
    copy.add(clone);
    Preondition Violations
    Unmatched statement copy.add(clone); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                          
    Precondition Violations (6)
    Row Violation
    1Unmatched statement XYDataItem item=(XYDataItem)this.data.get(index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement TimePeriodValue item=(TimePeriodValue)this.data.get(index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement XYDataItem clone=(XYDataItem)item.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement TimePeriodValue clone=(TimePeriodValue)item.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement copy.add(clone); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement copy.add(clone); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted