mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[commands] Rename Command.repeat to repeatedly (#4379)
This commit is contained in:
@@ -288,7 +288,7 @@ public interface Command {
|
||||
*
|
||||
* @return the decorated command
|
||||
*/
|
||||
default RepeatCommand repeat() {
|
||||
default RepeatCommand repeatedly() {
|
||||
return new RepeatCommand(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class RepeatCommand extends CommandBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RepeatCommand repeat() {
|
||||
public RepeatCommand repeatedly() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ EndlessCommand Command::Endlessly() && {
|
||||
return EndlessCommand(std::move(*this).TransferOwnership());
|
||||
}
|
||||
|
||||
RepeatCommand Command::Repeat() && {
|
||||
RepeatCommand Command::Repeatedly() && {
|
||||
return RepeatCommand(std::move(*this).TransferOwnership());
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,6 @@ bool RepeatCommand::RunsWhenDisabled() const {
|
||||
return m_command->RunsWhenDisabled();
|
||||
}
|
||||
|
||||
RepeatCommand RepeatCommand::Repeat() && {
|
||||
RepeatCommand RepeatCommand::Repeatedly() && {
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ class Command {
|
||||
*
|
||||
* @return the decorated command
|
||||
*/
|
||||
virtual RepeatCommand Repeat() &&;
|
||||
virtual RepeatCommand Repeatedly() &&;
|
||||
|
||||
/**
|
||||
* Decorates this command to run "by proxy" by wrapping it in a
|
||||
|
||||
@@ -69,7 +69,7 @@ class RepeatCommand : public CommandHelper<CommandBase, RepeatCommand> {
|
||||
|
||||
bool RunsWhenDisabled() const override;
|
||||
|
||||
RepeatCommand Repeat() && override;
|
||||
RepeatCommand Repeatedly() && override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Command> m_command;
|
||||
|
||||
@@ -26,15 +26,15 @@ class RepeatCommandTest {
|
||||
var isFinishedHook = new AtomicBoolean(false);
|
||||
|
||||
final var command =
|
||||
new RepeatCommand(
|
||||
new FunctionalCommand(
|
||||
new FunctionalCommand(
|
||||
initCounter::incrementAndGet,
|
||||
exeCounter::incrementAndGet,
|
||||
interrupted -> endCounter.incrementAndGet(),
|
||||
() -> {
|
||||
isFinishedCounter.incrementAndGet();
|
||||
return isFinishedHook.get();
|
||||
}));
|
||||
})
|
||||
.repeatedly();
|
||||
|
||||
assertEquals(0, initCounter.get());
|
||||
assertEquals(0, exeCounter.get());
|
||||
|
||||
@@ -26,7 +26,7 @@ TEST_F(RepeatCommandTest, CallsMethodsCorrectly) {
|
||||
isFinishedCounter++;
|
||||
return isFinishedHook;
|
||||
})
|
||||
.Repeat();
|
||||
.Repeatedly();
|
||||
|
||||
EXPECT_EQ(0, initCounter);
|
||||
EXPECT_EQ(0, exeCounter);
|
||||
|
||||
Reference in New Issue
Block a user