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
|
Rev | Line | |
---|
[733] | 1 | package de.ugoe.cs.quest.commands.misc;
|
---|
[235] | 2 |
|
---|
| 3 | import java.util.List;
|
---|
| 4 |
|
---|
[432] | 5 | import de.ugoe.cs.quest.CommandHelpers;
|
---|
[235] | 6 | import de.ugoe.cs.util.console.Command;
|
---|
[667] | 7 | import de.ugoe.cs.util.console.GlobalDataContainer;
|
---|
[235] | 8 |
|
---|
| 9 | /**
|
---|
| 10 | * <p>
|
---|
| 11 | * Command to start a time.
|
---|
| 12 | * </p>
|
---|
| 13 | *
|
---|
| 14 | * @author Steffen Herbold
|
---|
| 15 | * @version 1.0
|
---|
| 16 | */
|
---|
| 17 | public 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) {
|
---|
[766] | 30 | throw new IllegalArgumentException();
|
---|
[235] | 31 | }
|
---|
| 32 | Long time = System.currentTimeMillis();
|
---|
| 33 | if (GlobalDataContainer.getInstance().addData(timerName, time)) {
|
---|
[240] | 34 | CommandHelpers.dataOverwritten(timerName);
|
---|
[235] | 35 | }
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | /*
|
---|
| 39 | * (non-Javadoc)
|
---|
| 40 | *
|
---|
| 41 | * @see de.ugoe.cs.util.console.Command#help()
|
---|
| 42 | */
|
---|
| 43 | @Override
|
---|
[664] | 44 | public String help() {
|
---|
| 45 | return "startTimer <timerName>";
|
---|
[235] | 46 | }
|
---|
| 47 |
|
---|
| 48 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.