Skip to content

Commit

Permalink
[commands] Make requirements private
Browse files Browse the repository at this point in the history
Requires #6304
  • Loading branch information
spacey-sooty committed Jul 1, 2024
1 parent dd05362 commit 75643f0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public final void addCommands(Command... commands) {
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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public final void addCommands(Command... commands) {
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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public final void addCommands(Command... commands) {
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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ class Command : public wpi::Sendable, public wpi::SendableHelper<Command> {
protected:
Command();

private:
/// Requirements set.
wpi::SmallSet<Subsystem*, 4> m_requirements;

Expand Down

0 comments on commit 75643f0

Please sign in to comment.