Skip to content

Commit

Permalink
Checkstyle fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson committed Feb 17, 2024
1 parent 0ebc48a commit 49cb64c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public final class StreamDiscoverer implements AutoCloseable {
* @param cameraName the name of the camera to discover streams for
*/
public StreamDiscoverer(NetworkTable publisherTable, String cameraName) {
streamsSub = publisherTable.getSubTable(cameraName).getStringArrayTopic(STREAMS_KEY).subscribe(emptyStringArray, PubSubOption.hidden(true));
streamsSub = publisherTable.getSubTable(cameraName).getStringArrayTopic(STREAMS_KEY)
.subscribe(emptyStringArray, PubSubOption.hidden(true));
streamsListener = publisherTable.getInstance().addListener(
streamsSub,
EnumSet.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public RecorderController(NetworkTableInstance ntInstance,
String fileNameFormatKey,
Recorder recorder) {
startStopControlSub = ntInstance.getBooleanTopic(startStopKey).subscribe(false, PubSubOption.hidden(true));
fileNameFormatSub =
ntInstance.getStringTopic(fileNameFormatKey).subscribe(Recorder.DEFAULT_RECORDING_FILE_NAME_FORMAT, PubSubOption.hidden(true));
fileNameFormatSub = ntInstance.getStringTopic(fileNameFormatKey)
.subscribe(Recorder.DEFAULT_RECORDING_FILE_NAME_FORMAT, PubSubOption.hidden(true));
this.recorder = recorder;
this.markerGenerator = new MarkerGenerator(ntInstance, recorder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ final class TabGenerator {
public void start() {
// Make sure all tabs exist if they're defined, even if they're empty
NetworkTable rootMetaTable = inst.getTable(METADATA_TABLE_NAME);
tabsSubscriber = rootMetaTable.getStringArrayTopic(TABS_ENTRY_KEY).subscribe(new String[] {}, PubSubOption.hidden(true));
tabsSubscriber = rootMetaTable.getStringArrayTopic(TABS_ENTRY_KEY)
.subscribe(new String[] {}, PubSubOption.hidden(true));
tabsListener = inst.addListener(tabsSubscriber,
EnumSet.of(NetworkTableEvent.Kind.kValueAll, NetworkTableEvent.Kind.kImmediate), event -> {
for (String tabName : event.valueData.value.getStringArray()) {
Expand All @@ -100,7 +101,8 @@ public void start() {
}
});

metadataSubscriber = new MultiSubscriber(inst, new String[] {METADATA_TABLE_NAME + "/"}, PubSubOption.hidden(true));
metadataSubscriber =
new MultiSubscriber(inst, new String[] {METADATA_TABLE_NAME + "/"}, PubSubOption.hidden(true));
metadataListener = inst.addListener(
metadataSubscriber,
EnumSet.of(NetworkTableEvent.Kind.kValueAll, NetworkTableEvent.Kind.kImmediate),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,21 @@ public static String topicNameForEvent(NetworkTableEvent event) {
}
}

/**
* Gets the data type associated with the given network table type string.
*
* @param typeString the network table type string to get the data type for
*
* @return the data type most closely associated with the given type string
*/
public static DataType dataTypeForTypeString(String typeString) {
if ("boolean".equals(typeString)) {
return DataTypes.Boolean;
} else if ("double".equals(typeString) || "int".equals(typeString) || "float".equals(typeString)) {
return DataTypes.Number;
} else if ("string".equals(typeString) || "json".equals(typeString)) {
return DataTypes.String;
} else if ("raw".equals(typeString)) {
} else if ("raw".equals(typeString) || "msgpack".equals(typeString) || "protobuf".equals(typeString)) {
return DataTypes.ByteArray;
} else if ("boolean[]".equals(typeString)) {
return DataTypes.BooleanArray;
Expand Down

0 comments on commit 49cb64c

Please sign in to comment.