Skip to content

Commit

Permalink
Relocate factory
Browse files Browse the repository at this point in the history
  • Loading branch information
rzblue committed Sep 15, 2023
1 parent 86f83f7 commit dac965d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,6 @@ public static Command print(String message) {
return new PrintCommand(message);
}

/**
* Constructs a command that schedules the supplied command when initialized, and ends when it is
* no longer scheduled.
*
* @param supplier the command supplier
* @return the command
* @see ProxyCommand
*/
public static Command deferredProxy(Supplier<Command> supplier) {
return new ProxyCommand(supplier);
}

// Idling Commands

/**
Expand Down Expand Up @@ -163,6 +151,20 @@ public static Command select(Map<Object, Command> commands, Supplier<Object> sel
return new SelectCommand(commands, selector);
}

/**
* Constructs a command that schedules the supplied command when initialized, and ends when it is
* no longer scheduled.
*
* @param supplier the command supplier
* @return the command
* @see ProxyCommand
*/
public static Command deferredProxy(Supplier<Command> supplier) {
return new ProxyCommand(supplier);
}

// Command Groups

/**
* Runs a group of commands in series, one after the other.
*
Expand All @@ -174,8 +176,6 @@ public static Command sequence(Command... commands) {
return new SequentialCommandGroup(commands);
}

// Command Groups

/**
* Runs a group of commands in series, one after the other. Once the last command ends, the group
* is restarted.
Expand Down
36 changes: 18 additions & 18 deletions wpilibNewCommands/src/main/native/include/frc2/command/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,24 +137,6 @@ CommandPtr RunEnd(std::function<void()> run, std::function<void()> end,
[[nodiscard]]
CommandPtr Print(std::string_view msg);

/**
* Constructs a command that schedules the supplied command when initialized,
* and ends when it is no longer scheduled
*
* @param supplier the command supplier
*/
[[nodiscard]]
CommandPtr DeferredProxy(wpi::unique_function<Command*()> supplier);

/**
* Constructs a command that schedules the supplied command when initialized,
* and ends when it is no longer scheduled
*
* @param supplier the command supplier
*/
[[nodiscard]]
CommandPtr DeferredProxy(wpi::unique_function<CommandPtr()> supplier);

// Idling Commands

/**
Expand Down Expand Up @@ -205,6 +187,24 @@ CommandPtr Select(std::function<Key()> selector,
return SelectCommand(std::move(selector), std::move(vec)).ToPtr();
}

/**
* Constructs a command that schedules the supplied command when initialized,
* and ends when it is no longer scheduled
*
* @param supplier the command supplier
*/
[[nodiscard]]
CommandPtr DeferredProxy(wpi::unique_function<Command*()> supplier);

/**
* Constructs a command that schedules the supplied command when initialized,
* and ends when it is no longer scheduled
*
* @param supplier the command supplier
*/
[[nodiscard]]
CommandPtr DeferredProxy(wpi::unique_function<CommandPtr()> supplier);

// Command Groups

namespace impl {
Expand Down

0 comments on commit dac965d

Please sign in to comment.