1386-2-3

if (this.heightConstraintType == LengthConstraintType.NONE) { result.height = base.height; } else if (this.heightConstraintType == LengthConstraintType.RANGE) { result.height = this.heightRange.constrain(base.height); } else if (this.heightConstraintType == LengthConstraintType.FIXED) { result.height = this.height; }
if (this.heightConstraintType == LengthConstraintType.NONE) { result.height = base.height; } else if (this.heightConstraintType == LengthConstraintType.RANGE) { result.height = this.heightRange.constrain(base.height); } else if (this.heightConstraintType == LengthConstraintType.FIXED) { result.height = this.height; }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/block/RectangleConstraint.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/block/RectangleConstraint.java
Method name: `Size2D calculateConstrainedSize(Size2D)` |  | Method name: `Size2D calculateConstrainedSize(Size2D)`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

    if (this.heightConstraintType == LengthConstraintType.NONE) {↵

1

    if (this.heightConstraintType == LengthConstraintType.NONE) {↵

2

                    result.height = base.height;↵

2

                    result.height = base.height;↵

3

                }↵

3

                }↵

4

                else if (this.heightConstraintType == LengthConstraintType.RANGE) {↵

4

                else if (this.heightConstraintType == LengthConstraintType.RANGE) {↵

5

                    result.height = this.heightRange.constrain(base.height);↵

5

                    result.height = this.heightRange.constrain(base.height);↵

6

                }↵

6

                }↵

7

                else if (this.heightConstraintType == LengthConstraintType.FIXED) {↵

7

                else if (this.heightConstraintType == LengthConstraintType.FIXED) {↵

8

                    result.height = this.height;↵

8

                    result.height = this.height;↵

9

                }

9

                }

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 1
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.7
Clones location | Clones are in the same method
Number of node comparisons | 28

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 6
   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) | 0.9
   Clone type | Type 1

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

   12

       if (this.heightConstraintType == LengthConstraintType.NONE)

   20

       if (this.heightConstraintType == LengthConstraintType.NONE)

   13

       result.height = base.height;

   21

       result.height = base.height;

   14

       else if (this.heightConstraintType == LengthConstraintType.RANGE)

   22

       else if (this.heightConstraintType == LengthConstraintType.RANGE)

   15

       result.height = this.heightRange.constrain(base.height);

   23

       result.height = this.heightRange.constrain(base.height);

   16

       else if (this.heightConstraintType == LengthConstraintType.FIXED)

   24

       else if (this.heightConstraintType == LengthConstraintType.FIXED)

   17

       result.height = this.height;

   25

       result.height = this.height;

   Precondition Violations (0)
   Row | Violation
   --- | ---