Passed
Push — master ( dd7741...68adbd )
by Seth
04:41
created

example.shapes.ArcTest.loop()   B

Complexity

Conditions 6

Size

Total Lines 22
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 6
eloc 17
c 1
b 0
f 0
dl 0
loc 22
rs 8.6166
1
package example.shapes;
2
3
import org.gannacademy.cdf.graphics.geom.Arc;
4
5
public class ArcTest extends ShapeTest {
6
7
    protected double dAngle;
8
    protected boolean isStart;
9
10
    @Override
11
    protected void setup() {
12
        super.setup();
13
        shape = new Arc(width, height, width, height, 0, 360, getDrawingPanel());
14
        dAngle = 1;
15
        isStart = true;
16
    }
17
18
    @Override
19
    protected void loop() {
20
        Arc arc = (Arc) shape;
21
        if (isStart) {
22
            arc.setAngleExtent(arc.getAngleExtent() - dAngle);
23
            arc.setAngleStart(arc.getAngleStart() + dAngle);
24
            if (arc.getAngleStart() > 359) {
25
                dAngle = -dAngle;
26
            }
27
            if (arc.getAngleStart() < 1) {
28
                isStart = false;
29
            }
30
        } else {
31
            arc.setAngleExtent(arc.getAngleExtent() + dAngle);
32
            if (arc.getAngleExtent() < 1) {
33
                dAngle = -dAngle;
34
            }
35
            if (arc.getAngleExtent() > 359) {
36
                isStart = true;
37
            }
38
        }
39
        super.loop();
40
    }
41
42
    public static void main(String[] args) {
43
        new ArcTest();
44
    }
45
}
46