source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDprintTrieDot.java @ 133

Last change on this file since 133 was 31, checked in by sherbold, 14 years ago

+ added command printTrieDot

  • Property svn:mime-type set to text/plain
File size: 1.1 KB
Line 
1package de.ugoe.cs.eventbench.commands;
2
3import java.security.InvalidParameterException;
4import java.util.List;
5
6import de.ugoe.cs.eventbench.data.GlobalDataContainer;
7import de.ugoe.cs.eventbench.models.TrieBasedModel;
8import de.ugoe.cs.util.console.Command;
9import de.ugoe.cs.util.console.Console;
10
11public class CMDprintTrieDot implements Command {
12       
13        @Override
14        public void help() {
15                Console.println("Usage: printTreeDot <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                TrieBasedModel 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 TrieBasedModel) ) {
33                        Console.println("Object " + modelname + " is not a TrieBasedModel!");
34                } else {
35                        model = (TrieBasedModel) dataObject;
36                        Console.println(model.getTrieDotRepresentation());
37                }
38        }
39       
40}
Note: See TracBrowser for help on using the repository browser.