Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5dfbdbb

Browse files
authored
Revert "Fix 4006"
1 parent 7028fad commit 5dfbdbb

File tree

4 files changed

+4
-49
lines changed

4 files changed

+4
-49
lines changed

hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/BoolArrayMatcher.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ public class BoolArrayMatcher implements PartMatcher {
1818
* 用户定义此字段的最小值
1919
*/
2020
private final int minValue;
21-
/**
22-
* 用户定义此字段的最大值
23-
*/
24-
private final int maxValue;
2521
private final boolean[] bValues;
2622

2723
/**
@@ -33,15 +29,13 @@ public BoolArrayMatcher(List<Integer> intValueList) {
3329
Assert.isTrue(CollUtil.isNotEmpty(intValueList), "Values must be not empty!");
3430
bValues = new boolean[Collections.max(intValueList) + 1];
3531
int min = Integer.MAX_VALUE;
36-
int max = Integer.MIN_VALUE;
3732
for (Integer value : intValueList) {
3833
min = Math.min(min, value);
39-
max = Math.max(max, value);
4034
bValues[value] = true;
4135
}
4236
this.minValue = min;
43-
this.maxValue = max;
4437
}
38+
4539
@Override
4640
public boolean match(Integer value) {
4741
if (null == value || value >= bValues.length) {
@@ -75,14 +69,6 @@ public int nextAfter(int value) {
7569
public int getMinValue() {
7670
return this.minValue;
7771
}
78-
/**
79-
* 获取表达式定义的最大值
80-
*
81-
* @return 最大值
82-
*/
83-
public int getMaxValue() {
84-
return this.maxValue;
85-
}
8672

8773
@Override
8874
public String toString() {

hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/DayOfMonthMatcher.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,8 @@ private static boolean isLastDayOfMonth(int value, int month, boolean isLeapYear
5050
return value == Month.getLastDay(month - 1, isLeapYear);
5151
}
5252

53-
@Deprecated
5453
public boolean isLast() {
5554
return match(31);
5655
}
5756

58-
/**
59-
* 检查value是否大于等于这个月的最大天
60-
* @param value 被检查的值
61-
* @return
62-
*/
63-
public boolean isLastDay(int value) {
64-
if(value>=getMaxValue()) return true;
65-
return false;
66-
}
67-
6857
}

hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/PatternMatcher.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ private int[] nextMatchValuesAfter(int[] values) {
192192
// pr#1189
193193
if (i == Part.DAY_OF_MONTH.ordinal()
194194
&& matchers[i] instanceof DayOfMonthMatcher
195-
&& ((DayOfMonthMatcher) matchers[i]).isLastDay(values[i])) {
195+
&& ((DayOfMonthMatcher) matchers[i]).isLast()) {
196196
int newMonth = newValues[Part.MONTH.ordinal()];
197197
int newYear = newValues[Part.YEAR.ordinal()];
198198
nextValue = getLastDay(newMonth, newYear);
@@ -226,7 +226,7 @@ private int[] nextMatchValuesAfter(int[] values) {
226226
continue;
227227
} else if (i == Part.DAY_OF_MONTH.ordinal()
228228
&& matchers[i] instanceof DayOfMonthMatcher
229-
&& ((DayOfMonthMatcher) matchers[i]).isLastDay(values[i])) {
229+
&& ((DayOfMonthMatcher) matchers[i]).isLast()) {
230230
int newMonth = newValues[Part.MONTH.ordinal()];
231231
int newYear = newValues[Part.YEAR.ordinal()];
232232
nextValue = getLastDay(newMonth, newYear);
@@ -259,7 +259,7 @@ private void setToMin(int[] values, int toPart) {
259259
part = Part.of(i);
260260
if (part == Part.DAY_OF_MONTH
261261
&& get(part) instanceof DayOfMonthMatcher
262-
&& ((DayOfMonthMatcher) get(part)).isLastDay(values[i])) {
262+
&& ((DayOfMonthMatcher) get(part)).isLast()) {
263263
int newMonth = values[Part.MONTH.ordinal()];
264264
int newYear = values[Part.YEAR.ordinal()];
265265
values[i] = getLastDay(newMonth, newYear);

hutool-cron/src/test/java/cn/hutool/cron/pattern/Issue4006Test.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)