Revize 8d410349
Přidáno uživatelem Ondřej Váně před téměř 3 roky(ů)
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/BusinessAsUsualDetectorImpl.java | ||
---|---|---|
23 | 23 |
put("divisionOfIterationsWithRetrospective", new Configuration<Percentage>("divisionOfIterationsWithRetrospective", |
24 | 24 |
"Division of iterations with retrospective", |
25 | 25 |
"Minimum percentage of the total number of iterations with a retrospective (0,100)", |
26 |
"Percentage must be between 0 and 100", |
|
27 |
new Percentage(66))); |
|
26 |
"Percentage must be float number between 0 and 100",
|
|
27 |
new Percentage(66.66f)));
|
|
28 | 28 |
put("searchSubstringsWithRetrospective", new Configuration<String>("searchSubstringsWithRetrospective", |
29 | 29 |
"Search substrings with retrospective", |
30 | 30 |
"Substring that will be search in wikipages and activities", |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/LongOrNonExistentFeedbackLoopsDetectorImpl.java | ||
---|---|---|
28 | 28 |
new HashMap<>() {{ |
29 | 29 |
put("divisionOfIterationsWithFeedbackLoop", new Configuration<Percentage>("divisionOfIterationsWithFeedbackLoop", |
30 | 30 |
"Division of iterations with feedback loop", |
31 |
"Minimum percentage of the total number of iterations with feedback loop (0,1)", |
|
32 |
"Percentage must be between 0 and 100", |
|
33 |
new Percentage(50))); |
|
31 |
"Minimum percentage of the total number of iterations with feedback loop (0,100)",
|
|
32 |
"Percentage must be float number between 0 and 100",
|
|
33 |
new Percentage(50.00f)));
|
|
34 | 34 |
put("maxGapBetweenFeedbackLoopRate", new Configuration<PositiveFloat>("maxGapBetweenFeedbackLoopRate", |
35 | 35 |
"Maximum gap between feedback loop rate", |
36 | 36 |
"Value that multiplies average iteration length for given project. Result" + |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/model/types/Percentage.java | ||
---|---|---|
5 | 5 |
public static final float MAX_VALUE = 100; |
6 | 6 |
public static final float MIN_VALUE = 0; |
7 | 7 |
|
8 |
private final int value;
|
|
8 |
private final float value;
|
|
9 | 9 |
|
10 |
public Percentage(int value) throws NumberFormatException {
|
|
10 |
public Percentage(float value) throws NumberFormatException {
|
|
11 | 11 |
if (value > MAX_VALUE || value < MIN_VALUE) { |
12 | 12 |
throw new NumberFormatException("Percentage should be between 0 and 100"); |
13 | 13 |
} |
... | ... | |
15 | 15 |
} |
16 | 16 |
|
17 | 17 |
public static Percentage parsePercentage(String value) { |
18 |
return new Percentage(Integer.parseInt(value));
|
|
18 |
return new Percentage(Float.parseFloat(value));
|
|
19 | 19 |
} |
20 | 20 |
|
21 | 21 |
@Override |
22 | 22 |
public int intValue() { |
23 |
return this.value; |
|
23 |
return (int) this.value;
|
|
24 | 24 |
} |
25 | 25 |
|
26 | 26 |
@Override |
... | ... | |
44 | 44 |
} |
45 | 45 |
|
46 | 46 |
public float getValue() { |
47 |
return (float) value/100;
|
|
47 |
return value /100;
|
|
48 | 48 |
} |
49 | 49 |
} |
Také k dispozici: Unified diff
#5 Implement user input checks
- change percentage data type from integer to float
- allow decimal values in percentage