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