source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDprintRandomSession.java @ 75

Last change on this file since 75 was 18, checked in by sherbold, 14 years ago
  • removed all reference to de.ugoe.cs.eventbench.MarkovModel? and replaced them with de.ugoe.cs.eventbench.models.FirstOrderMarkovModel? and de.ugoe.cs.eventbench.models.IStochasticProcess
  • Property svn:mime-type set to text/plain
File size: 1.2 KB
Line 
1package de.ugoe.cs.eventbench.commands;
2
3import java.security.InvalidParameterException;
4import java.util.List;
5
6import de.ugoe.cs.eventbench.data.Event;
7import de.ugoe.cs.eventbench.data.GlobalDataContainer;
8import de.ugoe.cs.eventbench.models.IStochasticProcess;
9import de.ugoe.cs.util.console.Command;
10import de.ugoe.cs.util.console.Console;
11
12public class CMDprintRandomSession implements Command {
13
14        @Override
15        public void help() {
16                Console.println("Usage: printRandomSession <modelName>");
17        }
18
19        @Override
20        public void run(List<Object> parameters) {
21                String modelname;
22                try {
23                        modelname = (String) parameters.get(0);
24                }
25                catch (Exception e) {
26                        throw new InvalidParameterException();
27                }
28               
29                IStochasticProcess model = null;
30                Object dataObject = GlobalDataContainer.getInstance().getData(modelname);
31                if( dataObject==null ) {
32                        Console.println("Model " + modelname + " not found in storage.");
33                }
34                else if( !(dataObject instanceof IStochasticProcess) ) {
35                        Console.println("Object " + modelname + " not of type MarkovModel!");
36                } else {
37                        model = (IStochasticProcess) dataObject;
38                        for( Event<?> event : model.randomSequence() ) {
39                                Console.println(event.toString());
40                        }
41                }
42        }
43
44}
Note: See TracBrowser for help on using the repository browser.