initialize()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
cc 1
dl 0
loc 2
rs 10
c 3
b 0
f 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
6
public class CyborgCommandSpit extends Command {
7
8
	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...
9
    long runTime;
10
    long startTime;
11
    
12
    public CyborgCommandSpit(long runTime) {
13
    	isFinished = false;
14
        requires(Robot.SUB_MANIPULATOR);
15
        this.runTime = runTime;
16
    }
17
18
    protected void initialize() {
19
    	startTime = System.currentTimeMillis();
20
    }
21
22
    protected void execute() {
23
        if (startTime + runTime >= System.currentTimeMillis()){
24
            Robot.SUB_MANIPULATOR.spit();
25
        } else {
26
        	isFinished = true;
27
        }
28
    }
29
30
    protected boolean isFinished() { return isFinished; }
31
32
    protected void end() {
33
    	Robot.SUB_MANIPULATOR.stopSpinning();
34
    	isFinished = false;
35
    }
36
37
    protected void interrupted() {
38
        end();
39
    }
40
}
41