getAndSetDouble
last analyzed

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
1
package org.usfirst.frc.team3695.robot.util;
2
3
import edu.wpi.first.wpilibj.Preferences;
4
5
6
/** if our code is colonial America, this class is Rhode Island */
7
public class Util {
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...
8
	
9
	/**
10
	 *	kind of self explanatory, but with some spice
11
	 *	use this mainly as a get method to retrieve values the user types into the smart dash
12
	 *		(the 'Set' part is only in case the value doesn't exist, backup is a default to use and set if it isn't there)
13
	 */
14
	static Preferences pref = Preferences.getInstance();
15
	public static double getAndSetDouble(String key, double backup) {
16
		if(!pref.containsKey(key)) pref.putDouble(key, backup);
17
		return pref.getDouble(key, backup);
18
	}
19
}
20