Changeset 251 for trunk/EventBenchCore


Ignore:
Timestamp:
10/11/11 20:40:58 (13 years ago)
Author:
sherbold
Message:
  • the method train() of de.ugoe.cs.eventbench.models.Trie now aborts immediately if the order is less than 1.
  • added method isRoot() to de.ugoe.cs.eventbench.models.TrieNode?
Location:
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/Trie.java

    r248 r251  
    8585         */ 
    8686        public void train(List<T> sequence, int maxOrder) { 
     87                if( maxOrder<1 ) { 
     88                        return; 
     89                } 
    8790                IncompleteMemory<T> latestActions = new IncompleteMemory<T>(maxOrder); 
    8891                int i = 0; 
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/TrieNode.java

    r248 r251  
    246246        void getGraph(TrieVertex parent, DelegateTree<TrieVertex, Edge> graph) { 
    247247                TrieVertex currentVertex; 
    248                 if (symbol == null) { 
     248                if (isRoot()) { 
    249249                        currentVertex = new TrieVertex("root"); 
    250250                        graph.addVertex(currentVertex); 
     
    270270        void appendDotRepresentation(StringBuilder stringBuilder) { 
    271271                String thisSaneId; 
    272                 if (symbol == null) { 
     272                if (isRoot()) { 
    273273                        thisSaneId = "root"; 
    274274                } else { 
     
    297297        protected boolean isLeaf() { 
    298298                return children.isEmpty(); 
     299        } 
     300         
     301        /** 
     302         * <p> 
     303         * Checks if the node is the root. 
     304         * </p> 
     305         *  
     306         * @return true if the node is the root of the trie, false otherwise 
     307         */ 
     308        protected boolean isRoot() { 
     309                return symbol==null; 
    299310        } 
    300311 
Note: See TracChangeset for help on using the changeset viewer.