Last change
on this file since 171 was
171,
checked in by sherbold, 13 years ago
|
- code documentation and formatting
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.5 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.data.GlobalDataContainer;
|
---|
7 | import de.ugoe.cs.eventbench.models.IStochasticProcess;
|
---|
8 | import de.ugoe.cs.util.console.Command;
|
---|
9 | import de.ugoe.cs.util.console.Console;
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * <p>
|
---|
13 | * Command that prints the size of a stochastic process to the console.
|
---|
14 | * </p>
|
---|
15 | *
|
---|
16 | * @author Steffen Herbold
|
---|
17 | * @version 1.0
|
---|
18 | */
|
---|
19 | public class CMDmodelSize 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 modelname;
|
---|
29 | try {
|
---|
30 | modelname = (String) parameters.get(0);
|
---|
31 | } catch (Exception e) {
|
---|
32 | throw new InvalidParameterException();
|
---|
33 | }
|
---|
34 |
|
---|
35 | Object dataObject = GlobalDataContainer.getInstance()
|
---|
36 | .getData(modelname);
|
---|
37 | if (dataObject == null) {
|
---|
38 | Console.printerrln("No model with name " + modelname + "found");
|
---|
39 | return;
|
---|
40 | }
|
---|
41 | if (!(dataObject instanceof IStochasticProcess)) {
|
---|
42 | Console.printerrln("Object " + modelname
|
---|
43 | + " not of type IStochasticProcess!");
|
---|
44 | return;
|
---|
45 | }
|
---|
46 |
|
---|
47 | IStochasticProcess process = (IStochasticProcess) dataObject;
|
---|
48 | Console.println("#symbols: " + process.getNumSymbols()
|
---|
49 | + " ; #FOMstates " + process.getNumFOMStates());
|
---|
50 | }
|
---|
51 |
|
---|
52 | /*
|
---|
53 | * (non-Javadoc)
|
---|
54 | *
|
---|
55 | * @see de.ugoe.cs.util.console.Command#help()
|
---|
56 | */
|
---|
57 | @Override
|
---|
58 | public void help() {
|
---|
59 | Console.println("Usage: modelSize <modelName>");
|
---|
60 | }
|
---|
61 |
|
---|
62 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.