source: trunk/quest-plugin-guitar/src/main/java/de/ugoe/cs/quest/plugin/guitar/commands/CMDefgToDFA.java @ 667

Last change on this file since 667 was 667, checked in by sherbold, 12 years ago

*moved GlobalDataContainer? from quest-ui-core to java-utils

  • Property svn:mime-type set to text/plain
File size: 1.3 KB
Line 
1package de.ugoe.cs.quest.plugin.guitar.commands;
2
3import java.security.InvalidParameterException;
4import java.util.List;
5
6import de.ugoe.cs.quest.plugin.guitar.EFGModelGenerator;
7import de.ugoe.cs.quest.usageprofiles.DeterministicFiniteAutomaton;
8import de.ugoe.cs.util.console.Command;
9import de.ugoe.cs.util.console.GlobalDataContainer;
10
11/**
12 * <p>
13 * Command to that loads an EFG and creates Deterministic Finite Automaton (DFA)
14 * with the same structure.
15 * </p>
16 *
17 * @author Steffen Herbold
18 * @version 1.0
19 */
20public class CMDefgToDFA implements Command {
21
22        /*
23         * (non-Javadoc)
24         *
25         * @see de.ugoe.cs.util.console.Command#run(java.util.List)
26         */
27        @Override
28        public void run(List<Object> parameters) {
29                String filename;
30                String modelname;
31                try {
32                        filename = (String) parameters.get(0);
33                        modelname = (String) parameters.get(1);
34                } catch (Exception e) {
35                        throw new InvalidParameterException();
36                }
37
38                EFGModelGenerator modelGenerator = new EFGModelGenerator();
39                DeterministicFiniteAutomaton model = modelGenerator
40                                .efgToDeterministicFiniteAutomaton(filename);
41                GlobalDataContainer.getInstance().addData(modelname, model);
42        }
43
44        /*
45         * (non-Javadoc)
46         *
47         * @see de.ugoe.cs.util.console.Command#help()
48         */
49        @Override
50        public String help() {
51                return "efgToDFA <filename> <modelname>";
52        }
53
54}
Note: See TracBrowser for help on using the repository browser.