File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/optional/image/Ellipse.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/optional/image/Arc.java | |||
Method name: PlanarImage executeDrawOperation()
|
Method name: PlanarImage executeDrawOperation()
|
|||
Number of AST nodes: 20 | Number of AST nodes: 20 | |||
1 | BufferedImage bi = new BufferedImage(width, height↵ | 1 | BufferedImage bi = new BufferedImage(width + (stroke_width * 2),↵ | |
2 | , BufferedImage.TYPE_4BYTE_ABGR_PRE);↵ | 2 | height + (stroke_width * 2), BufferedImage.TYPE_4BYTE_ABGR_PRE);↵ | |
3 | Graphics2D graphics = (Graphics2D) bi.getGraphics();↵ | 3 | Graphics2D graphics = (Graphics2D) bi.getGraphics();↵ | |
4 | if (!stroke.equals("transparent")) {↵ | 4 | if (!stroke.equals("transparent")) {↵ | |
5 | BasicStroke bStroke = new BasicStroke(stroke_width);↵ | 5 | BasicStroke bStroke = new BasicStroke(stroke_width);↵ | |
6 | graphics.setColor(ColorMapper.getColorByName(stroke));↵ | 6 | graphics.setColor(ColorMapper.getColorByName(stroke));↵ | |
7 | graphics.setStroke(bStroke);↵ | 7 | graphics.setStroke(bStroke);↵ | |
8 | graphics.draw(new Ellipse2D.Double(0, 0, width, height↵ | 8 | graphics.draw(new Arc2D.Double(stroke_width, stroke_width, width,↵ | |
9 | ));↵ | 9 | height, start, stop, type));↵ | |
10 | }↵ | 10 | }↵ | |
11 | if (!fill.equals("transparent")) {↵ | 11 | if (!fill.equals("transparent")) {↵ | |
12 | graphics.setColor(ColorMapper.getColorByName(fill));↵ | 12 | graphics.setColor(ColorMapper.getColorByName(fill));↵ | |
13 | graphics.fill(new Ellipse2D.Double(0, 0, width, height↵ | 13 | graphics.fill(new Arc2D.Double(stroke_width, stroke_width,↵ | |
14 | ));↵ | 14 | width, height, start, stop, type));↵ | |
15 | }↵ | 15 | }↵ | |
16 | for (int i = 0; i < instructions.size(); i++) {↵ | 16 | for (int i = 0; i < instructions.size(); i++) {↵ | |
17 | ImageOperation instr = ((ImageOperation) instructions.elementAt(i));↵ | 17 | ImageOperation instr = ((ImageOperation) instructions.elementAt(i));↵ | |
18 | if (instr instanceof DrawOperation) {↵ | 18 | if (instr instanceof DrawOperation) {↵ | |
19 | PlanarImage img = ((DrawOperation) instr).executeDrawOperation();↵ | 19 | PlanarImage img = ((DrawOperation) instr).executeDrawOperation();↵ | |
20 | graphics.drawImage(img.getAsBufferedImage(), null, 0, 0);↵ | 20 | graphics.drawImage(img.getAsBufferedImage(), null, 0, 0);↵ | |
21 | } else if (instr instanceof TransformOperation) {↵ | 21 | } else if (instr instanceof TransformOperation) {↵ | |
22 | graphics = (Graphics2D) bi.getGraphics();↵ | 22 | graphics = (Graphics2D) bi.getGraphics();↵ | |
23 | PlanarImage image = ((TransformOperation) instr)↵ | 23 | PlanarImage image = ((TransformOperation) instr)↵ | |
24 | .executeTransformOperation(PlanarImage.wrapRenderedImage(bi));↵ | 24 | .executeTransformOperation(PlanarImage.wrapRenderedImage(bi));↵ | |
25 | bi = image.getAsBufferedImage();↵ | 25 | bi = image.getAsBufferedImage();↵ | |
26 | }↵ | 26 | }↵ | |
27 | }↵ | 27 | }↵ | |
28 | return PlanarImage.wrapRenderedImage(bi); | 28 |
| |
See real code fragment | See real code fragment |
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.8 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 97 |
Number of mapped statements | 20 |
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) | 7.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR_PRE); |
| 1 | BufferedImage bi = new BufferedImage(width + (stroke_width * 2), height + (stroke_width * 2), BufferedImage.TYPE_4BYTE_ABGR_PRE); | |||||||||||||
2 | Graphics2D graphics = (Graphics2D)bi.getGraphics(); | 2 | Graphics2D graphics = (Graphics2D)bi.getGraphics(); | ||||||||||||||
3 | if (!stroke.equals("transparent")) | 3 | if (!stroke.equals("transparent")) | ||||||||||||||
4 | BasicStroke bStroke = new BasicStroke(stroke_width); | 4 | BasicStroke bStroke = new BasicStroke(stroke_width); | ||||||||||||||
5 | graphics.setColor(ColorMapper.getColorByName(stroke)); | 5 | graphics.setColor(ColorMapper.getColorByName(stroke)); | ||||||||||||||
6 | graphics.setStroke(bStroke); | 6 | graphics.setStroke(bStroke); | ||||||||||||||
7 | graphics.draw(new Ellipse2D.Double(0, 0, width, height)); |
| 7 | graphics.draw(new Arc2D.Double(stroke_width, stroke_width, width, height, start, stop, type)); | |||||||||||||
8 | if (!fill.equals("transparent")) | 8 | if (!fill.equals("transparent")) | ||||||||||||||
9 | graphics.setColor(ColorMapper.getColorByName(fill)); | 9 | graphics.setColor(ColorMapper.getColorByName(fill)); | ||||||||||||||
10 | graphics.fill(new Ellipse2D.Double(0, 0, width, height)); |
| 10 | graphics.fill(new Arc2D.Double(stroke_width, stroke_width, width, height, start, stop, type)); | |||||||||||||
11 | for (int i = 0; i < instructions.size(); i++) | 11 | for (int i = 0; i < instructions.size(); i++) | ||||||||||||||
12 | ImageOperation instr = ((ImageOperation)instructions.elementAt(i)); | 12 | ImageOperation instr = ((ImageOperation)instructions.elementAt(i)); | ||||||||||||||
13 | if (instr instanceof DrawOperation) | 13 | if (instr instanceof DrawOperation) | ||||||||||||||
14 | PlanarImage img = ((DrawOperation)instr).executeDrawOperation(); | 14 | PlanarImage img = ((DrawOperation)instr).executeDrawOperation(); | ||||||||||||||
15 | graphics.drawImage(img.getAsBufferedImage(), null, 0, 0); | 15 | graphics.drawImage(img.getAsBufferedImage(), null, 0, 0); | ||||||||||||||
16 | else if (instr instanceof TransformOperation) | 16 | else if (instr instanceof TransformOperation) | ||||||||||||||
17 | graphics = (Graphics2D)bi.getGraphics(); | 17 | graphics = (Graphics2D)bi.getGraphics(); | ||||||||||||||
18 | PlanarImage image = ((TransformOperation)instr).executeTransformOperation(PlanarImage.wrapRenderedImage(bi)); | 18 | PlanarImage image = ((TransformOperation)instr).executeTransformOperation(PlanarImage.wrapRenderedImage(bi)); | ||||||||||||||
19 | bi = image.getAsBufferedImage(); | 19 | bi = image.getAsBufferedImage(); | ||||||||||||||
20 | return PlanarImage.wrapRenderedImage(bi); | 20 | return PlanarImage.wrapRenderedImage(bi); |
Row | Violation |
---|