mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[commands] Define order of parallel groups (#6602)
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj2.command;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -19,7 +19,9 @@ import java.util.Map;
|
||||
*/
|
||||
public class ParallelCommandGroup extends Command {
|
||||
// maps commands in this composition to whether they are still running
|
||||
private final Map<Command, Boolean> m_commands = new HashMap<>();
|
||||
// LinkedHashMap guarantees we iterate over commands in the order they were added (Note that
|
||||
// changing the value associated with a command does NOT change the order)
|
||||
private final Map<Command, Boolean> m_commands = new LinkedHashMap<>();
|
||||
private boolean m_runWhenDisabled = true;
|
||||
private InterruptionBehavior m_interruptBehavior = InterruptionBehavior.kCancelIncoming;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj2.command;
|
||||
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -22,7 +22,9 @@ import java.util.Map;
|
||||
*/
|
||||
public class ParallelDeadlineGroup extends Command {
|
||||
// maps commands in this composition to whether they are still running
|
||||
private final Map<Command, Boolean> m_commands = new HashMap<>();
|
||||
// LinkedHashMap guarantees we iterate over commands in the order they were added (Note that
|
||||
// changing the value associated with a command does NOT change the order)
|
||||
private final Map<Command, Boolean> m_commands = new LinkedHashMap<>();
|
||||
private boolean m_runWhenDisabled = true;
|
||||
private boolean m_finished = true;
|
||||
private Command m_deadline;
|
||||
@@ -39,8 +41,8 @@ public class ParallelDeadlineGroup extends Command {
|
||||
* @throws IllegalArgumentException if the deadline command is also in the otherCommands argument
|
||||
*/
|
||||
public ParallelDeadlineGroup(Command deadline, Command... otherCommands) {
|
||||
addCommands(otherCommands);
|
||||
setDeadline(deadline);
|
||||
addCommands(otherCommands);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj2.command;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -19,7 +19,8 @@ import java.util.Set;
|
||||
* <p>This class is provided by the NewCommands VendorDep
|
||||
*/
|
||||
public class ParallelRaceGroup extends Command {
|
||||
private final Set<Command> m_commands = new HashSet<>();
|
||||
// LinkedHashSet guarantees we iterate over commands in the order they were added
|
||||
private final Set<Command> m_commands = new LinkedHashSet<>();
|
||||
private boolean m_runWhenDisabled = true;
|
||||
private boolean m_finished = true;
|
||||
private InterruptionBehavior m_interruptBehavior = InterruptionBehavior.kCancelIncoming;
|
||||
|
||||
Reference in New Issue
Block a user