isEnabled()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
1
package org.usfirst.frc.team3695.robot.subsystems;
2
3
import edu.wpi.first.wpilibj.Compressor;
4
import edu.wpi.first.wpilibj.command.Subsystem;
5
6
/** it's a compressor */
7
public class SubsystemCompressor extends Subsystem {
8
	
9
	
10
    Compressor comp = new Compressor(); // initialize compressor
11
    
12
    public void initDefaultCommand() {}
13
    
14
    /** return compressor state */
15
    public boolean isEnabled(){
16
		return comp.enabled();
17
    }
18
    
19
    /** enable/disable compressor */
20
    public void setState(boolean state){
0 ignored issues
show
Best Practice introduced by
Implementing multiple actions in one method is a bad practice. It makes methods longer and harder to read. Consider providing multiple methods instead of using state to determine the course of action.
Loading history...
21
		if (state) comp.start(); else comp.stop();
22
    }
23
    
24
   /** blindly change the state to !state */
25
    public void toggle(){
26
		setState(!isEnabled());
27
    }
28
}
29
30