mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[commands] Make requirements private (#6769)
This commit is contained in:
@@ -30,7 +30,7 @@ import java.util.function.BooleanSupplier;
|
||||
*/
|
||||
public abstract class Command implements Sendable {
|
||||
/** Requirements set. */
|
||||
protected Set<Subsystem> m_requirements = new HashSet<>();
|
||||
private final Set<Subsystem> m_requirements = new HashSet<>();
|
||||
|
||||
/** Default constructor. */
|
||||
@SuppressWarnings("this-escape")
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ParallelCommandGroup extends Command {
|
||||
CommandScheduler.getInstance().registerComposedCommands(commands);
|
||||
|
||||
for (Command command : commands) {
|
||||
if (!Collections.disjoint(command.getRequirements(), m_requirements)) {
|
||||
if (!Collections.disjoint(command.getRequirements(), getRequirements())) {
|
||||
throw new IllegalArgumentException(
|
||||
"Multiple commands in a parallel composition cannot require the same subsystems");
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class ParallelDeadlineGroup extends Command {
|
||||
CommandScheduler.getInstance().registerComposedCommands(commands);
|
||||
|
||||
for (Command command : commands) {
|
||||
if (!Collections.disjoint(command.getRequirements(), m_requirements)) {
|
||||
if (!Collections.disjoint(command.getRequirements(), getRequirements())) {
|
||||
throw new IllegalArgumentException(
|
||||
"Multiple commands in a parallel group cannot require the same subsystems");
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ParallelRaceGroup extends Command {
|
||||
CommandScheduler.getInstance().registerComposedCommands(commands);
|
||||
|
||||
for (Command command : commands) {
|
||||
if (!Collections.disjoint(command.getRequirements(), m_requirements)) {
|
||||
if (!Collections.disjoint(command.getRequirements(), getRequirements())) {
|
||||
throw new IllegalArgumentException(
|
||||
"Multiple commands in a parallel composition cannot require the same subsystems");
|
||||
}
|
||||
|
||||
@@ -484,6 +484,7 @@ class Command : public wpi::Sendable, public wpi::SendableHelper<Command> {
|
||||
protected:
|
||||
Command();
|
||||
|
||||
private:
|
||||
/// Requirements set.
|
||||
wpi::SmallSet<Subsystem*, 4> m_requirements;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user