Last change
on this file since 240 was
240,
checked in by sherbold, 13 years ago
|
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.5 KB
|
Rev | Line | |
---|
[130] | 1 | package de.ugoe.cs.eventbench.commands;
|
---|
| 2 |
|
---|
| 3 | import java.security.InvalidParameterException;
|
---|
| 4 | import java.util.List;
|
---|
| 5 |
|
---|
[240] | 6 | import de.ugoe.cs.eventbench.CommandHelpers;
|
---|
[130] | 7 | import de.ugoe.cs.eventbench.data.GlobalDataContainer;
|
---|
| 8 | import de.ugoe.cs.eventbench.models.IStochasticProcess;
|
---|
| 9 | import de.ugoe.cs.util.console.Command;
|
---|
| 10 | import de.ugoe.cs.util.console.Console;
|
---|
| 11 |
|
---|
| 12 | /**
|
---|
[171] | 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
|
---|
[130] | 19 | */
|
---|
| 20 | public class CMDmodelSize implements Command {
|
---|
| 21 |
|
---|
[171] | 22 | /*
|
---|
| 23 | * (non-Javadoc)
|
---|
| 24 | *
|
---|
[130] | 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 | }
|
---|
[171] | 35 |
|
---|
| 36 | Object dataObject = GlobalDataContainer.getInstance()
|
---|
| 37 | .getData(modelname);
|
---|
| 38 | if (dataObject == null) {
|
---|
[240] | 39 | CommandHelpers.objectNotFoundMessage(modelname);
|
---|
[130] | 40 | return;
|
---|
| 41 | }
|
---|
[171] | 42 | if (!(dataObject instanceof IStochasticProcess)) {
|
---|
[240] | 43 | CommandHelpers.objectNotType(modelname, "IStochasticProcess");
|
---|
[130] | 44 | return;
|
---|
| 45 | }
|
---|
[171] | 46 |
|
---|
[130] | 47 | IStochasticProcess process = (IStochasticProcess) dataObject;
|
---|
[171] | 48 | Console.println("#symbols: " + process.getNumSymbols()
|
---|
| 49 | + " ; #FOMstates " + process.getNumFOMStates());
|
---|
[130] | 50 | }
|
---|
| 51 |
|
---|
[171] | 52 | /*
|
---|
| 53 | * (non-Javadoc)
|
---|
| 54 | *
|
---|
[130] | 55 | * @see de.ugoe.cs.util.console.Command#help()
|
---|
| 56 | */
|
---|
| 57 | @Override
|
---|
| 58 | public void help() {
|
---|
[131] | 59 | Console.println("Usage: modelSize <modelName>");
|
---|
[130] | 60 | }
|
---|
| 61 |
|
---|
| 62 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.