Giter Club home page Giter Club logo

Comments (3)

Starlight220 avatar Starlight220 commented on July 1, 2024 2

Given how trivial it is to convert between the two using Set.of/Set.toArray, I don't think we should duplicate everything for rare cases.

from allwpilib.

Starlight220 avatar Starlight220 commented on July 1, 2024

One case I'm assuming you're referring to is Defer, which uses Set<Subsystem> so that not passing any requirements is explicit.

addRequirements has overloads for both, especially as getRequirements returns a Set.

What others are there?

from allwpilib.

KangarooKoala avatar KangarooKoala commented on July 1, 2024

The cases I could find:

  • CommandScheduler.cancel(Command...)- Having a Collection<Command> overload would probably be fine, but there isn't a clear use-case for canceling a Collection<Command>, and in general we avoid adding stuff that nobody would use.
  • CommandScheduler.isScheduled(Command...)- I honestly don't know when this method is called with more than one argument, let alone with a collection.
  • CommandScheduler.registerComposedCommands(Command...)- A Collection<Command> overload would be useful for SelectCommand, though it wouldn't have any other uses. (I'd probably make a Set<Command> overload that skips the check for duplicates, and have the Command... and Collection<Command> overloads just do the duplicate checks)
  • CommandScheduler.registerSubsystem(Subsystem...)- I honestly don't know when this method is called with more than one argument, let alone with a collection. (The name is singular, too)
  • CommandScheduler.schedule(Command...)- We discourage manually calling schedule() in user code, and the only times I saw a single call being used to schedule multiple commands at a time, it was with varargs, not an already existing array object. (RobotDisabledCommandTest.java#L124, RobotDisabledCommandTest.java#L148, and CommandScheduleTest#L71)
  • CommandScheduler.unregisterSubsystem(Subsystem...)- I honestly don't know when this method is called with more than one argument, let alone with a collection. (The name is singular, too)
  • Command.addRequirements(Subsystem...)- This is covered in #6304
  • Command decorators, factories and constructors that use multiple commands (Command.alongWith(Command...), Command.andThen(Command...), Command.deadlineFor(Command...), Command.deadlineWith(Command...) (deprecated), Command.raceWith(Command...), Commands.deadline(Command, Command...), Commands.parallel(Command...), Commands.race(Command...), Commands.repeatingSequence(Command...), Commands.sequence(Command...), ParallelCommandGroup(Command...), ParallelDeadlineGroup(Command, Command...), ParallelRaceGroup(Command...), ScheduleCommand(Command...), SequentialCommandGroup(Command...), SequentialCommandGroup.addCommands(Command...))
    I'm ambivalent with these- I don't know of any cases where having a Collection<Command> overload would be useful, but someone might be able to provide an example.
  • Command decorators, factories and constructors that use requirements (Command.andThen(Runnable, Subsystem...), Command.beforeStarting(Runnable, Subsystem...), Commands.idle(Subsystem...), Commands.run(Runnable, Subsystem...), Commands.runEnd(Runnable, Runnable, Subsystem...), Commands.runOnce(Runnable, Subsystem...), Commands.startEnd(Runnable, Runnable, Subsystem...), Commands.startRun(Runnable, Runnable, Subsystem...), FunctionalCommand(Runnable, Runnable, Consumer<Boolean>, BooleanSupplier, Subsystem...), InstantCommand(Runnable, Subsystem...), MecanumControlCommand(...) (4 overloads), NotifierCommand(Runnable, double, Subsystem...), PIDCommand(...) (2 overloads), ProfiledPIDCommand(...) (4 overloads), RamseteCommand(...) (2 overloads, deprecated), RunCommand(Runnable, Subsystem...), StartEndCommand(Runnable, Runnable, Subsystem...), SwerveControllerCommand(...) (4 overloads), TrapezoidProfileCommand(...) (1 overload))
    I could see the case for making overloads that take a Set<Subsystem> for the requirements.

from allwpilib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.