source:
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/ui/commands/CMDmodelSize.java
@
726
Last change on this file since 726 was 726, checked in by sherbold, 12 years ago | |
---|---|
|
|
File size: 1.5 KB |
Line | |
---|---|
1 | package de.ugoe.cs.quest.ui.commands; |
2 | |
3 | import java.security.InvalidParameterException; |
4 | import java.util.List; |
5 | |
6 | import de.ugoe.cs.quest.CommandHelpers; |
7 | import de.ugoe.cs.quest.usageprofiles.IStochasticProcess; |
8 | import de.ugoe.cs.util.console.Command; |
9 | import de.ugoe.cs.util.console.Console; |
10 | import de.ugoe.cs.util.console.GlobalDataContainer; |
11 | |
12 | /** |
13 | * <p> |
14 | * Command that prints the size of a stochastic process to the console. |
15 | * </p> |
16 | * |
17 | * @author Steffen Herbold |
18 | * @version 1.0 |
19 | */ |
20 | public class CMDmodelSize implements Command { |
21 | |
22 | /* |
23 | * (non-Javadoc) |
24 | * |
25 | * @see de.ugoe.cs.util.console.Command#run(java.util.List) |
26 | */ |
27 | @Override |
28 | public void run(List<Object> parameters) { |
29 | String modelname; |
30 | try { |
31 | modelname = (String) parameters.get(0); |
32 | } catch (Exception e) { |
33 | throw new InvalidParameterException(); |
34 | } |
35 | |
36 | Object dataObject = GlobalDataContainer.getInstance() |
37 | .getData(modelname); |
38 | if (dataObject == null) { |
39 | CommandHelpers.objectNotFoundMessage(modelname); |
40 | return; |
41 | } |
42 | if (!(dataObject instanceof IStochasticProcess)) { |
43 | CommandHelpers.objectNotType(modelname, "IStochasticProcess"); |
44 | return; |
45 | } |
46 | |
47 | IStochasticProcess process = (IStochasticProcess) dataObject; |
48 | Console.println("#symbols: " + process.getNumSymbols() |
49 | + " ; #FOMstates " + process.getNumFOMStates() |
50 | + " ; #transitions: " + process.getNumTransitions()); |
51 | } |
52 | |
53 | /* |
54 | * (non-Javadoc) |
55 | * |
56 | * @see de.ugoe.cs.util.console.Command#help() |
57 | */ |
58 | @Override |
59 | public String help() { |
60 | return "modelSize <modelname>"; |
61 | } |
62 | |
63 | } |
Note: See TracBrowser
for help on using the repository browser.