org.usfirst.frc.team3695.robot.commands.ToggleCommandDock   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A isFinished() 0 1 1
A end() 0 2 1
A interrupted() 0 2 1
A ToggleCommandDock() 0 3 1
A execute() 0 1 1
A initialize() 0 3 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.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