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

Complexity

Total Complexity 7

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 6
Bugs 0 Features 1
Metric Value
dl 0
loc 33
rs 10
c 6
b 0
f 1
wmc 7

6 Methods

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