mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
[build] Apply spotless for java formatting (#1768)
Update checkstyle config to be compatible with spotless. Co-authored-by: Austin Shalit <austinshalit@gmail.com>
This commit is contained in:
@@ -7,9 +7,7 @@ package edu.wpi.first.wpilibj.mockhardware;
|
||||
import edu.wpi.first.wpilibj.DigitalOutput;
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
|
||||
/**
|
||||
* Simulates an encoder for testing purposes.
|
||||
*/
|
||||
/** Simulates an encoder for testing purposes. */
|
||||
public class FakeCounterSource implements AutoCloseable {
|
||||
private Thread m_task;
|
||||
private int m_count;
|
||||
@@ -17,9 +15,7 @@ public class FakeCounterSource implements AutoCloseable {
|
||||
private DigitalOutput m_output;
|
||||
private boolean m_allocated;
|
||||
|
||||
/**
|
||||
* Thread object that allows emulation of an encoder.
|
||||
*/
|
||||
/** Thread object that allows emulation of an encoder. */
|
||||
private class EncoderThread extends Thread {
|
||||
FakeCounterSource m_encoder;
|
||||
|
||||
@@ -65,9 +61,7 @@ public class FakeCounterSource implements AutoCloseable {
|
||||
initEncoder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Object with minimum memory leak.
|
||||
*/
|
||||
/** Destroy Object with minimum memory leak. */
|
||||
@Override
|
||||
public void close() {
|
||||
m_task = null;
|
||||
@@ -78,25 +72,19 @@ public class FakeCounterSource implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Common initailization code.
|
||||
*/
|
||||
/** Common initailization code. */
|
||||
private void initEncoder() {
|
||||
m_milliSec = 1;
|
||||
m_task = new EncoderThread(this);
|
||||
m_output.set(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the thread execution task.
|
||||
*/
|
||||
/** Starts the thread execution task. */
|
||||
public void start() {
|
||||
m_task.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for the thread to complete.
|
||||
*/
|
||||
/** Waits for the thread to complete. */
|
||||
public void complete() {
|
||||
try {
|
||||
m_task.join();
|
||||
@@ -107,9 +95,7 @@ public class FakeCounterSource implements AutoCloseable {
|
||||
Timer.delay(0.01);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts and completes a task set - does not return until thred has finished its operations.
|
||||
*/
|
||||
/** Starts and completes a task set - does not return until thred has finished its operations. */
|
||||
public void execute() {
|
||||
start();
|
||||
complete();
|
||||
|
||||
@@ -7,9 +7,7 @@ package edu.wpi.first.wpilibj.mockhardware;
|
||||
import edu.wpi.first.wpilibj.DigitalOutput;
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
|
||||
/**
|
||||
* Emulates a quadrature encoder.
|
||||
*/
|
||||
/** Emulates a quadrature encoder. */
|
||||
public class FakeEncoderSource implements AutoCloseable {
|
||||
private Thread m_task;
|
||||
private int m_count;
|
||||
@@ -19,9 +17,7 @@ public class FakeEncoderSource implements AutoCloseable {
|
||||
private final DigitalOutput m_outputB;
|
||||
private final boolean m_allocatedOutputs;
|
||||
|
||||
/**
|
||||
* Thread object that allows emulation of a quadrature encoder.
|
||||
*/
|
||||
/** Thread object that allows emulation of a quadrature encoder. */
|
||||
private class QuadEncoderThread extends Thread {
|
||||
FakeEncoderSource m_encoder;
|
||||
|
||||
@@ -88,9 +84,7 @@ public class FakeEncoderSource implements AutoCloseable {
|
||||
initQuadEncoder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Frees the resource.
|
||||
*/
|
||||
/** Frees the resource. */
|
||||
@Override
|
||||
public void close() {
|
||||
m_task = null;
|
||||
@@ -100,9 +94,7 @@ public class FakeEncoderSource implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Common initialization code.
|
||||
*/
|
||||
/** Common initialization code. */
|
||||
private void initQuadEncoder() {
|
||||
m_milliSec = 1;
|
||||
m_forward = true;
|
||||
@@ -111,16 +103,12 @@ public class FakeEncoderSource implements AutoCloseable {
|
||||
m_outputB.set(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the thread.
|
||||
*/
|
||||
/** Starts the thread. */
|
||||
public void start() {
|
||||
m_task.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for thread to end.
|
||||
*/
|
||||
/** Waits for thread to end. */
|
||||
public void complete() {
|
||||
try {
|
||||
m_task.join();
|
||||
@@ -131,9 +119,7 @@ public class FakeEncoderSource implements AutoCloseable {
|
||||
Timer.delay(0.01);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs and waits for thread to end before returning.
|
||||
*/
|
||||
/** Runs and waits for thread to end before returning. */
|
||||
public void execute() {
|
||||
start();
|
||||
complete();
|
||||
|
||||
@@ -6,9 +6,7 @@ package edu.wpi.first.wpilibj.mockhardware;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogOutput;
|
||||
|
||||
/**
|
||||
* A fake source to provide output to a {@link edu.wpi.first.wpilibj.interfaces.Potentiometer}.
|
||||
*/
|
||||
/** A fake source to provide output to a {@link edu.wpi.first.wpilibj.interfaces.Potentiometer}. */
|
||||
public class FakePotentiometerSource implements AutoCloseable {
|
||||
private AnalogOutput m_output;
|
||||
private boolean m_initOutput;
|
||||
@@ -19,7 +17,7 @@ public class FakePotentiometerSource implements AutoCloseable {
|
||||
/**
|
||||
* Constructs the fake source.
|
||||
*
|
||||
* @param output The analog port to output the signal on
|
||||
* @param output The analog port to output the signal on
|
||||
* @param defaultPotMaxAngle The default maximum angle the pot supports.
|
||||
*/
|
||||
public FakePotentiometerSource(AnalogOutput output, double defaultPotMaxAngle) {
|
||||
@@ -77,9 +75,7 @@ public class FakePotentiometerSource implements AutoCloseable {
|
||||
return voltage * (m_potMaxAngle / m_potMaxVoltage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Frees the resouce.
|
||||
*/
|
||||
/** Frees the resouce. */
|
||||
@Override
|
||||
public void close() {
|
||||
if (m_initOutput) {
|
||||
|
||||
Reference in New Issue
Block a user