184-1-2

if (marker instanceof ValueMarker) { ValueMarker vm = (ValueMarker) marker; double value = vm.getValue(); Range range = domainAxis.getRange(); if (!range.contains(value)) { return; } double x = domainAxis.valueToJava2D(value, dataArea, RectangleEdge.BOTTOM); Line2D line = new Line2D.Double(x, dataArea.getMinY(), x, dataArea.getMaxY()); Paint paint = marker.getOutlinePaint(); Stroke stroke = marker.getOutlineStroke(); g2.setPaint(paint != null ? paint : Plot.DEFAULT_OUTLINE_PAINT); g2.setStroke(stroke != null ? stroke : Plot.DEFAULT_OUTLINE_STROKE); g2.draw(line); }
if (marker instanceof ValueMarker) { ValueMarker vm = (ValueMarker) marker; double value = vm.getValue(); Range range = rangeAxis.getRange(); if (!range.contains(value)) { return; } double y = rangeAxis.valueToJava2D(value, dataArea, RectangleEdge.LEFT); Line2D line = new Line2D.Double(dataArea.getMinX(), y, dataArea.getMaxX(), y); Paint paint = marker.getOutlinePaint(); Stroke stroke = marker.getOutlineStroke(); g2.setPaint(paint != null ? paint : Plot.DEFAULT_OUTLINE_PAINT); g2.setStroke(stroke != null ? stroke : Plot.DEFAULT_OUTLINE_STROKE); g2.draw(line); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/ContourPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/ContourPlot.java
Method name: `void drawDomainMarker(Graphics2D, ContourPlot, ValueAxis, Marker, Rectangle2D)` |  | Method name: `void drawRangeMarker(Graphics2D, ContourPlot, ValueAxis, Marker, Rectangle2D)`
Number of AST nodes: 13 |  | Number of AST nodes: 13

1

    if (marker instanceof ValueMarker) {↵

1

    if (marker instanceof ValueMarker) {↵

2

                ValueMarker vm = (ValueMarker) marker;↵

2

                ValueMarker vm = (ValueMarker) marker;↵

3

                double value = vm.getValue();↵

3

                double value = vm.getValue();↵

4

                Range range = domainAxis.getRange();↵

4

                Range range = rangeAxis.getRange();↵

5

                if (!range.contains(value)) {↵

5

                if (!range.contains(value)) {↵

6

                    return;↵

6

                    return;↵

7

                }↵

7

                }↵

8

      ↵

9

                double x = domainAxis.valueToJava2D(value, dataArea, ↵

8

                double y = rangeAxis.valueToJava2D(value, dataArea, ↵

10

                        RectangleEdge.BOTTOM);↵

9

                        RectangleEdge.LEFT);↵

11

                Line2D line = new Line2D.Double(x, dataArea.getMinY(), x, ↵

10

                Line2D line = new Line2D.Double(dataArea.getMinX(), y, ↵

12

                        dataArea.getMaxY());↵

11

                        dataArea.getMaxX(), y);↵

13

                Paint paint = marker.getOutlinePaint();↵

12

                Paint paint = marker.getOutlinePaint();↵

14

                Stroke stroke = marker.getOutlineStroke();↵

13

                Stroke stroke = marker.getOutlineStroke();↵

15

                g2.setPaint(paint != null ? paint : Plot.DEFAULT_OUTLINE_PAINT);↵

14

                g2.setPaint(paint != null ? paint : Plot.DEFAULT_OUTLINE_PAINT);↵

16

                g2.setStroke(stroke != null ? stroke : Plot.DEFAULT_OUTLINE_STROKE);↵

15

                g2.setStroke(stroke != null ? stroke : Plot.DEFAULT_OUTLINE_STROKE);↵

17

                g2.draw(line);↵

16

                g2.draw(line);↵

18

            }

17

            }

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 declared in the same class
Number of node comparisons | 125

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 13
   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.8
   Clone type | Type 2

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

   1

       if (marker instanceof ValueMarker)

   1

       if (marker instanceof ValueMarker)

   2

       ValueMarker vm = (ValueMarker)marker;

   2

       ValueMarker vm = (ValueMarker)marker;

   3

       double value = vm.getValue();

   3

       double value = vm.getValue();

   4

       Range range = domainAxis.getRange();

   4 | Range range = domainAxis.getRange();
   4 | Range range = rangeAxis.getRange();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   domainAxis | rangeAxis | VARIABLE_NAME_MISMATCH

   4

       Range range = rangeAxis.getRange();

   5

       if (!range.contains(value))

   5

       if (!range.contains(value))

   6

       return;

   6

       return;

   7

       double x = domainAxis.valueToJava2D(value, dataArea, RectangleEdge.BOTTOM);

   7 | double x = domainAxis.valueToJava2D(value, dataArea, RectangleEdge.BOTTOM);
   7 | double y = rangeAxis.valueToJava2D(value, dataArea, RectangleEdge.LEFT);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   x | y | VARIABLE_NAME_MISMATCH
   BOTTOM | LEFT | VARIABLE_NAME_MISMATCH
   domainAxis | rangeAxis | VARIABLE_NAME_MISMATCH

   7

       double y = rangeAxis.valueToJava2D(value, dataArea, RectangleEdge.LEFT);

   8

       Line2D line = new Line2D.Double(x, dataArea.getMinY(), x, dataArea.getMaxY());

   8 | Line2D line = new Line2D.Double(x, dataArea.getMinY(), x, dataArea.getMaxY());
   8 | Line2D line = new Line2D.Double(dataArea.getMinX(), y, dataArea.getMaxX(), y);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   x | dataArea.getMinX() | TYPE_COMPATIBLE_REPLACEMENT
   dataArea.getMinY() | y | TYPE_COMPATIBLE_REPLACEMENT
   x | dataArea.getMaxX() | TYPE_COMPATIBLE_REPLACEMENT
   dataArea.getMaxY() | y | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted

   8

       Line2D line = new Line2D.Double(dataArea.getMinX(), y, dataArea.getMaxX(), y);

   9

       Paint paint = marker.getOutlinePaint();

   9

       Paint paint = marker.getOutlinePaint();

   10

       Stroke stroke = marker.getOutlineStroke();

   10

       Stroke stroke = marker.getOutlineStroke();

   11

       g2.setPaint(paint != null ? paint : Plot.DEFAULT_OUTLINE_PAINT);

   11

       g2.setPaint(paint != null ? paint : Plot.DEFAULT_OUTLINE_PAINT);

   12

       g2.setStroke(stroke != null ? stroke : Plot.DEFAULT_OUTLINE_STROKE);

   12

       g2.setStroke(stroke != null ? stroke : Plot.DEFAULT_OUTLINE_STROKE);

   13

       g2.draw(line);

   13

       g2.draw(line);

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted