Enforce leading/trailing zeros in Java numeric constants (#2105)

Enforce that integer literals must not have leading zeros and that floating point literals must have leading or trailing zeros in Java.
This commit is contained in:
Austin Shalit
2019-11-20 23:13:15 -05:00
committed by Peter Johnson
parent fa85fbfc1c
commit 4ebae17123
40 changed files with 92 additions and 72 deletions

View File

@@ -84,7 +84,7 @@ public class Counter implements CounterBase, PIDSource, Sendable, AutoCloseable
m_upSource = null;
m_downSource = null;
setMaxPeriod(.5);
setMaxPeriod(0.5);
HAL.report(tResourceType.kResourceType_Counter, m_index + 1, mode.value + 1);
SendableRegistry.addLW(this, "Counter", m_index);

View File

@@ -38,7 +38,7 @@ public class DMC60 extends PWMSpeedController {
public DMC60(final int channel) {
super(channel);
setBounds(2.004, 1.52, 1.50, 1.48, .997);
setBounds(2.004, 1.52, 1.50, 1.48, 0.997);
setPeriodMultiplier(PeriodMultiplier.k1X);
setSpeed(0.0);
setZeroLatch();

View File

@@ -38,7 +38,7 @@ public class Jaguar extends PWMSpeedController {
public Jaguar(final int channel) {
super(channel);
setBounds(2.31, 1.55, 1.507, 1.454, .697);
setBounds(2.31, 1.55, 1.507, 1.454, 0.697);
setPeriodMultiplier(PeriodMultiplier.k1X);
setSpeed(0.0);
setZeroLatch();

View File

@@ -36,7 +36,7 @@ public class PWMSparkMax extends PWMSpeedController {
public PWMSparkMax(final int channel) {
super(channel);
setBounds(2.003, 1.55, 1.50, 1.46, .999);
setBounds(2.003, 1.55, 1.50, 1.46, 0.999);
setPeriodMultiplier(PeriodMultiplier.k1X);
setSpeed(0.0);
setZeroLatch();

View File

@@ -38,7 +38,7 @@ public class PWMTalonSRX extends PWMSpeedController {
public PWMTalonSRX(final int channel) {
super(channel);
setBounds(2.004, 1.52, 1.50, 1.48, .997);
setBounds(2.004, 1.52, 1.50, 1.48, 0.997);
setPeriodMultiplier(PeriodMultiplier.k1X);
setSpeed(0.0);
setZeroLatch();

View File

@@ -38,7 +38,7 @@ public class PWMVictorSPX extends PWMSpeedController {
public PWMVictorSPX(final int channel) {
super(channel);
setBounds(2.004, 1.52, 1.50, 1.48, .997);
setBounds(2.004, 1.52, 1.50, 1.48, 0.997);
setPeriodMultiplier(PeriodMultiplier.k1X);
setSpeed(0.0);
setZeroLatch();

View File

@@ -178,7 +178,7 @@ public class RobotDrive extends MotorSafety implements AutoCloseable {
double value = Math.log(-curve);
double ratio = (value - m_sensitivity) / (value + m_sensitivity);
if (ratio == 0) {
ratio = .0000000001;
ratio = 0.0000000001;
}
leftOutput = outputMagnitude / ratio;
rightOutput = outputMagnitude;
@@ -186,7 +186,7 @@ public class RobotDrive extends MotorSafety implements AutoCloseable {
double value = Math.log(curve);
double ratio = (value - m_sensitivity) / (value + m_sensitivity);
if (ratio == 0) {
ratio = .0000000001;
ratio = 0.0000000001;
}
leftOutput = outputMagnitude;
rightOutput = outputMagnitude / ratio;

View File

@@ -33,7 +33,7 @@ public class SD540 extends PWMSpeedController {
* Common initialization code called by all constructors.
*/
protected void initSD540() {
setBounds(2.05, 1.55, 1.50, 1.44, .94);
setBounds(2.05, 1.55, 1.50, 1.44, 0.94);
setPeriodMultiplier(PeriodMultiplier.k1X);
setSpeed(0.0);
setZeroLatch();

View File

@@ -23,7 +23,7 @@ public class Servo extends PWM {
private static final double kMinServoAngle = 0.0;
protected static final double kDefaultMaxServoPWM = 2.4;
protected static final double kDefaultMinServoPWM = .6;
protected static final double kDefaultMinServoPWM = 0.6;
/**
* Constructor.<br>

View File

@@ -33,7 +33,7 @@ public class Spark extends PWMSpeedController {
* Common initialization code called by all constructors.
*/
protected void initSpark() {
setBounds(2.003, 1.55, 1.50, 1.46, .999);
setBounds(2.003, 1.55, 1.50, 1.46, 0.999);
setPeriodMultiplier(PeriodMultiplier.k1X);
setSpeed(0.0);
setZeroLatch();

View File

@@ -38,7 +38,7 @@ public class Talon extends PWMSpeedController {
public Talon(final int channel) {
super(channel);
setBounds(2.037, 1.539, 1.513, 1.487, .989);
setBounds(2.037, 1.539, 1.513, 1.487, 0.989);
setPeriodMultiplier(PeriodMultiplier.k1X);
setSpeed(0.0);
setZeroLatch();

View File

@@ -38,7 +38,7 @@ public class VictorSP extends PWMSpeedController {
public VictorSP(final int channel) {
super(channel);
setBounds(2.004, 1.52, 1.50, 1.48, .997);
setBounds(2.004, 1.52, 1.50, 1.48, 0.997);
setPeriodMultiplier(PeriodMultiplier.k1X);
setSpeed(0.0);
setZeroLatch();