org.usfirst.frc.team3695.robot.subsystems.SubsystemCompressor   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
dl 0
loc 20
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A initDefaultCommand() 0 1 1
A isEnabled() 0 2 1
A setState(boolean) 0 2 2
A toggle() 0 2 1
toggle 0 2 ?
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