source: trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/commands/misc/CMDstartTimer.java @ 766

Last change on this file since 766 was 766, checked in by sherbold, 12 years ago
  • Property svn:mime-type set to text/plain
File size: 1003 bytes
Line 
1package de.ugoe.cs.quest.commands.misc;
2
3import java.util.List;
4
5import de.ugoe.cs.quest.CommandHelpers;
6import de.ugoe.cs.util.console.Command;
7import de.ugoe.cs.util.console.GlobalDataContainer;
8
9/**
10 * <p>
11 * Command to start a time.
12 * </p>
13 *
14 * @author Steffen Herbold
15 * @version 1.0
16 */
17public class CMDstartTimer implements Command {
18
19        /*
20         * (non-Javadoc)
21         *
22         * @see de.ugoe.cs.util.console.Command#run(java.util.List)
23         */
24        @Override
25        public void run(List<Object> parameters) {
26                String timerName;
27                try {
28                        timerName = (String) parameters.get(0);
29                } catch (Exception e) {
30                        throw new IllegalArgumentException();
31                }
32                Long time = System.currentTimeMillis();
33                if (GlobalDataContainer.getInstance().addData(timerName, time)) {
34                        CommandHelpers.dataOverwritten(timerName);
35                }
36        }
37
38        /*
39         * (non-Javadoc)
40         *
41         * @see de.ugoe.cs.util.console.Command#help()
42         */
43        @Override
44        public String help() {
45                return "startTimer <timerName>";
46        }
47
48}
Note: See TracBrowser for help on using the repository browser.