Projekt

Obecné

Profil

« Předchozí | Další » 

Revize dbc30010

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

Configuration - Business As Usual

Zobrazit rozdíly:

src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/BusinessAsUsualDetectorImpl.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 org.slf4j.Logger;
9 6
import org.slf4j.LoggerFactory;
10 7

  
......
21 18
            "Business As Usual",
22 19
            "BusinessAsUsual",
23 20
            "Absence of a retrospective after individual " +
24
                    "iterations or after the completion project.");
21
                    "iterations or after the completion project.",
22
            new HashMap<>() {{
23
                put("divisionOfIterationsWithRetrospective", new Configuration<Float>("divisionOfIterationsWithRetrospective",
24
                        "Division of iterations with retrospective",
25
                        "Minimum percentage of the total number of iterations with a retrospective (0,1)", 0.66666f));
26
            }});
25 27

  
26 28
    private final String sqlFileName = "business_as_usual.sql";
27 29

  
28 30
    // sql queries loaded from sql file
29 31
    private List<String> sqlQueries;
30

  
31
    /**
32
     * SETTINGS
33
     */
34
    private final float DIVISION_BUSINESS_AS_USUAL_ITERATIONS = (float) 1/3;
32
    
33
    private float getDivisionOfIterationsWithRetrospective() {
34
        return (float) antiPattern.getConfigurations().get("divisionOfIterationsWithRetrospective").getValue();
35
    }
35 36

  
36 37
    @Override
37 38
    public AntiPattern getAntiPatternModel() {
......
99 100

  
100 101
        }
101 102

  
102
        int minRetrospectiveLimit =  totalNumberIterations.intValue() - Math.round(totalNumberIterations * DIVISION_BUSINESS_AS_USUAL_ITERATIONS);
103
        int minRetrospectiveLimit =  Math.round(totalNumberIterations * getDivisionOfIterationsWithRetrospective());
103 104

  
104 105
        resultDetails.add(new ResultDetail("Min retrospective limit", String.valueOf(minRetrospectiveLimit)));
105 106
        resultDetails.add(new ResultDetail("Found retrospectives", String.valueOf(iterationsResults.size())));
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/service/AntiPatternServiceImpl.java
70 70
                            return false;
71 71
                        }
72 72

  
73
                    } else if (antiPatternDetector.getAntiPatternModel().getConfigurations().get(configNames[i]).getValue().getClass() == Float.class) {
74
                        try {
75
                            antiPatternDetector.getAntiPatternModel().getConfigurations().get(configNames[i]).setValue((Float.parseFloat(configValues[i])));
76
                        } catch (NumberFormatException e) {
77
                            return false;
78
                        }
73 79
                    }
74

  
75

  
76 80
                }
77 81
            }
78 82
        }
src/main/webapp/WEB-INF/templates/configuration.html
34 34
                    <label th:text="${config.value.printName}" th:for="${config.value.name}"
35 35
                           class="col-sm-5 col-form-label"></label>
36 36
                    <div class="col-sm-5">
37
                        <input th:value="${config.value.value}" type="number" class="form-control" th:id="${config.value.name}"
37
                        <input th:value="${config.value.value}" class="form-control" th:id="${config.value.name}"
38 38
                               name="configValues">
39 39
                        <input th:value="${config.value.name}" style="display: none" class="form-control"
40 40
                               name="configNames">

Také k dispozici: Unified diff