Projekt

Obecné

Profil

« Předchozí | Další » 

Revize a19493d7

Přidáno uživatelem Ondřej Váně před téměř 4 roky(ů)

Ninety ninety implemented

Zobrazit rozdíly:

src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/NinetyNinetyRuleDetectorImpl.java
30 30
     */
31 31
    private static final double MAX_DIVISION_RANGE = 1.2;
32 32
    private static final double MIN_DIVISION_RANGE = 0.8;
33
    private static final int MAX_BAD_ITERATION_LIMIT = 3;
33 34

  
34 35
    @Override
35 36
    public AntiPattern getAntiPatternModel() {
......
51 52
     *      1) pro každou iteraci udělat součet stráveného a odhadovaného času přes všechny aktivity
52 53
     *      2) udělat podíl strávený čas / odhadovaný čas
53 54
     *      3) pokud všechny výsledky podílů budou v rozsahu 0.8 - 1.2 => vše ok
54
     *      4) čím více ke konci projektu tím by se měly odhady zpřesňovat
55
     *      4) pokud předchozí bod nezabere, tak iterovat přes všechny podíly
56
     *      5) pokud budou nalezeny tři iterace po sobě, které se stále zhoršují stejným směrem => detekce
55 57
     *
56 58
     * @param project            analyzovaný project
57 59
     * @param databaseConnection databázové připojení
......
81 83
        }
82 84

  
83 85
        if (isAllInRange) {
84
            resultDetails.add(new ResultDetail("Conclusion", "All divisions of estimated and spent time are in range"));
86
            resultDetails.add(new ResultDetail("Conclusion",
87
                    "All divisions of estimated and spent time are in range"));
85 88
            return new QueryResultItem(this.antiPattern, false, resultDetails);
86 89
        }
87 90

  
88
        //TODO když je mimo rozsah
91
        int counterOverEstimated = 0;
92
        int counterUnderEstimated = 0;
93
        for (Double divisionResult : divisionsResults) {
94
            if (divisionResult > MAX_DIVISION_RANGE) {
95
                counterOverEstimated++;
96
                counterUnderEstimated = 0;
97
            }
98

  
99
            if (divisionResult < MIN_DIVISION_RANGE) {
100
                counterUnderEstimated++;
101
                counterOverEstimated = 0;
102
            }
103

  
104
            if (counterOverEstimated >= MAX_BAD_ITERATION_LIMIT) {
105
                resultDetails.add(new ResultDetail("Conclusion",
106
                        "Found bad significant trend in estimated time - over estimated."));
107
                return new QueryResultItem(this.antiPattern, false, resultDetails);
108
            }
109

  
110
            if (counterUnderEstimated >= MAX_BAD_ITERATION_LIMIT) {
111
                resultDetails.add(new ResultDetail("Conclusion",
112
                        "Found bad significant trend in estimated time - under estimated."));
113
                return new QueryResultItem(this.antiPattern, false, resultDetails);
114
            }
115
        }
89 116

  
90
        return new QueryResultItem(this.antiPattern, true, resultDetails);
117
        resultDetails.add(new ResultDetail("Conclusion",
118
                "No significant trend was found for estimation and time worked on activities"));
119
        return new QueryResultItem(this.antiPattern, false, resultDetails);
91 120
    }
92 121
}

Také k dispozici: Unified diff