interrupted()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
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.util.Util;
6
7
/** toggles the state of the clamp */
8
public class ToggleCommandDock extends Command {
9
10
    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...
11
12
    public ToggleCommandDock() {
13
        requires(Robot.SUB_DRIVE);
14
        isFinished = false;
15
    }
16
17
    protected void initialize() {
18
        Robot.SUB_DRIVE.toggleDocking(Util.getAndSetDouble("Docking Inhibitor", 0.5d));
0 ignored issues
show
Comprehensibility introduced by
Consider assigning this magic number 0.5d to a constant.

Using constants for hard-coded numbers is a best practice. A constant’s name can explain the rationale behind this magic number. It is also easier to find if you ever need to change it.

Loading history...
19
        isFinished = true;
20
    }
21
22
    protected void execute() {}
23
24
    protected boolean isFinished() { return isFinished; }
25
26
    protected void end() {
27
        isFinished = false;
28
    }
29
30
    protected void interrupted() {
31
        end();
32
    }
33
}
34