Changeset 248


Ignore:
Timestamp:
10/06/11 19:07:39 (13 years ago)
Author:
sherbold
Message:
  • added method getNumTransitions to interface de.ugoe.cs.eventbench.models.IStochasticProcess and implemented it in implementing classes
Location:
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models
Files:
4 edited

Legend:

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

    r129 r248  
    3232         */ 
    3333        double getProbability(List<? extends Event<?>> context, Event<?> symbol); 
    34          
     34 
    3535        /** 
    3636         * <p> 
    37          * Returns the probabilitiy that a given sequence is generated by the stochastic process. 
     37         * Returns the probabilitiy that a given sequence is generated by the 
     38         * stochastic process. 
    3839         * </p> 
    39          * @param sequence sequences of which the probability is calculated 
     40         *  
     41         * @param sequence 
     42         *            sequences of which the probability is calculated 
    4043         * @return probability of the sequences; 1.0 if sequence is empty or null 
    4144         */ 
     
    97100         * @return generated sequences 
    98101         */ 
    99         public Collection<List<? extends Event<?>>> generateValidSequences(int length); 
     102        public Collection<List<? extends Event<?>>> generateValidSequences( 
     103                        int length); 
    100104 
    101105        /** 
     
    117121         */ 
    118122        public String[] getSymbolStrings(); 
    119          
     123 
    120124        /** 
    121125         * <p> 
    122          * Returns the number of states the process would have if it would be flattened through state-splitting to a first-order Markov model. 
     126         * Returns the number of states the process would have if it would be 
     127         * flattened through state-splitting to a first-order Markov model. 
    123128         * </p> 
    124129         * <p> 
     
    126131         * </p> 
    127132         *  
    128          * @return number of states an equivalent FOM would have; -1 is not available 
     133         * @return number of states an equivalent FOM would have; -1 if not 
     134         *         available 
    129135         */ 
    130136        public int getNumFOMStates(); 
     137 
     138        /** 
     139         * <p> 
     140         * Returns the number of transitions the process would have if it would be 
     141         * flattened through state-splitting to a first-order Markov model. 
     142         * </p> 
     143         *  
     144         * @return number of transitions an equivalent FOM would have; -1 if not 
     145         *         available 
     146         */ 
     147        public int getNumTransitions(); 
    131148 
    132149        /** 
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/Trie.java

    r129 r248  
    386386                return ancestors.size(); 
    387387        } 
     388 
     389        /** 
     390         * <p> 
     391         * Returns the number of trie nodes that are leafs. 
     392         * </p> 
     393         *  
     394         * @return number of leafs in the trie 
     395         */ 
     396        public int getNumLeafs() { 
     397                return rootNode.getNumLeafs(); 
     398        } 
    388399} 
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/TrieBasedModel.java

    r182 r248  
    336336                return trie.getNumLeafAncestors(); 
    337337        } 
     338 
     339        /* 
     340         * (non-Javadoc) 
     341         *  
     342         * @see de.ugoe.cs.eventbench.models.IStochasticProcess#getNumTransitions() 
     343         */ 
     344        @Override 
     345        public int getNumTransitions() { 
     346                return trie.getNumLeafs(); 
     347        } 
    338348} 
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/TrieNode.java

    r129 r248  
    318318                } 
    319319        } 
     320         
     321        /** 
     322         * <p>Returns the number of descendants of this node that are leafs. This does not only include direct children of this node, but all leafs in the sub-trie with this node as root. 
     323         * </p> 
     324         * @return 
     325         */ 
     326        protected int getNumLeafs() { 
     327                int numLeafs = 0; 
     328                for( TrieNode<T> child : children) { 
     329                        if( child.isLeaf() ) { 
     330                                numLeafs++; 
     331                        } else { 
     332                                numLeafs += child.getNumLeafs(); 
     333                        } 
     334                } 
     335                return numLeafs; 
     336        } 
    320337} 
Note: See TracChangeset for help on using the changeset viewer.