Ignore:
Timestamp:
09/09/11 06:23:36 (13 years ago)
Author:
sherbold
Message:
  • code documentation and formatting
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDtrainDFA.java

    r96 r171  
    1111import de.ugoe.cs.util.console.Console; 
    1212 
     13/** 
     14 * <p> 
     15 * Command to train a Deterministic Finite Automaton (DFA). 
     16 * </p> 
     17 *  
     18 * @author Steffen Herbold 
     19 * @version 1.0 
     20 */ 
    1321public class CMDtrainDFA implements Command { 
    1422 
     23        /* 
     24         * (non-Javadoc) 
     25         *  
     26         * @see de.ugoe.cs.util.console.Command#help() 
     27         */ 
    1528        @Override 
    1629        public void help() { 
     
    1831        } 
    1932 
     33        /* 
     34         * (non-Javadoc) 
     35         *  
     36         * @see de.ugoe.cs.util.console.Command#run(java.util.List) 
     37         */ 
    2038        @SuppressWarnings("unchecked") 
    2139        @Override 
     
    2745                        throw new InvalidParameterException(); 
    2846                } 
    29                  
     47 
    3048                List<List<Event<?>>> sequences = null; 
    31                 Object dataObject = GlobalDataContainer.getInstance().getData("sequences"); 
    32                          
     49                Object dataObject = GlobalDataContainer.getInstance().getData( 
     50                                "sequences"); 
     51 
    3352                try { 
    3453                        sequences = (List<List<Event<?>>>) dataObject; 
    35                         if( sequences.size()>0 ) { 
    36                                 if( sequences.get(0).get(0) instanceof Event ) { 
    37                                         DeterministicFiniteAutomaton model =  new DeterministicFiniteAutomaton(new Random()); 
     54                        if (sequences.size() > 0) { 
     55                                if (sequences.get(0).get(0) instanceof Event) { 
     56                                        DeterministicFiniteAutomaton model = new DeterministicFiniteAutomaton( 
     57                                                        new Random()); 
    3858                                        model.train(sequences); 
    39                                         if( GlobalDataContainer.getInstance().addData(modelname, model) ) { 
    40                                                 Console.traceln("Old data \"" + modelname + "\" overwritten"); 
     59                                        if (GlobalDataContainer.getInstance().addData(modelname, 
     60                                                        model)) { 
     61                                                Console.traceln("Old data \"" + modelname 
     62                                                                + "\" overwritten"); 
    4163                                        } 
    4264                                } else { 
     
    4567                                } 
    4668                        } 
    47                 } 
    48                 catch(ClassCastException e) { 
     69                } catch (ClassCastException e) { 
    4970                        Console.println("Sequences need to be loaded first using parseXML"); 
    5071                } 
Note: See TracChangeset for help on using the changeset viewer.