| 77 | /** |
| 78 | * Convenient constructor, if the commands are known at compile time. |
| 79 | * @param name The description text to be used for the sequence command, if one is created. |
| 80 | * @param sequenz The sequence that should be executed. |
| 81 | * @return Either a SequenceCommand, or the only command in the potential sequence |
| 82 | * @since xxx |
| 83 | */ |
| 84 | public static Command wrapIfNeeded(String name, Command... sequenz) { |
| 85 | if (sequenz.length == 1) { |
| 86 | return sequenz[0]; |
| 87 | } |
| 88 | return new SequenceCommand(name, sequenz); |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Convenient constructor, if the commands are known at compile time. |
| 93 | * @param name The description text to be used for the sequence command, if one is created. |
| 94 | * @param sequenz The sequence that should be executed. |
| 95 | * @return Either a SequenceCommand, or the only command in the potential sequence |
| 96 | * @since xxx |
| 97 | */ |
| 98 | public static Command wrapIfNeeded(String name, Collection<Command> sequenz) { |
| 99 | if (sequenz.size() == 1) { |
| 100 | return sequenz.iterator().next(); |
| 101 | } |
| 102 | return new SequenceCommand(name, sequenz); |
| 103 | } |
| 104 | |