-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParallelLoggingCommand.java
More file actions
29 lines (24 loc) · 1.2 KB
/
ParallelLoggingCommand.java
File metadata and controls
29 lines (24 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package org.usfirst.frc4048.common.logging;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import java.util.Arrays;
public class ParallelLoggingCommand extends GroupLoggingCommand {
/**
* Constructor for parallel command group.
*
* @param namePrefix the name for the group - this is where the sub-commands for this group will be nested in
* @param commands the sub commands for this group (either regular commands or LoggingCommand are OK)
*/
public ParallelLoggingCommand(String namePrefix, Command... commands) {
// Call super with an empty group, populate children afterward
super(namePrefix, new ParallelCommandGroup());
LoggingCommand[] wrapped = CommandUtil.wrapForLogging(namePrefix, commands);
((ParallelCommandGroup) getUnderlying()).addCommands(wrapped);
addLoggingCommands(Arrays.asList(wrapped));
}
public final void addCommands(Command... commands) {
LoggingCommand[] wrapped = CommandUtil.wrapForLogging(getNamePrefix(), commands);
((ParallelCommandGroup) getUnderlying()).addCommands(wrapped);
addLoggingCommands(Arrays.asList(wrapped));
}
}