if (useAnchor) { // get the relevant source coordinate given the plot // orientation double sourceX = source.getX(); if (this.orientation == PlotOrientation.HORIZONTAL) { sourceX = source.getY(); } double anchorX = domainAxis.java2DToValue(sourceX, info.getDataArea(), getDomainAxisEdge()); domainAxis.resizeRange(factor, anchorX); } else { domainAxis.resizeRange(factor); }
if (useAnchor) { // get the relevant source coordinate given the plot // orientation double sourceY = source.getY(); if (this.orientation == PlotOrientation.HORIZONTAL) { sourceY = source.getX(); } double anchorY = rangeAxis.java2DToValue(sourceY, info.getDataArea(), getRangeAxisEdge()); rangeAxis.resizeRange(factor, anchorY); } else { rangeAxis.resizeRange(factor); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java
Method name: void zoomDomainAxes(double, PlotRenderingInfo, Point2D, boolean) Method name: void zoomRangeAxes(double, PlotRenderingInfo, Point2D, boolean)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (useAnchor) {
1
if (useAnchor) {
2
                    // get the relevant source coordinate given the plot
2
                    // get the relevant source coordinate given the plot
3
                    // orientation
3
                    // orientation
4
                    double sourceX = source.getX();
4
                    double sourceY = source.getY();
5
                    if (this.orientation == PlotOrientation.HORIZONTAL) {
5
                    if (this.orientation == PlotOrientation.HORIZONTAL) {
6
                        sourceX = source.getY();
6
                        sourceY = source.getX();
7
                    }
7
                    }
8
                    double anchorX = domainAxis.java2DToValue(sourceX,
8
                    double anchorY = rangeAxis.java2DToValue(sourceY,
9
                            info.getDataArea(), getDomainAxisEdge());
9
                            info.getDataArea(), getRangeAxisEdge());
10
                    domainAxis.resizeRange(factor, anchorX);
10
                    rangeAxis.resizeRange(factor, anchorY);
11
                }
11
                }
12
                else {
12
                else {
13
                    domainAxis.resizeRange(factor);
13
                    rangeAxis.resizeRange(factor);
14
                }
14
                }
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 declared in the same class
Number of node comparisons31
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)242.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    if (useAnchor)
    4
    if (useAnchor)
    5
    double sourceX = source.getX();
    5
    double sourceX = source.getX();
    5
    double sourceY = source.getY();
    Differences
    Expression1Expression2Difference
    sourceXsourceYVARIABLE_NAME_MISMATCH
    getXgetYMETHOD_INVOCATION_NAME_MISMATCH
    5
    double sourceY = source.getY();
    6
    if (this.orientation == PlotOrientation.HORIZONTAL)
    6
    if (this.orientation == PlotOrientation.HORIZONTAL)
    7
    sourceX = source.getY();
    7
    sourceX = source.getY();
    7
    sourceY = source.getX();
    Differences
    Expression1Expression2Difference
    sourceXsourceYVARIABLE_NAME_MISMATCH
    getYgetXMETHOD_INVOCATION_NAME_MISMATCH
    7
    sourceY = source.getX();
    8
    double anchorX = domainAxis.java2DToValue(sourceX, info.getDataArea(), getDomainAxisEdge());
    8
    double anchorX = domainAxis.java2DToValue(sourceX, info.getDataArea(), getDomainAxisEdge());
    8
    double anchorY = rangeAxis.java2DToValue(sourceY, info.getDataArea(), getRangeAxisEdge());
    Differences
    Expression1Expression2Difference
    anchorXanchorYVARIABLE_NAME_MISMATCH
    sourceXsourceYVARIABLE_NAME_MISMATCH
    getDomainAxisEdgegetRangeAxisEdgeMETHOD_INVOCATION_NAME_MISMATCH
    domainAxisrangeAxisVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression getDomainAxisEdge() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression getRangeAxisEdge() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    8
    double anchorY = rangeAxis.java2DToValue(sourceY, info.getDataArea(), getRangeAxisEdge());
    9
    domainAxis.resizeRange(factor, anchorX);
    9
    domainAxis.resizeRange(factor, anchorX);
    9
    rangeAxis.resizeRange(factor, anchorY);
    Differences
    Expression1Expression2Difference
    anchorXanchorYVARIABLE_NAME_MISMATCH
    domainAxisrangeAxisVARIABLE_NAME_MISMATCH
    9
    rangeAxis.resizeRange(factor, anchorY);
    else
    else
    10
    domainAxis.resizeRange(factor);
    10
    domainAxis.resizeRange(factor);
    10
    rangeAxis.resizeRange(factor);
    Differences
    Expression1Expression2Difference
    domainAxisrangeAxisVARIABLE_NAME_MISMATCH
    10
    rangeAxis.resizeRange(factor);
    Precondition Violations (2)
    Row Violation
    1Expression getDomainAxisEdge() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression getRangeAxisEdge() is a method call throwing exception(s) that should be caught by a try block that will be extracted