Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format fixes in HierarchyBuilderDate #441

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public Format() {
map.put(Granularity.HOUR_DAY_MONTH_YEAR, "dd.MM.yyyy-HH:00");
map.put(Granularity.DAY_MONTH_YEAR, "dd.MM.yyyy");
map.put(Granularity.WEEK_MONTH_YEAR, "W/MM.yyyy");
map.put(Granularity.WEEK_YEAR, "ww/yyyy");
map.put(Granularity.WEEK_YEAR, "ww/YYYY");
map.put(Granularity.MONTH_YEAR, "MM/yyyy");
map.put(Granularity.QUARTER_YEAR, "QQQ yyyy");
}
Expand Down Expand Up @@ -183,7 +183,7 @@ public static enum Granularity {
/** Granularity */
WEEK_MONTH_YEAR("W/MM.yyyy"),
/** Granularity */
WEEK_YEAR("ww/yyyy"),
WEEK_YEAR("ww/YYYY"),
/** Granularity */
MONTH_YEAR("MM/yyyy"),
/** Granularity */
Expand Down Expand Up @@ -542,10 +542,10 @@ private String generalize(String input, Granularity granularity) {
if (_range == null) {
return formatter.format(dateTime);
} else {
int dateUnit = Integer.valueOf(formatter.format(dateTime));
int dateUnit = Integer.valueOf(formatter.format(dateTime)) - 1;
int lower = Integer.valueOf((dateUnit) / (_range)) * (_range);
int upper = lower + _range;
String outputDate = "[" + lower + ", " + upper + "[";
String outputDate = "[" + (lower+1) + ", " + (upper+1) + "[";

Check warning

Code scanning / PMD

Consider simply returning the value vs storing it in local variable 'solution'

Consider simply returning the value vs storing it in local variable 'outputDate'
return outputDate;
}
}
Expand Down