Rev | Line | |
---|
[1] | 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.markov.DotPrinter;
|
---|
| 8 | import de.ugoe.cs.util.console.Command;
|
---|
| 9 | import de.ugoe.cs.util.console.Console;
|
---|
| 10 |
|
---|
| 11 | public class CMDprintDot implements Command {
|
---|
| 12 |
|
---|
| 13 | @Override
|
---|
| 14 | public void help() {
|
---|
| 15 | Console.println("Usage: printDot <modelname>");
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | @Override
|
---|
| 19 | public void run(List<Object> parameters) {
|
---|
| 20 | String modelname = "";
|
---|
| 21 | try {
|
---|
| 22 | modelname = (String) parameters.get(0);
|
---|
| 23 | } catch (Exception e) {
|
---|
| 24 | throw new InvalidParameterException();
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | DotPrinter model = null;
|
---|
| 28 | Object dataObject = GlobalDataContainer.getInstance().getData(modelname);
|
---|
| 29 | if( dataObject==null ) {
|
---|
| 30 | Console.println("Model " + modelname + "not found in storage.");
|
---|
| 31 | }
|
---|
| 32 | else if( !(dataObject instanceof DotPrinter) ) {
|
---|
| 33 | Console.println("Object " + modelname + " does not implement DotPrinter!");
|
---|
| 34 | } else {
|
---|
| 35 | model = (DotPrinter) dataObject;
|
---|
| 36 | model.printDot();
|
---|
| 37 | }
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.