001    /*----------------------------------------------------------------------------*/
002    /* Copyright (c) FIRST 2008-2012. All Rights Reserved.                        */
003    /* Open Source Software - may be modified and shared by FRC teams. The code   */
004    /* must be accompanied by the FIRST BSD license file in the root directory of */
005    /* the project.                                                               */
006    /*----------------------------------------------------------------------------*/
007    
008    package edu.wpi.first.wpilibj.command;
009    
010    /**
011     * A {@link WaitCommand} will wait for a certain amount of time before finishing.
012     * It is useful if you want a {@link CommandGroup} to pause for a moment.
013     * @author Joe Grinstead
014     * @see CommandGroup
015     */
016    public class WaitCommand extends Command {
017    
018        /**
019         * Instantiates a {@link WaitCommand} with the given timeout.
020         * @param timeout the time the command takes to run
021         */
022        public WaitCommand(double timeout) {
023            this("Wait(" + timeout + ")", timeout);
024        }
025    
026        /**
027         * Instantiates a {@link WaitCommand} with the given timeout.
028         * @param name the name of the command
029         * @param timeout the time the command takes to run
030         */
031        public WaitCommand(String name, double timeout) {
032            super(name, timeout);
033        }
034    
035        protected void initialize() {
036        }
037    
038        protected void execute() {
039        }
040    
041        protected boolean isFinished() {
042            return isTimedOut();
043        }
044    
045        protected void end() {
046        }
047    
048        protected void interrupted() {
049        }
050    }