for (int i = 0; i < this.rangeAxes.size(); i++) { ValueAxis rangeAxis = (ValueAxis) this.rangeAxes.get(i); if (rangeAxis != null) { 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); } } }
for (int i = 0; i < this.domainAxes.size(); i++) { ValueAxis domainAxis = (ValueAxis) this.domainAxes.get(i); if (domainAxis != null) { 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); } } }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CategoryPlot.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java
Method name: void zoomRangeAxes(double, PlotRenderingInfo, Point2D, boolean) Method name: void zoomDomainAxes(double, PlotRenderingInfo, Point2D, boolean)
Number of AST nodes: 10 Number of AST nodes: 10
1
for (int i = 0; i < this.rangeAxes.size(); i++) {
1
for (int i = 0; i < this.domainAxes.size(); i++) {
2
            ValueAxis rangeAxis = (ValueAxis) this.rangeAxes.get(i);
2
            ValueAxis domainAxis = (ValueAxis) this.domainAxes.get(i);
3
            if (rangeAxis != null) {
3
            if (domainAxis != null) {
4
                if (useAnchor) {
4
                if (useAnchor) {
5
                    // get the relevant source coordinate given the plot
5
                    // get the relevant source coordinate given the plot
6
                    // orientation
6
                    // orientation
7
                    double sourceY = source.getY();
7
                    double sourceX = source.getX();
8
                    if (this.orientation == PlotOrientation.HORIZONTAL) {
8
                    if (this.orientation == PlotOrientation.HORIZONTAL) {
9
                        sourceY = source.getX();
9
                        sourceX = source.getY();
10
                    }
10
                    }
11
                    double anchorY = rangeAxis.java2DToValue(sourceY,
11
                    double anchorX = domainAxis.java2DToValue(sourceX,
12
                            info.getDataArea(), getRangeAxisEdge());
12
                            info.getDataArea(), getDomainAxisEdge());
13
                    rangeAxis.resizeRange(factor, anchorY);
13
                    domainAxis.resizeRange(factor, anchorX);
14
                }
14
                }
15
                else {
15
                else {
16
                    rangeAxis.resizeRange(factor);
16
                    domainAxis.resizeRange(factor);
17
                }
17
                }
18
            }
18
            }
19
        }
19
        }
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)1.3
Clones locationClones are in different classes having the same super class
Number of node comparisons34
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)250.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    for (int i = 0; i < this.rangeAxes.size(); i++)
    1
    for (int i = 0; i < this.rangeAxes.size(); i++)
    1
    for (int i = 0; i < this.domainAxes.size(); i++)
    Differences
    Expression1Expression2Difference
    rangeAxesdomainAxesVARIABLE_NAME_MISMATCH
    1
    for (int i = 0; i < this.domainAxes.size(); i++)
    2
    ValueAxis rangeAxis = (ValueAxis)this.rangeAxes.get(i);
    2
    ValueAxis rangeAxis = (ValueAxis)this.rangeAxes.get(i);
    2
    ValueAxis domainAxis = (ValueAxis)this.domainAxes.get(i);
    Differences
    Expression1Expression2Difference
    rangeAxisdomainAxisVARIABLE_NAME_MISMATCH
    rangeAxesdomainAxesVARIABLE_NAME_MISMATCH
    2
    ValueAxis domainAxis = (ValueAxis)this.domainAxes.get(i);
    3
    if (rangeAxis != null)
    3
    if (rangeAxis != null)
    3
    if (domainAxis != null)
    Differences
    Expression1Expression2Difference
    rangeAxisdomainAxisVARIABLE_NAME_MISMATCH
    3
    if (domainAxis != null)
    4
    if (useAnchor)
    4
    if (useAnchor)
    5
    double sourceY = source.getY();
    5
    double sourceY = source.getY();
    5
    double sourceX = source.getX();
    Differences
    Expression1Expression2Difference
    sourceYsourceXVARIABLE_NAME_MISMATCH
    getYgetXMETHOD_INVOCATION_NAME_MISMATCH
    5
    double sourceX = source.getX();
    6
    if (this.orientation == PlotOrientation.HORIZONTAL)
    6
    if (this.orientation == PlotOrientation.HORIZONTAL)
    7
    sourceY = source.getX();
    7
    sourceY = source.getX();
    7
    sourceX = source.getY();
    Differences
    Expression1Expression2Difference
    sourceYsourceXVARIABLE_NAME_MISMATCH
    getXgetYMETHOD_INVOCATION_NAME_MISMATCH
    7
    sourceX = source.getY();
    8
    double anchorY = rangeAxis.java2DToValue(sourceY, info.getDataArea(), getRangeAxisEdge());
    8
    double anchorY = rangeAxis.java2DToValue(sourceY, info.getDataArea(), getRangeAxisEdge());
    8
    double anchorX = domainAxis.java2DToValue(sourceX, info.getDataArea(), getDomainAxisEdge());
    Differences
    Expression1Expression2Difference
    anchorYanchorXVARIABLE_NAME_MISMATCH
    sourceYsourceXVARIABLE_NAME_MISMATCH
    getRangeAxisEdgegetDomainAxisEdgeMETHOD_INVOCATION_NAME_MISMATCH
    rangeAxisdomainAxisVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression getRangeAxisEdge() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression getDomainAxisEdge() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    8
    double anchorX = domainAxis.java2DToValue(sourceX, info.getDataArea(), getDomainAxisEdge());
    9
    rangeAxis.resizeRange(factor, anchorY);
    9
    rangeAxis.resizeRange(factor, anchorY);
    9
    domainAxis.resizeRange(factor, anchorX);
    Differences
    Expression1Expression2Difference
    anchorYanchorXVARIABLE_NAME_MISMATCH
    rangeAxisdomainAxisVARIABLE_NAME_MISMATCH
    9
    domainAxis.resizeRange(factor, anchorX);
    else
    else
    10
    rangeAxis.resizeRange(factor);
    10
    rangeAxis.resizeRange(factor);
    10
    domainAxis.resizeRange(factor);
    Differences
    Expression1Expression2Difference
    rangeAxisdomainAxisVARIABLE_NAME_MISMATCH
    10
    domainAxis.resizeRange(factor);
    Precondition Violations (2)
    Row Violation
    1Expression getRangeAxisEdge() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression getDomainAxisEdge() is a method call throwing exception(s) that should be caught by a try block that will be extracted