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