Last change
on this file since 151 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 | |
---|
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.Event;
|
---|
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 | public 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.