Projekt

Obecné

Profil

« Předchozí | Další » 

Revize dec85686

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

Configuration - Long Or Non Existant Feedback Loops

Zobrazit rozdíly:

src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/LongOrNonExistentFeedbackLoopsDetectorImpl.java
1 1
package cz.zcu.fav.kiv.antipatterndetectionapp.detecting.detectors;
2 2

  
3 3
import cz.zcu.fav.kiv.antipatterndetectionapp.detecting.DatabaseConnection;
4
import cz.zcu.fav.kiv.antipatterndetectionapp.model.AntiPattern;
5
import cz.zcu.fav.kiv.antipatterndetectionapp.model.Project;
6
import cz.zcu.fav.kiv.antipatterndetectionapp.model.QueryResultItem;
7
import cz.zcu.fav.kiv.antipatterndetectionapp.model.ResultDetail;
4
import cz.zcu.fav.kiv.antipatterndetectionapp.model.*;
8 5
import cz.zcu.fav.kiv.antipatterndetectionapp.utils.Utils;
9 6
import org.slf4j.Logger;
10 7
import org.slf4j.LoggerFactory;
......
12 9
import java.math.BigDecimal;
13 10
import java.sql.Date;
14 11
import java.util.ArrayList;
12
import java.util.HashMap;
15 13
import java.util.List;
16 14
import java.util.Map;
17 15

  
......
26 24
                    "enters the project and sees the final result. In the end, the customer " +
27 25
                    "may not get what he really wanted. With long intervals of feedback, " +
28 26
                    "some misunderstood functionality can be created and we have to spend " +
29
                    "a lot of effort and time to redo it. ");
27
                    "a lot of effort and time to redo it. ",
28
            new HashMap<>() {{
29
                put("divisionOfIterationsWithFeedbackLoop", new Configuration<Float>("divisionOfIterationsWithFeedbackLoop",
30
                        "Division of iterations with feedback loop",
31
                        "Minimum percentage of the total number of iterations with feedback loop (0,1)", 0.5f));
32
                put("maxGapBetweenFeedbackLoopRate", new Configuration<Float>("maxGapBetweenFeedbackLoopRate",
33
                        "Maximum gap between feedback loop rate",
34
                        "Value that multiplies average iteration length for given project. Result" +
35
                                " is maximum threshold value for gap between feedback loops in days.", 2f));
36
            }}
37
            );
30 38

  
31 39
    private final String SQL_FILE_NAME = "long_or_non_existent_feedback_loops.sql";
32 40
    // sql queries loaded from sql file
33 41
    private List<String> sqlQueries;
34 42

  
35
    /**
36
     * SETTINGS
37
     */
43
    private float getDivisionOfIterationsWithFeedbackLoop() {
44
        return (float) antiPattern.getConfigurations().get("divisionOfIterationsWithFeedbackLoop").getValue();
45
    }
46

  
47
    private float getMaxGapBetweenFeedbackLoopRate() {
48
        return (float) antiPattern.getConfigurations().get("maxGapBetweenFeedbackLoopRate").getValue();
49
    }
38 50

  
39 51
    @Override
40 52
    public AntiPattern getAntiPatternModel() {
......
121 133
            }
122 134
        }
123 135

  
124
        double halfNumberOfIterations = totalNumberIterations / 2.0;
136
        double halfNumberOfIterations = totalNumberIterations * getDivisionOfIterationsWithFeedbackLoop();
125 137

  
126 138
        // pokud je počet iterací, které obsahují alespoň jednu aktivitu s feedbackem, tak je to ideální případ
127 139
        if (totalNumberIterations <= numberOfIterationsWhichContainsAtLeastOneActivityForFeedback) {
......
144 156
                long daysBetween = Utils.daysBetween(firstDate, secondDate);
145 157
                firstDate = secondDate;
146 158

  
147
                if (daysBetween >= 2 * averageIterationLength) {
159
                if (daysBetween >= getMaxGapBetweenFeedbackLoopRate() * averageIterationLength) {
148 160
                    List<ResultDetail> resultDetails = Utils.createResultDetailsList(
149 161
                            new ResultDetail("Days between", Long.toString(daysBetween)),
150 162
                            new ResultDetail("Average iteration length", Integer.toString(averageIterationLength)),
......
185 197
                long daysBetween = Utils.daysBetween(firstDate, secondDate);
186 198
                firstDate = secondDate;
187 199

  
188
                if (daysBetween >= 2 * averageIterationLength) {
200
                if (daysBetween >= getMaxGapBetweenFeedbackLoopRate() * averageIterationLength) {
189 201
                    List<ResultDetail> resultDetails = Utils.createResultDetailsList(
190 202
                            new ResultDetail("Days between", Long.toString(daysBetween)),
191 203
                            new ResultDetail("Average iteration length", Integer.toString(averageIterationLength)),

Také k dispozici: Unified diff