Last change
on this file since 131 was
131,
checked in by sherbold, 13 years ago
|
- implemented help in command modelSize
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.4 KB
|
Line | |
---|
1 | /**
|
---|
2 | *
|
---|
3 | */
|
---|
4 | package de.ugoe.cs.eventbench.commands;
|
---|
5 |
|
---|
6 | import java.security.InvalidParameterException;
|
---|
7 | import java.util.List;
|
---|
8 |
|
---|
9 | import de.ugoe.cs.eventbench.data.GlobalDataContainer;
|
---|
10 | import de.ugoe.cs.eventbench.models.IStochasticProcess;
|
---|
11 | import de.ugoe.cs.util.console.Command;
|
---|
12 | import de.ugoe.cs.util.console.Console;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * @author sherbold
|
---|
16 | *
|
---|
17 | */
|
---|
18 | public class CMDmodelSize implements Command {
|
---|
19 |
|
---|
20 | /* (non-Javadoc)
|
---|
21 | * @see de.ugoe.cs.util.console.Command#run(java.util.List)
|
---|
22 | */
|
---|
23 | @Override
|
---|
24 | public void run(List<Object> parameters) {
|
---|
25 | String modelname;
|
---|
26 | try {
|
---|
27 | modelname = (String) parameters.get(0);
|
---|
28 | } catch (Exception e) {
|
---|
29 | throw new InvalidParameterException();
|
---|
30 | }
|
---|
31 |
|
---|
32 | Object dataObject = GlobalDataContainer.getInstance().getData(modelname);
|
---|
33 | if( dataObject==null ) {
|
---|
34 | Console.printerrln("No model with name " + modelname + "found");
|
---|
35 | return;
|
---|
36 | }
|
---|
37 | if( !(dataObject instanceof IStochasticProcess) ) {
|
---|
38 | Console.printerrln("Object " + modelname + " not of type IStochasticProcess!");
|
---|
39 | return;
|
---|
40 | }
|
---|
41 |
|
---|
42 | IStochasticProcess process = (IStochasticProcess) dataObject;
|
---|
43 | Console.println("#symbols: " + process.getNumSymbols() + " ; #FOMstates " + process.getNumFOMStates());
|
---|
44 | }
|
---|
45 |
|
---|
46 | /* (non-Javadoc)
|
---|
47 | * @see de.ugoe.cs.util.console.Command#help()
|
---|
48 | */
|
---|
49 | @Override
|
---|
50 | public void help() {
|
---|
51 | Console.println("Usage: modelSize <modelName>");
|
---|
52 | }
|
---|
53 |
|
---|
54 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.