Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary boxing #7539

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ public void removeRef() {

private static DataStore getForModule(int module) {
synchronized (m_handleLock) {
Integer moduleBoxed = module;
DataStore pcm = m_handleMap.get(moduleBoxed);
DataStore pcm = m_handleMap.get(module);
if (pcm == null) {
pcm = new DataStore(module);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ public void removeRef() {

private static DataStore getForModule(int module) {
synchronized (m_handleLock) {
Integer moduleBoxed = module;
DataStore pcm = m_handleMap.get(moduleBoxed);
DataStore pcm = m_handleMap.get(module);
if (pcm == null) {
pcm = new DataStore(module);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class CounterTest extends AbstractComsSetup {
private static FakeCounterFixture counter = null;
private static final Logger logger = Logger.getLogger(CounterTest.class.getName());

Integer m_input;
Integer m_output;
int m_input;
int m_output;

@Override
protected Logger getClassLogger() {
Expand All @@ -40,10 +40,7 @@ protected Logger getClassLogger() {
* @param input The input Port
* @param output The output Port
*/
public CounterTest(Integer input, Integer output) {
assert input != null;
assert output != null;

public CounterTest(int input, int output) {
m_input = input;
m_output = output;
// System.out.println("Counter Test: Input: " + input + " Output: " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected Logger getClassLogger() {
* @param input The port for the input wire
* @param output The port for the output wire
*/
public DIOCrossConnectTest(Integer input, Integer output) {
public DIOCrossConnectTest(int input, int output) {
if (dio != null) {
dio.teardown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void tearDownAfterClass() {
* @param mef Motor encoder fixture.
* @param expectedCurrentDraw Expected current draw in Amps.
*/
public PDPTest(MotorEncoderFixture<?> mef, Double expectedCurrentDraw) {
public PDPTest(MotorEncoderFixture<?> mef, double expectedCurrentDraw) {
logger.fine("Constructor with: " + mef.getType());
if (me != null && !me.equals(mef)) {
me.teardown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public class PIDTest extends AbstractComsSetup {
private PIDController m_controller = null;
private static MotorEncoderFixture<?> me = null;

private final Double m_p;
private final Double m_i;
private final Double m_d;
private final double m_p;
private final double m_i;
private final double m_d;

@Override
protected Logger getClassLogger() {
Expand All @@ -58,7 +58,7 @@ protected Logger getClassLogger() {
* @param d D gain.
* @param mef Motor encoder fixture.
*/
public PIDTest(Double p, Double i, Double d, MotorEncoderFixture<?> mef) {
public PIDTest(double p, double i, double d, MotorEncoderFixture<?> mef) {
logger.fine("Constructor with: " + mef.getType());
if (PIDTest.me != null && !PIDTest.me.equals(mef)) {
PIDTest.me.teardown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ public DIOCrossConnectFixture(DigitalInput input, DigitalOutput output) {
* @param input The port of the {@link DigitalInput}
* @param output The port of the {@link DigitalOutput}
*/
public DIOCrossConnectFixture(Integer input, Integer output) {
assert input != null;
assert output != null;
assert !input.equals(output);
public DIOCrossConnectFixture(int input, int output) {
assert input != output;
m_input = new DigitalInput(input);
m_output = new DigitalOutput(output);
m_allocated = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ private NumericalIntegration() {
* @param dtSeconds The time over which to integrate.
* @return the integration of dx/dt = f(x) for dt.
*/
@SuppressWarnings("overloads")
public static double rk4(DoubleFunction<Double> f, double x, double dtSeconds) {
final var h = dtSeconds;
final var k1 = f.apply(x);
Expand All @@ -45,9 +44,8 @@ public static double rk4(DoubleFunction<Double> f, double x, double dtSeconds) {
* @param dtSeconds The time over which to integrate.
* @return The result of Runge Kutta integration (4th order).
*/
@SuppressWarnings("overloads")
public static double rk4(
BiFunction<Double, Double, Double> f, double x, Double u, double dtSeconds) {
BiFunction<Double, Double, Double> f, double x, double u, double dtSeconds) {
KangarooKoala marked this conversation as resolved.
Show resolved Hide resolved
final var h = dtSeconds;

final var k1 = f.apply(x, u);
Expand All @@ -69,7 +67,6 @@ public static double rk4(
* @param dtSeconds The time over which to integrate.
* @return the integration of dx/dt = f(x, u) for dt.
*/
@SuppressWarnings("overloads")
public static <States extends Num, Inputs extends Num> Matrix<States, N1> rk4(
BiFunction<Matrix<States, N1>, Matrix<Inputs, N1>, Matrix<States, N1>> f,
Matrix<States, N1> x,
Expand All @@ -94,7 +91,6 @@ public static <States extends Num, Inputs extends Num> Matrix<States, N1> rk4(
* @param dtSeconds The time over which to integrate.
* @return 4th order Runge-Kutta integration of dx/dt = f(x) for dt.
*/
@SuppressWarnings("overloads")
public static <States extends Num> Matrix<States, N1> rk4(
Function<Matrix<States, N1>, Matrix<States, N1>> f, Matrix<States, N1> x, double dtSeconds) {
final var h = dtSeconds;
Expand Down Expand Up @@ -145,7 +141,6 @@ public static <Rows extends Num, Cols extends Num> Matrix<Rows, Cols> rk4(
* @param dtSeconds The time over which to integrate.
* @return the integration of dx/dt = f(x, u) for dt.
*/
@SuppressWarnings("overloads")
public static <States extends Num, Inputs extends Num> Matrix<States, N1> rkdp(
BiFunction<Matrix<States, N1>, Matrix<Inputs, N1>, Matrix<States, N1>> f,
Matrix<States, N1> x,
Expand All @@ -166,7 +161,6 @@ public static <States extends Num, Inputs extends Num> Matrix<States, N1> rkdp(
* @param maxError The maximum acceptable truncation error. Usually a small number like 1e-6.
* @return the integration of dx/dt = f(x, u) for dt.
*/
@SuppressWarnings("overloads")
public static <States extends Num, Inputs extends Num> Matrix<States, N1> rkdp(
BiFunction<Matrix<States, N1>, Matrix<Inputs, N1>, Matrix<States, N1>> f,
Matrix<States, N1> x,
Expand Down Expand Up @@ -291,7 +285,6 @@ public static <States extends Num, Inputs extends Num> Matrix<States, N1> rkdp(
* @param maxError The maximum acceptable truncation error. Usually a small number like 1e-6.
* @return the integration of dx/dt = f(x, u) for dt.
*/
@SuppressWarnings("overloads")
public static <Rows extends Num, Cols extends Num> Matrix<Rows, Cols> rkdp(
BiFunction<Double, Matrix<Rows, Cols>, Matrix<Rows, Cols>> f,
double t,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void remove(int handle) {
public void wakeup() {
m_lock.lock();
try {
for (Integer eventHandle : m_events) {
for (int eventHandle : m_events) {
WPIUtilJNI.setEvent(eventHandle);
}
} finally {
Expand Down
Loading