255-1-2

double tickLabelHeight = estimateMaximumTickLabelHeight(g2); // start with the current tick unit... TickUnitSource tickUnits = getStandardTickUnits(); TickUnit unit1 = tickUnits.getCeilingTickUnit(getTickUnit()); double unitHeight = lengthToJava2D(unit1.getSize(), dataArea, edge); // then extrapolate... double guess = (tickLabelHeight / unitHeight) * unit1.getSize(); NumberTickUnit unit2 = (NumberTickUnit) tickUnits.getCeilingTickUnit(guess); double unit2Height = lengthToJava2D(unit2.getSize(), dataArea, edge); tickLabelHeight = estimateMaximumTickLabelHeight(g2); if (tickLabelHeight > unit2Height) { unit2 = (NumberTickUnit) tickUnits.getLargerTickUnit(unit2); } setTickUnit(unit2, false, false);
double tickLabelHeight = estimateMaximumTickLabelHeight(g2); // start with the current tick unit... TickUnitSource tickUnits = getStandardTickUnits(); TickUnit unit1 = tickUnits.getCeilingTickUnit(getTickUnit()); double unitHeight = exponentLengthToJava2D(unit1.getSize(), dataArea, edge); // then extrapolate... double guess = (tickLabelHeight / unitHeight) * unit1.getSize(); NumberTickUnit unit2 = (NumberTickUnit) tickUnits.getCeilingTickUnit(guess); double unit2Height = exponentLengthToJava2D(unit2.getSize(), dataArea, edge); tickLabelHeight = estimateMaximumTickLabelHeight(g2); if (tickLabelHeight > unit2Height) { unit2 = (NumberTickUnit) tickUnits.getLargerTickUnit(unit2); } setTickUnit(unit2, false, false);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/NumberAxis.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/LogAxis.java
Method name: `void selectVerticalAutoTickUnit(Graphics2D, Rectangle2D, RectangleEdge)` |  | Method name: `void selectVerticalAutoTickUnit(Graphics2D, Rectangle2D, RectangleEdge)`
Number of AST nodes: 11 |  | Number of AST nodes: 11

1

    double tickLabelHeight = estimateMaximumTickLabelHeight(g2);↵

1

    double tickLabelHeight = estimateMaximumTickLabelHeight(g2);↵

2

            // start with the current tick unit...↵

2

            // start with the current tick unit...↵

3

            TickUnitSource tickUnits = getStandardTickUnits();↵

3

            TickUnitSource tickUnits = getStandardTickUnits();↵

4

            TickUnit unit1 = tickUnits.getCeilingTickUnit(getTickUnit());↵

4

            TickUnit unit1 = tickUnits.getCeilingTickUnit(getTickUnit());↵

5

            double unitHeight = lengthToJava2D(unit1.getSize(), dataArea, ↵

5

            double unitHeight = exponentLengthToJava2D(unit1.getSize(), dataArea, ↵

6

    edge);↵

6

                    edge);↵

7

            // then extrapolate...↵

7

            // then extrapolate...↵

8

            double guess = (tickLabelHeight / unitHeight) * unit1.getSize();↵

8

            double guess = (tickLabelHeight / unitHeight) * unit1.getSize();↵

9

            ↵

9

            NumberTickUnit unit2↵

10

            NumberTickUnit unit2↵

10

                = (NumberTickUnit) ↵

11

     = (NumberTickUnit) ↵

11

    tickUnits.getCeilingTickUnit(guess);↵

12

                    tickUnits.getCeilingTickUnit(guess);↵

12

            double unit2Height = lengthToJava2D(unit2.getSize(), dataArea, ↵

13

            double unit2Height = exponentLengthToJava2D(unit2.getSize(), dataArea, ↵

13

    edge);↵

14

                    edge);↵

14

            tickLabelHeight = estimateMaximumTickLabelHeight(g2);↵

15

            tickLabelHeight = estimateMaximumTickLabelHeight(g2);↵

15

            if (tickLabelHeight > unit2Height) {↵

16

            if (tickLabelHeight > unit2Height) {↵

16

                unit2 = (NumberTickUnit) tickUnits.getLargerTickUnit(unit2);↵

17

                unit2 = (NumberTickUnit) tickUnits.getLargerTickUnit(unit2);↵

17

            }↵

18

            }↵

18

            setTickUnit(unit2, false, false);

19

            setTickUnit(unit2, false, false);

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.1
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 85

1. {Non-refactorable}

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

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

   1

       double tickLabelHeight = estimateMaximumTickLabelHeight(g2);

   1

       double tickLabelHeight = estimateMaximumTickLabelHeight(g2);

   2

       TickUnitSource tickUnits = getStandardTickUnits();

   2

       TickUnitSource tickUnits = getStandardTickUnits();

   3

       TickUnit unit1 = tickUnits.getCeilingTickUnit(getTickUnit());

   3

       TickUnit unit1 = tickUnits.getCeilingTickUnit(getTickUnit());

   4

       double unitHeight = lengthToJava2D(unit1.getSize(), dataArea, edge);

   4 | double unitHeight = lengthToJava2D(unit1.getSize(), dataArea, edge);
   4 | double unitHeight = exponentLengthToJava2D(unit1.getSize(), dataArea, edge);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   lengthToJava2D | exponentLengthToJava2D | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression lengthToJava2D(unit1.getSize(),dataArea,edge) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression exponentLengthToJava2D(unit1.getSize(),dataArea,edge) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   4

       double unitHeight = exponentLengthToJava2D(unit1.getSize(), dataArea, edge);

   5

       double guess = (tickLabelHeight / unitHeight) * unit1.getSize();

   5

       double guess = (tickLabelHeight / unitHeight) * unit1.getSize();

   6

       NumberTickUnit unit2 = (NumberTickUnit)tickUnits.getCeilingTickUnit(guess);

   6

       NumberTickUnit unit2 = (NumberTickUnit)tickUnits.getCeilingTickUnit(guess);

   7

       double unit2Height = lengthToJava2D(unit2.getSize(), dataArea, edge);

   7 | double unit2Height = lengthToJava2D(unit2.getSize(), dataArea, edge);
   7 | double unit2Height = exponentLengthToJava2D(unit2.getSize(), dataArea, edge);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   lengthToJava2D | exponentLengthToJava2D | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression lengthToJava2D(unit2.getSize(),dataArea,edge) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression exponentLengthToJava2D(unit2.getSize(),dataArea,edge) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   7

       double unit2Height = exponentLengthToJava2D(unit2.getSize(), dataArea, edge);

   8

       tickLabelHeight = estimateMaximumTickLabelHeight(g2);

   8

       tickLabelHeight = estimateMaximumTickLabelHeight(g2);

   9

       if (tickLabelHeight > unit2Height)

   9

       if (tickLabelHeight > unit2Height)

   10

       unit2 = (NumberTickUnit)tickUnits.getLargerTickUnit(unit2);

   10

       unit2 = (NumberTickUnit)tickUnits.getLargerTickUnit(unit2);

   11

       setTickUnit(unit2, false, false);

   11

       setTickUnit(unit2, false, false);

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression lengthToJava2D(unit1.getSize(),dataArea,edge) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression exponentLengthToJava2D(unit1.getSize(),dataArea,edge) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression lengthToJava2D(unit2.getSize(),dataArea,edge) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression exponentLengthToJava2D(unit2.getSize(),dataArea,edge) cannot be parameterized, because it has dependencies to/from statements that will be extracted