Test Failed
Push — master ( 08f71e...df8093 )
by John
02:02
created

org.usfirst.frc.team3695.robot.commands.CyborgCommandGrow   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A end() 0 2 1
A execute() 0 1 1
A initialize() 0 16 5
A CyborgCommandGrow(Mast) 0 4 1
A interrupted() 0 2 1
A isFinished() 0 2 1
1
package org.usfirst.frc.team3695.robot.commands;
2
3
import edu.wpi.first.wpilibj.command.Command;
4
import org.usfirst.frc.team3695.robot.Robot;
5
import org.usfirst.frc.team3695.robot.enumeration.Mast;
6
import org.usfirst.frc.team3695.robot.enumeration.Position;
7
8
public class CyborgCommandGrow extends Command {
9
10
    private Mast position;
11
12
    boolean isFinished;
0 ignored issues
show
Comprehensibility introduced by
Fields and methods should not have conflicting names like isFinished. While this is technically legal it can lead to misunderstandings and problems with serialization.
Loading history...
13
    public CyborgCommandGrow(Mast position) {
14
        requires(Robot.SUB_MAST);
15
        this.position = position;
16
        isFinished = false;
17
    }
18
19
    protected boolean isFinished() {
20
        return isFinished;
21
    }
22
23
    protected void initialize() {
24
        switch (position) {
25
            case PINION_UP:
26
                Robot.SUB_MAST.adjustPinion(Position.UP);
27
                break;
28
            case PINION_DOWN:
29
                Robot.SUB_MAST.adjustPinion(Position.DOWN);
30
                break;
31
            case SCREW_UP:
32
                Robot.SUB_MAST.adjustScrew(Position.UP);
33
                break;
34
            case SCREW_DOWN:
35
                Robot.SUB_MAST.adjustScrew(Position.DOWN);
36
                break;
37
        }
38
        isFinished = true;
39
    }
40
41
    protected void execute() {}
42
43
    protected void end() {
44
        isFinished = false;
45
    }
46
47
    protected void interrupted() {
48
        end();
49
    }
50
}
51