Ignore:
Timestamp:
03/12/15 15:50:28 (9 years ago)
Author:
pharms
Message:
  • extension with further smell detections
  • may not fully work. But Hudson is more happy because compile errors should be gone
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/UsabilitySmellIntensity.java

    r1493 r1918  
    2626 * @author 2012, last modified by $Author: pharms$ 
    2727 */ 
    28 public enum UsabilityDefectSeverity { 
    29      
    30     INFO, LOW, MEDIUM, HIGH; 
     28public class UsabilitySmellIntensity { 
    3129     
    3230    /** */ 
    33     static int defaultCoverageQuantile = 950; 
     31    private int ratio; 
     32     
     33    /** */ 
     34    private int eventCoverage; 
     35     
     36    /** */ 
     37    private int eventCoverageQuantile; 
    3438 
    3539    /** 
    3640     *  
    3741     */ 
    38     static UsabilityDefectSeverity getSeverity(int ratio, 
    39                                                int highRatioLevel, 
    40                                                int mediumRatioLevel, 
    41                                                int lowRatioLevel, 
    42                                                int infoRatioLevel) 
     42    static UsabilitySmellIntensity getIntensity(int        ratio, 
     43                                                ITask      taskWithSmell, 
     44                                                ITaskModel wholeTaskModel) 
    4345    { 
    44         return getSeverity(ratio, highRatioLevel, mediumRatioLevel, lowRatioLevel, infoRatioLevel, 
    45                            defaultCoverageQuantile); 
     46        ITaskInfo taskInfo = wholeTaskModel.getTaskInfo(taskWithSmell); 
     47        int eventCoverage = taskInfo.getMeasureValue(TaskMetric.EVENT_COVERAGE); 
     48        int eventCoverageQuantile = taskInfo.getMeasureValue(TaskMetric.EVENT_COVERAGE_QUANTILE); 
     49        return getIntensity(ratio, eventCoverage, eventCoverageQuantile); 
    4650    } 
    4751 
     
    4953     *  
    5054     */ 
    51     static UsabilityDefectSeverity getSeverity(int        ratio, 
    52                                                int        highRatioLevel, 
    53                                                int        mediumRatioLevel, 
    54                                                int        lowRatioLevel, 
    55                                                int        infoRatioLevel, 
    56                                                ITask      taskWithDefect, 
    57                                                ITaskModel wholeTaskModel) 
    58     { 
    59         ITaskInfo taskInfo = wholeTaskModel.getTaskInfo(taskWithDefect); 
    60         int eventCoverageQuantile = taskInfo.getMeasureValue(TaskMetric.EVENT_COVERAGE_QUANTILE); 
    61         return getSeverity(ratio, highRatioLevel, mediumRatioLevel, lowRatioLevel, infoRatioLevel, 
    62                            eventCoverageQuantile); 
     55    static UsabilitySmellIntensity getIntensity(int ratio) { 
     56        return getIntensity(ratio, -1, -1); 
    6357    } 
    6458 
     
    6660     *  
    6761     */ 
    68     static UsabilityDefectSeverity getSeverity(int ratio, 
    69                                                int highRatioLevel, 
    70                                                int mediumRatioLevel, 
    71                                                int lowRatioLevel, 
    72                                                int infoRatioLevel, 
    73                                                int coverageQuantile) 
     62    static UsabilitySmellIntensity getIntensity(int ratio, 
     63                                                int eventCoverage, 
     64                                                int eventCoverageQuantile) 
    7465    { 
    75         int effectiveRatio = ratio; 
    76          
    77         // event coverage ratio is in per mille. The more executed events a task covers, the more 
    78         // important a related usability defect. 
    79         /*if (eventCoverageRatio < 1) { 
    80             // one per mille, so one of thousand events is covered 
    81             effectiveRatio *= 0.2; 
     66        if ((ratio > 0) && ((eventCoverageQuantile == -1) || (eventCoverageQuantile > 0))) { 
     67            return new UsabilitySmellIntensity(ratio, eventCoverage, eventCoverageQuantile); 
    8268        } 
    83         else if (eventCoverageRatio < 5) { 
    84             // 5 per mille, so one of 250 events is covered 
    85             effectiveRatio *= 0.4; 
     69        else { 
     70            return null; 
    8671        } 
    87         else if (eventCoverageRatio < 10) { 
    88             // 1 percent, so one of 100 events is covered 
    89             effectiveRatio *= 0.5; 
    90         } 
    91         else if (eventCoverageRatio < 20) { 
    92             // 2 percent, so one of 50 events is covered 
    93             effectiveRatio *= 0.6; 
    94         } 
    95         else if (eventCoverageRatio < 30) { 
    96             // 3 percent, so one of 33 events is covered 
    97             effectiveRatio *= 0.7; 
    98         } 
    99         else if (eventCoverageRatio < 40) { 
    100             // 4 percent, so one of 28 events is covered 
    101             effectiveRatio *= 0.8; 
    102         } 
    103         else if (eventCoverageRatio < 50) { 
    104             // 5 percent, so one of 25 events is covered 
    105             effectiveRatio *= 0.9; 
    106         }*/ 
    107         //else { 
    108             // more than 5 percent, so 1 of 20 events, do not change ratio 
    109         //} 
    110         if (coverageQuantile >= defaultCoverageQuantile) { 
    111             if (effectiveRatio >= highRatioLevel) { 
    112                 return UsabilityDefectSeverity.HIGH; 
    113             } 
    114             else if (effectiveRatio >= mediumRatioLevel) { 
    115                 return UsabilityDefectSeverity.MEDIUM; 
    116             } 
    117             else if (effectiveRatio >= lowRatioLevel) { 
    118                 return UsabilityDefectSeverity.LOW; 
    119             } 
    120             else if (effectiveRatio >= infoRatioLevel) { 
    121                 return UsabilityDefectSeverity.INFO; 
    122             } 
    123         } 
    124          
    125         return null; 
    12672    } 
     73 
     74    /** 
     75     * <p> 
     76     * TODO: comment 
     77     * </p> 
     78     * 
     79     * @param ratio 
     80     * @param eventCoverage 
     81     * @param eventCoverageQuantile 
     82     */ 
     83    private UsabilitySmellIntensity(int ratio, int eventCoverage, int eventCoverageQuantile) { 
     84        super(); 
     85        this.ratio = ratio; 
     86        this.eventCoverage = eventCoverage; 
     87        this.eventCoverageQuantile = eventCoverageQuantile; 
     88    } 
     89 
     90    /** 
     91     * @return the ratio 
     92     */ 
     93    public int getRatio() { 
     94        return ratio; 
     95    } 
     96 
     97    /** 
     98     * @return the eventCoverage 
     99     */ 
     100    public int getEventCoverage() { 
     101        return eventCoverage; 
     102    } 
     103 
     104    /** 
     105     * @return the eventCoverageQuantile 
     106     */ 
     107    public int getEventCoverageQuantile() { 
     108        return eventCoverageQuantile; 
     109    } 
     110 
     111    /* (non-Javadoc) 
     112     * @see java.lang.Object#toString() 
     113     */ 
     114    @Override 
     115    public String toString() { 
     116        return Integer.toString(ratio); 
     117    } 
     118     
    127119} 
Note: See TracChangeset for help on using the changeset viewer.