Skip to content

Commit 0e9909b

Browse files
committed
spotlessApply
1 parent f6dedaa commit 0e9909b

File tree

444 files changed

+9335
-10395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

444 files changed

+9335
-10395
lines changed

api-test-util/src/main/java/edu/wpi/first/shuffleboard/api/testutil/MockPreferences.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import java.util.prefs.BackingStoreException;
77

88
/**
9-
* A mock preferences class that stores values in a {@link Map Map<String, String>}.
10-
* This cannot have child preference nodes.
9+
* A mock preferences class that stores values in a {@link Map Map<String, String>}. This
10+
* cannot have child preference nodes.
1111
*/
1212
public class MockPreferences extends AbstractPreferences {
1313

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,39 @@
11
package edu.wpi.first.shuffleboard.api;
22

33
import edu.wpi.first.shuffleboard.api.properties.AsyncProperty;
4-
54
import javafx.beans.property.ObjectProperty;
65
import javafx.beans.property.Property;
76

8-
/**
9-
* An enum representing the possible modes of dashboard operation.
10-
*/
7+
/** An enum representing the possible modes of dashboard operation. */
118
public enum DashboardMode {
129

13-
/**
14-
* Normal operation. No recording or playback is taking place.
15-
*/
10+
/** Normal operation. No recording or playback is taking place. */
1611
NORMAL,
1712

18-
/**
19-
* The dashboard behaves as {@link #NORMAL}, but records all incoming data in the background.
20-
*/
13+
/** The dashboard behaves as {@link #NORMAL}, but records all incoming data in the background. */
2114
RECORDING,
2215

23-
/**
24-
* When in this mode, the dashboard is playing back recorded data.
25-
*/
16+
/** When in this mode, the dashboard is playing back recorded data. */
2617
PLAYBACK;
2718

28-
private static final ObjectProperty<DashboardMode> currentMode
29-
= new AsyncProperty<>(DashboardMode.class, "currentMode", NORMAL);
19+
private static final ObjectProperty<DashboardMode> currentMode =
20+
new AsyncProperty<>(DashboardMode.class, "currentMode", NORMAL);
3021

3122
public static Property<DashboardMode> currentModeProperty() {
3223
return currentMode;
3324
}
3425

35-
/**
36-
* Gets the current mode of the dashboard.
37-
*/
26+
/** Gets the current mode of the dashboard. */
3827
public static DashboardMode getCurrentMode() {
3928
return currentMode.get();
4029
}
4130

42-
/**
43-
* Sets the current mode of the dashboard.
44-
*/
31+
/** Sets the current mode of the dashboard. */
4532
public static void setCurrentMode(DashboardMode currentMode) {
4633
DashboardMode.currentMode.set(currentMode);
4734
}
4835

4936
public static boolean inPlayback() {
5037
return getCurrentMode() == PLAYBACK;
5138
}
52-
5339
}

api/src/main/java/edu/wpi/first/shuffleboard/api/Populatable.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
import edu.wpi.first.shuffleboard.api.sources.DataSource;
44
import edu.wpi.first.shuffleboard.api.sources.SourceTypes;
55

6-
/**
7-
* Common interface for items that support auto-population of UI components by the application.
8-
*/
6+
/** Common interface for items that support auto-population of UI components by the application. */
97
public interface Populatable {
108

119
/**
12-
* Checks if the given data source is supported, ie it matches some criteria; for example, a widget that populates
13-
* with data under a certain path should check if the source's ID starts with that path. Containers with no criteria
14-
* should always return {@code true}.
10+
* Checks if the given data source is supported, ie it matches some criteria; for example, a
11+
* widget that populates with data under a certain path should check if the source's ID starts
12+
* with that path. Containers with no criteria should always return {@code true}.
1513
*
1614
* @param sourceId the ID of the source to check
1715
*/
@@ -32,8 +30,8 @@ public interface Populatable {
3230
void addComponentFor(DataSource<?> source);
3331

3432
/**
35-
* If possible, adds a component for a data source. A component will only be added iff the source is supported and
36-
* there is no component present that already corresponds to that source.
33+
* If possible, adds a component for a data source. A component will only be added iff the source
34+
* is supported and there is no component present that already corresponds to that source.
3735
*
3836
* @param source the source to check/add a component for
3937
*/
@@ -44,8 +42,8 @@ default void addComponentIfPossible(DataSource<?> source) {
4442
}
4543

4644
/**
47-
* If possible, adds a component for a data source. A component will only be added iff the source ID is supported and
48-
* there is no component present that already corresponds to that source ID.
45+
* If possible, adds a component for a data source. A component will only be added iff the source
46+
* ID is supported and there is no component present that already corresponds to that source ID.
4947
*
5048
* @param sourceTypes the source type registry to use to create a new source to populate
5149
* @param sourceId the ID of the source for the component to add
@@ -55,5 +53,4 @@ default void addComponentIfPossible(SourceTypes sourceTypes, String sourceId) {
5553
addComponentFor(sourceTypes.forUri(sourceId));
5654
}
5755
}
58-
5956
}

api/src/main/java/edu/wpi/first/shuffleboard/api/PropertyParser.java

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
package edu.wpi.first.shuffleboard.api;
22

33
/**
4-
* Parses arbitrary input and returns the result. This is used to set the values of
5-
* {@link edu.wpi.first.shuffleboard.api.widget.Component Component} settings provided by a remote definition (such as
6-
* a FRC robot program).
4+
* Parses arbitrary input and returns the result. This is used to set the values of {@link
5+
* edu.wpi.first.shuffleboard.api.widget.Component Component} settings provided by a remote
6+
* definition (such as a FRC robot program).
77
*
88
* @param <T> the type of values this parser provides
99
*/
1010
public interface PropertyParser<T> {
1111

1212
/**
13-
* Creates a new property parser for an enum type. Valid inputs are {@code E}, {@code String} (matching the enum
14-
* constant name), and {@code Integer} (enum ordinal).
13+
* Creates a new property parser for an enum type. Valid inputs are {@code E}, {@code String}
14+
* (matching the enum constant name), and {@code Integer} (enum ordinal).
1515
*
1616
* @param type the enum type to create a parser for
17-
* @param <E> the type of the enum class
18-
*
17+
* @param <E> the type of the enum class
1918
* @return a parser that outputs constants from the given enum type
2019
*/
2120
static <E extends Enum<E>> PropertyParser<E> forEnum(Class<E> type) {
@@ -30,9 +29,7 @@ public Class<E> outputType() {
3029

3130
@Override
3231
public boolean canParse(Object input) {
33-
return type.isInstance(input)
34-
|| input instanceof String
35-
|| input instanceof Integer;
32+
return type.isInstance(input) || input instanceof String || input instanceof Integer;
3633
}
3734

3835
@Override
@@ -55,16 +52,13 @@ public E parse(Object input) {
5552
};
5653
}
5754

58-
/**
59-
* Gets the type of the output of the parser.
60-
*/
55+
/** Gets the type of the output of the parser. */
6156
Class<T> outputType();
6257

6358
/**
6459
* Checks if the given input is supported by this parser.
6560
*
6661
* @param input the input to check
67-
*
6862
* @return true if the input can be {@link #parse(Object) parsed}, false if not
6963
*/
7064
boolean canParse(Object input);
@@ -73,7 +67,6 @@ public E parse(Object input) {
7367
* Parses the given input and returns the result.
7468
*
7569
* @param input the value to parse
76-
*
7770
* @return the parsed value
7871
*/
7972
T parse(Object input);

api/src/main/java/edu/wpi/first/shuffleboard/api/PropertyParsers.java

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
import edu.wpi.first.shuffleboard.api.util.Registry;
44
import edu.wpi.first.shuffleboard.api.widget.LayoutBase;
5-
65
import java.util.Optional;
76
import java.util.Set;
87
import java.util.stream.Collectors;
9-
108
import javafx.geometry.Orientation;
119
import javafx.scene.paint.Color;
1210

13-
/**
14-
* Registry for {@link PropertyParser PropertyParsers}.
15-
*/
11+
/** Registry for {@link PropertyParser PropertyParsers}. */
1612
public final class PropertyParsers extends Registry<PropertyParser<?>> {
1713

1814
private static final PropertyParser<Orientation> ORIENTATION =
@@ -58,28 +54,29 @@ public void unregister(PropertyParser<?> item) {
5854
/**
5955
* Parses the given input as a value of the given output type.
6056
*
61-
* @param input the value to parse
57+
* @param input the value to parse
6258
* @param outputType the type of the value to parse as
63-
* @param <T> the type of the parsed result
64-
*
59+
* @param <T> the type of the parsed result
6560
* @return the parse result
66-
*
6761
* @throws IllegalStateException if there are multiple registered parsers for type {@code T}
6862
*/
6963
public <T> Optional<T> parse(Object input, Class<T> outputType) {
70-
Set<T> possibilities = getItems()
71-
.stream()
72-
.filter(p -> p.outputType().isAssignableFrom(outputType))
73-
.filter(p -> p.canParse(input))
74-
.map(p -> (PropertyParser<T>) p)
75-
.map(p -> p.parse(input))
76-
.collect(Collectors.toSet());
64+
Set<T> possibilities =
65+
getItems().stream()
66+
.filter(p -> p.outputType().isAssignableFrom(outputType))
67+
.filter(p -> p.canParse(input))
68+
.map(p -> (PropertyParser<T>) p)
69+
.map(p -> p.parse(input))
70+
.collect(Collectors.toSet());
7771
if (possibilities.isEmpty()) {
7872
return Optional.empty();
7973
}
8074
if (possibilities.size() > 1) {
8175
throw new IllegalStateException(
82-
"Multiple parsers for " + input + " supporting output type " + outputType.getSimpleName());
76+
"Multiple parsers for "
77+
+ input
78+
+ " supporting output type "
79+
+ outputType.getSimpleName());
8380
}
8481
return Optional.of(possibilities.iterator().next());
8582
}
@@ -143,9 +140,7 @@ public Class<Color> outputType() {
143140

144141
@Override
145142
public boolean canParse(Object input) {
146-
return input instanceof Color
147-
|| input instanceof String
148-
|| input instanceof Number;
143+
return input instanceof Color || input instanceof String || input instanceof Number;
149144
}
150145

151146
@Override

api/src/main/java/edu/wpi/first/shuffleboard/api/TileTitleDisplayMode.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
package edu.wpi.first.shuffleboard.api;
22

33
public enum TileTitleDisplayMode {
4-
/**
5-
* The default tile view type - large title ad header bar.
6-
*/
4+
/** The default tile view type - large title ad header bar. */
75
DEFAULT("Default"),
8-
/**
9-
* Minimal tiles with smaller header bars and titles.
10-
*/
6+
/** Minimal tiles with smaller header bars and titles. */
117
MINIMAL("Minimal"),
12-
/**
13-
* No header bars at all.
14-
*/
8+
/** No header bars at all. */
159
HIDDEN("Hidden");
1610

1711
private final String humanReadable;

api/src/main/java/edu/wpi/first/shuffleboard/api/components/AbstractNumberField.java

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
package edu.wpi.first.shuffleboard.api.components;
22

33
import edu.wpi.first.shuffleboard.api.util.PropertyUtils;
4-
54
import java.util.Objects;
6-
75
import javafx.beans.property.Property;
86
import javafx.beans.property.SimpleObjectProperty;
97
import javafx.scene.control.TextField;
108
import javafx.scene.control.TextFormatter;
119

12-
/**
13-
* A type of text field that only accepts valid numbers.
14-
*/
10+
/** A type of text field that only accepts valid numbers. */
1511
public abstract class AbstractNumberField<N extends Number> extends TextField {
1612

1713
private final Property<N> number = new SimpleObjectProperty<>(this, "number");
@@ -23,28 +19,31 @@ protected AbstractNumberField() {
2319
getStyleClass().add("number-field");
2420
setText("0");
2521
setNumber(getNumberFromText("0"));
26-
setTextFormatter(new TextFormatter<>(change -> {
27-
String text = change.getControlNewText();
28-
if (isCompleteNumber(text)) {
29-
// Bounds check
30-
final N number = getNumberFromText(text);
31-
if (getMaxValue() != null && number.doubleValue() > getMaxValue().doubleValue()) {
32-
return null;
33-
}
34-
if (getMinValue() != null && number.doubleValue() < getMinValue().doubleValue()) {
35-
return null;
36-
}
37-
}
38-
if (isStartOfNumber(text)) {
39-
return change;
40-
}
41-
return null;
42-
}));
22+
setTextFormatter(
23+
new TextFormatter<>(
24+
change -> {
25+
String text = change.getControlNewText();
26+
if (isCompleteNumber(text)) {
27+
// Bounds check
28+
final N number = getNumberFromText(text);
29+
if (getMaxValue() != null && number.doubleValue() > getMaxValue().doubleValue()) {
30+
return null;
31+
}
32+
if (getMinValue() != null && number.doubleValue() < getMinValue().doubleValue()) {
33+
return null;
34+
}
35+
}
36+
if (isStartOfNumber(text)) {
37+
return change;
38+
}
39+
return null;
40+
}));
4341
PropertyUtils.bindBidirectionalWithConverter(
4442
textProperty(),
4543
number,
4644
text -> isCompleteNumber(text) ? getNumberFromText(text) : getNumber(),
47-
num -> Objects.equals(num, getNumberFromText(getText())) ? getText() : getTextFromNumber(num));
45+
num ->
46+
Objects.equals(num, getNumberFromText(getText())) ? getText() : getTextFromNumber(num));
4847
}
4948

5049
protected AbstractNumberField(N initialValue) {
@@ -53,16 +52,14 @@ protected AbstractNumberField(N initialValue) {
5352
}
5453

5554
/**
56-
* Checks if the given string is a valid start to an acceptable number in text form.
57-
* This differs from {@link #isCompleteNumber(String) isCompleteNumber} because this checks if the
58-
* text is only a valid <i>beginning</i> of a string representation of a number. For example, this
59-
* method could accept a single "-" because it's a valid start to a negative number.
55+
* Checks if the given string is a valid start to an acceptable number in text form. This differs
56+
* from {@link #isCompleteNumber(String) isCompleteNumber} because this checks if the text is only
57+
* a valid <i>beginning</i> of a string representation of a number. For example, this method could
58+
* accept a single "-" because it's a valid start to a negative number.
6059
*/
6160
protected abstract boolean isStartOfNumber(String text);
6261

63-
/**
64-
* Checks if the given string is a valid number acceptable by this text field.
65-
*/
62+
/** Checks if the given string is a valid number acceptable by this text field. */
6663
protected abstract boolean isCompleteNumber(String text);
6764

6865
/**

0 commit comments

Comments
 (0)