Optimize getting of points.
This commit is contained in:
@@ -86,7 +86,7 @@ public class PointEngine {
|
||||
if (defaultMatcher.find()) {
|
||||
defaultPoints = Double.parseDouble(defaultMatcher.group(1));
|
||||
} else {
|
||||
rules.add(new PointRule(line));
|
||||
rules.addFirst(new PointRule(line));
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
@@ -97,12 +97,11 @@ public class PointEngine {
|
||||
public void reset() { rules.clear(); }
|
||||
|
||||
public double getPointsOfDay(LocalDate date) {
|
||||
double points = defaultPoints;
|
||||
for (PointRule rule : rules) {
|
||||
if (rule.applies(date)) {
|
||||
points = rule.getPoints();
|
||||
return rule.getPoints();
|
||||
}
|
||||
}
|
||||
return points;
|
||||
return defaultPoints;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
default 1.0
|
||||
dow=Fri 0.825
|
||||
2026-12-24 0.5
|
||||
2026-12-31 0.5
|
||||
m=Jul 0.825
|
||||
m=Aug 0.825
|
||||
2026-12-24 0.5
|
||||
2026-12-31 0.5
|
||||
|
||||
Reference in New Issue
Block a user