org.usfirst.frc.team3695.robot.util.Field   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
getOurScale 0 5 ?
A getOurScale() 0 5 2
getThierScale 0 5 ?
A getThierScale() 0 5 2
A getSwitch() 0 5 2
getSwitch 0 5 ?
1
package org.usfirst.frc.team3695.robot.util;
2
3
import edu.wpi.first.wpilibj.DriverStation;
4
import org.usfirst.frc.team3695.robot.enumeration.Position;
5
6
public class Field {
0 ignored issues
show
Best Practice introduced by
This looks like a utility class. You may want to hide the implict public constructor behind a private one, so the class cannot be instantiated,
Loading history...
7
	public static Position getOurScale() {
8
		if (DriverStation.getInstance().getGameSpecificMessage().charAt(0) == 'L') {
9
			return Position.LEFT;
10
		} else {
11
			return Position.RIGHT;
12
		}
13
	}
14
	
15
	public static Position getThierScale() {
16
		if (DriverStation.getInstance().getGameSpecificMessage().charAt(2) == 'L') {
0 ignored issues
show
Comprehensibility introduced by
Consider assigning this magic number 2 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...
17
			return Position.LEFT;
18
		} else {
19
			return Position.RIGHT;
20
		}
21
	}
22
	
23
	public static Position getSwitch() {
24
		if (DriverStation.getInstance().getGameSpecificMessage().charAt(1) == 'L') {
25
			return Position.LEFT;
26
		} else {
27
			return Position.RIGHT;
28
		}
29
	}
30
}
31