1727-2-3

TimeSeries ts = (TimeSeries) this.data.get(series); TimeSeriesDataItem dp = ts.getDataItem(item); RegularTimePeriod period = dp.getPeriod(); return new Long(getX(period));
OHLCSeries s = (OHLCSeries) this.data.get(series); OHLCItem di = (OHLCItem) s.getDataItem(item); RegularTimePeriod period = di.getPeriod(); return getX(period);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/time/TimeSeriesCollection.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/time/ohlc/OHLCSeriesCollection.java
Method name: `Number getX(int, int)` |  | Method name: `double getXValue(int, int)`
Number of AST nodes: 4 |  | Number of AST nodes: 4

1

    TimeSeries ts = (TimeSeries) this.data.get(series);↵

1

    OHLCSeries s = (OHLCSeries) this.data.get(series);↵

2

            TimeSeriesDataItem dp = ts.getDataItem(item);↵

2

            OHLCItem di = (OHLCItem) s.getDataItem(item);↵

3

            RegularTimePeriod period = dp.getPeriod();↵

3

            RegularTimePeriod period = di.getPeriod();↵

4

            return new Long(getX(period));

4

            return getX(period);

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 16

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 2
   Number of unmapped statements in the first code fragment | 2
   Number of unmapped statements in the second code fragment | 2
   Time elapsed for statement mapping (ms) | 0.0
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       TimeSeries ts = (TimeSeries)this.data.get(series);

   1 | TimeSeries ts = (TimeSeries)this.data.get(series);
   1 | OHLCSeries s = (OHLCSeries)this.data.get(series);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.TimeSeries | org.jfree.data.time.ohlc.OHLCSeries | SUBCLASS_TYPE_MISMATCH
   ts | s | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.TimeSeries | org.jfree.data.time.ohlc.OHLCSeries | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.TimeSeries | org.jfree.data.time.ohlc.OHLCSeries | SUBCLASS_TYPE_MISMATCH

   1

       OHLCSeries s = (OHLCSeries)this.data.get(series);

   2 | OHLCItem di = (OHLCItem)s.getDataItem(item);

   Preondition Violations
   Unmatched statement OHLCItem di=(OHLCItem)s.getDataItem(item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   2

       OHLCItem di = (OHLCItem)s.getDataItem(item);

   2

       TimeSeriesDataItem dp = ts.getDataItem(item);

   2 | TimeSeriesDataItem dp = ts.getDataItem(item);

   Preondition Violations
   Unmatched statement TimeSeriesDataItem dp=ts.getDataItem(item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   3

       RegularTimePeriod period = dp.getPeriod();

   3 | RegularTimePeriod period = dp.getPeriod();
   3 | RegularTimePeriod period = di.getPeriod();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   dp | di | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.TimeSeriesDataItem | org.jfree.data.time.ohlc.OHLCItem | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.time.TimeSeriesDataItem of variable dp does not match with type org.jfree.data.time.ohlc.OHLCItem of variable di
   - Make classes org.jfree.data.time.TimeSeriesDataItem and org.jfree.data.time.ohlc.OHLCItem extend a common superclass

   3

       RegularTimePeriod period = di.getPeriod();

   4

       return getX(period);

   4

       return new Long(getX(period));

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Unmatched statement OHLCItem di=(OHLCItem)s.getDataItem(item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Unmatched statement TimeSeriesDataItem dp=ts.getDataItem(item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   3 | Type org.jfree.data.time.TimeSeriesDataItem of variable dp does not match with type org.jfree.data.time.ohlc.OHLCItem of variable di
   4 | Clone fragment #1 returns variables ts, period , while Clone fragment #2 returns variables s, period