Closed b-cho closed 4 years ago
Note that we can convert Set<Subsystem> this.command.getRequirements()
to Subsystem[]
using the following line of code:
(Subsystem[]) this.command.getRequirements().toArray()
.
This can be passed into functions like addRequirements()
, which require a Subsystem[]
input instead of a Set.
Furthermore, the names of commands can be concatenated into one string with separator " "
by using the following line of code (where commands
is of type Command[]
):
Arrays.stream(commands).map((Command command) -> command.getName()).collect(Collectors.joining(" "))
. (returns type String
).
This maps commands
to type Stream<Command>
, then uses a lambda function via Stream.map
to extract the names of each command (making the new type a Stream<String>
). We then use Stream.collect
to concatenate the strings in the stream using Collectors.joining(" ")
, combining them with a space delimiter. In other words, the commands array goes through the following types:
Command[]
-> Stream<Command>
-> Stream<String>
-> String
Change the Run commands to work with the new system, and updated Noop() to be usable with the new versions. I still need to verify the following things, however:
isTimedOut()
? It no longer exists and needs to be fixed inRunFor.java
. (Hopefully fixed with d164b6d).