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

Complexity

Total Complexity 6

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 3 1
A execute() 0 2 1
A ButtonCommandHitTheDeck() 0 2 1
A isFinished() 0 1 1
A end() 0 1 1
A interrupted() 0 1 1
1
package org.usfirst.frc.team3695.robot.commands;
2
3
import edu.wpi.first.wpilibj.command.Command;
4
5
import org.usfirst.frc.team3695.robot.Constants;
6
import org.usfirst.frc.team3695.robot.Robot;
7
import org.usfirst.frc.team3695.robot.util.Util;
8
9
/**
10
 * toggles the state of the clamp
11
 */
12
public class ButtonCommandHitTheDeck extends Command {
13
	
14
	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...
15
	
16
	long startTime;
17
	
18
    public ButtonCommandHitTheDeck() {
19
        requires(Robot.SUB_MAST);
20
    }
21
    
22
    protected void initialize() {
23
    	isFinished = false;
24
    	startTime = System.currentTimeMillis();
25
    }
26
27
    protected void execute() {
28
    	isFinished = Robot.SUB_MAST.dropIt(Util.getAndSetDouble("Drop Speed", .5)) ||  (startTime + Constants.MAST_TIMEOUT >= System.currentTimeMillis());
0 ignored issues
show
Comprehensibility introduced by
Consider assigning this magic number .5 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...
29
    }
30
31
    protected boolean isFinished() { return isFinished; }
32
33
    protected void end() {
34
    }
35
36
    protected void interrupted() {}
37
}
38