-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lmammucari
committed
Jul 9, 2024
1 parent
c6bc550
commit 9526cdc
Showing
7 changed files
with
203 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...e/scheduled-client/src/main/java/it/mef/tm/scheduled/client/costants/GiorniSettimana.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package it.mef.tm.scheduled.client.costants; | ||
|
||
import java.util.stream.Stream; | ||
|
||
public enum GiorniSettimana { | ||
MONDAY(1,"LUN","MON"), | ||
TUESDAY(2,"MAR","TUE"), | ||
WEDNESDAY(3,"MER","WED"), | ||
THURSDAY(4,"GIO","THU"), | ||
FRIDAY(5,"VEN","FRI"), | ||
SATURDAY(6,"SAB","SAT"), | ||
SUNDAY(7,"SOM","SUN"); | ||
|
||
private int numDay; | ||
private String[] acceptedPattern; | ||
/** | ||
* | ||
*/ | ||
private GiorniSettimana(int i, String... acceptedPattern) { | ||
this.numDay = i; | ||
this.acceptedPattern = acceptedPattern; | ||
} | ||
|
||
public static final boolean verifyDay(String day, int dayOfWeek) { | ||
GiorniSettimana giorno = Stream.of(GiorniSettimana.values()).filter(g -> g.numDay == dayOfWeek).findFirst().orElse(null); | ||
return giorno != null && (Stream.of(giorno.acceptedPattern).anyMatch(day::contains) || day.contains(String.valueOf(giorno.numDay))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters