Last change
on this file since 67 was
67,
checked in by sherbold, 13 years ago
|
+ added command numStates
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.2 KB
|
Rev | Line | |
---|
[67] | 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.FirstOrderMarkovModel;
|
---|
| 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 | public class CMDnumStates implements Command {
|
---|
| 13 |
|
---|
| 14 | @Override
|
---|
| 15 | public void run(List<Object> parameters) {
|
---|
| 16 | String modelname = "";
|
---|
| 17 | try {
|
---|
| 18 | modelname = (String) parameters.get(0);
|
---|
| 19 | } catch (Exception e) {
|
---|
| 20 | throw new InvalidParameterException();
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | IStochasticProcess model = null;
|
---|
| 24 | Object dataObject = GlobalDataContainer.getInstance().getData(modelname);
|
---|
| 25 | if( dataObject==null ) {
|
---|
| 26 | Console.println("Model " + modelname + "not found in storage.");
|
---|
| 27 | }
|
---|
| 28 | else if( !(dataObject instanceof IStochasticProcess) ) {
|
---|
| 29 | Console.println("Object " + modelname + " is not a stochastic process!");
|
---|
| 30 | } else {
|
---|
| 31 | model = (IStochasticProcess) dataObject;
|
---|
| 32 | Console.println("" + model.getNumStates() + " states");
|
---|
| 33 | }
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | @Override
|
---|
| 37 | public void help() {
|
---|
| 38 | Console.println("Usage: numStates <modelName>");
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.