Changeset 331


Ignore:
Timestamp:
12/19/11 14:24:13 (12 years ago)
Author:
sherbold
Message:
Location:
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/coverage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/coverage/CoverageCalculatorObserved.java

    r223 r331  
    7272         *            length of the subsequences for which the coverage is analyzed; 
    7373         *            must be >0 
     74         * @throws InvalidParameterException 
     75         *             thrown if observedSequences or sequences is null or length 
     76         *             less than or equal to 0 
    7477         */ 
    7578        public CoverageCalculatorObserved( 
     
    7780                        Collection<List<? extends Event<?>>> sequences, int length) { 
    7881                if (observedSequences == null) { 
    79                         throw new InvalidParameterException("process must not be null"); 
     82                        throw new InvalidParameterException( 
     83                                        "observed sequences must not be null"); 
    8084                } 
    8185                if (sequences == null) { 
     
    162166         *            subsequences are possible 
    163167         * @return coverage percentage 
     168         * @throws InvalidParameterException 
     169         *             thrown if process is null 
    164170         */ 
    165171        public double getCoveragePossibleNew(IStochasticProcess process) { 
     172                if (process == null) { 
     173                        throw new InvalidParameterException("process must not be null"); 
     174                } 
    166175                createSubSeqs(); 
    167176                Collection<List<? extends Event<?>>> subSeqsGeneratedCopy = new LinkedHashSet<List<? extends Event<?>>>( 
     
    187196         *            which subsequences are possible 
    188197         * @return coverage percentage 
     198         * @throws InvalidParameterException 
     199         *             thrown if process is null 
    189200         */ 
    190201        public double getCoveragePossibleNewWeight(IStochasticProcess process) { 
     202                if (process == null) { 
     203                        throw new InvalidParameterException("process must not be null"); 
     204                } 
    191205                createSubSeqs(); 
    192206                Collection<List<? extends Event<?>>> subSeqsGeneratedCopy = new LinkedHashSet<List<? extends Event<?>>>( 
     
    200214                double weight = 0.0d; 
    201215                for (List<? extends Event<?>> subSeq : subSeqsGeneratedCopy) { 
    202                         weight += weightMap.get(subSeq); 
     216                        Double currentWeight = weightMap.get(subSeq); 
     217                        if( currentWeight!=null ) { 
     218                                weight += currentWeight; 
     219                        } 
    203220                } 
    204221                return weight; 
    205222        } 
    206          
     223 
    207224        /** 
    208225         * <p> 
    209226         * Returns the number of covered subsequences of length k. 
    210227         * </p> 
    211          *   
     228         *  
    212229         * @return number of covered subsequences 
    213230         */ 
     
    216233                return subSeqsObserved.size(); 
    217234        } 
    218          
     235 
    219236        /** 
    220237         * <p> 
    221238         * Returns the number of covered subsequences of length k. 
    222239         * </p> 
     240         *  
    223241         * @return number of covered subsequences 
    224242         */ 
     
    227245                return subSeqsGenerated.size(); 
    228246        } 
    229          
     247 
    230248        public int getNumNew() { 
    231249                createSubSeqs(); 
     
    235253                return subSeqsGeneratedCopy.size(); 
    236254        } 
    237          
    238255 
    239256        /** 
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/coverage/CoverageCalculatorProcess.java

    r292 r331  
    8181         *            length of the subsequences for which the coverage is analyzed; 
    8282         *            must be >0 
     83         * @throws InvalidParameterException 
     84         *             thrown if process or sequences is null or length less than or equal to 0 
    8385         */ 
    8486        public CoverageCalculatorProcess(IStochasticProcess process, 
     
    200202         * @param newSequences 
    201203         *            new collection of sequences 
     204         * @throws InvalidParameterException 
     205         *             thrown is newSequences is null 
    202206         */ 
    203207        public void setSequences(Collection<List<? extends Event<?>>> newSequences) { 
     208                if (newSequences == null) { 
     209                        throw new InvalidParameterException("sequences must not be null"); 
     210                } 
    204211                this.sequences = newSequences; 
    205212                containedSubSeqs = null; 
Note: See TracChangeset for help on using the changeset viewer.